mirror of
https://github.com/GTNewHorizons/Hardcore-Ender-Expansion.git
synced 2026-10-26 14:24:03 +00:00
Compendium help and achievements, fixed miner ore detection, removed pre-UUID compat
This commit is contained in:
1 parent
af8b352dd9
commit
38eda0ac53
19 files changed
+201
-38
No files matched your search
@@ -11,7 +11,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import chylex.hee.entity.boss.EntityBossDragon;
|
||||
import chylex.hee.system.achievements.AchievementEvents;
|
||||
import chylex.hee.system.achievements.AchievementManager;
|
||||
import chylex.hee.system.util.DragonUtil;
|
||||
|
||||
public class DragonAchievementManager{
|
||||
private final EntityBossDragon dragon;
|
||||
@@ -86,7 +85,7 @@ public class DragonAchievementManager{
|
||||
|
||||
if (b instanceof NBTTagCompound){
|
||||
NBTTagCompound compound = (NBTTagCompound)b;
|
||||
getData(DragonUtil.convertNameToUUID(key)).readFromNBT(compound);
|
||||
getData(UUID.fromString(key)).readFromNBT(compound);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,8 @@ public final class FXHandler{
|
||||
}
|
||||
|
||||
public static void handleEntity(World world, EntityClientPlayerMP player, FXType.Entity fx, double x, double y, double z, float width, float height){
|
||||
width *= 0.75F; // compensate for incorrect rand calculation
|
||||
|
||||
switch(fx){
|
||||
case CHARM_CRITICAL:
|
||||
for(int a = 0; a < 12; a++)world.spawnParticle("crit",x+randCenter(width),y+rand.nextDouble()*height,z+randCenter(width),randCenter(0.2D),randCenter(0.2D),randCenter(0.2D));
|
||||
@@ -282,7 +284,7 @@ public final class FXHandler{
|
||||
}
|
||||
}
|
||||
|
||||
private static double randCenter(double mp){ // TODO review
|
||||
private static double randCenter(double mp){
|
||||
return (rand.nextDouble()-0.5D)*2D*mp;
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public class EntityMobHauntedMiner extends EntityFlying implements IMob{
|
||||
else if (item == Items.iron_ingot || item == Items.gold_ingot || item == Items.diamond || item == Items.redstone || (item == Items.dye && is.getItemDamage() == 4) ||
|
||||
item == Items.emerald || item == Items.coal || item == ItemList.end_powder || item == ItemList.igneous_rock || item == ItemList.instability_orb ||
|
||||
item == ItemList.stardust)foundMiningStuff += 1+(is.stackSize>>3);
|
||||
else if (item instanceof ItemBlock && ItemScorchingPickaxe.isBlockValid(((ItemBlock)item).field_150939_a))foundMiningStuff += 1+(is.stackSize>>3); // TODO ore only
|
||||
else if (item instanceof ItemBlock && ItemScorchingPickaxe.isBlockOre(((ItemBlock)item).field_150939_a))foundMiningStuff += 1+(is.stackSize>>3);
|
||||
}
|
||||
|
||||
if (foundMiningStuff >= 13+rand.nextInt(6))target = (EntityPlayer)temp;
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package chylex.hee.gui;
|
||||
import java.util.Iterator;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.achievement.GuiAchievements;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.stats.StatFileWriter;
|
||||
import net.minecraftforge.common.AchievementPage;
|
||||
import chylex.hee.system.achievements.AchievementManager;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiAchievementsCustom extends GuiAchievements{
|
||||
private GuiButton nextPageButton;
|
||||
private AchievementPage achievements;
|
||||
|
||||
public GuiAchievementsCustom(GuiScreen parent, StatFileWriter statWriter){
|
||||
super(parent,statWriter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
|
||||
for(Iterator<GuiButton> iter = buttonList.iterator(); iter.hasNext();){
|
||||
GuiButton btn = iter.next();
|
||||
|
||||
if (btn.id == 1){
|
||||
btn.width = 140;
|
||||
btn.xPosition = (width>>1)-(btn.width>>1);
|
||||
}
|
||||
else if (btn.id == 2){
|
||||
nextPageButton = btn;
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int buttonId){
|
||||
if (buttonId == 0 && achievements != null){
|
||||
for(Achievement achievement:achievements.getAchievements()){
|
||||
// TODO detect click and return to Compendium
|
||||
}
|
||||
}
|
||||
|
||||
super.mouseClicked(mouseX,mouseY,buttonId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146509_g(){
|
||||
super.func_146509_g();
|
||||
|
||||
for(int a = 0; a < AchievementPage.getAchievementPages().size(); a++){
|
||||
actionPerformed(nextPageButton);
|
||||
|
||||
if (nextPageButton.displayString.equals(AchievementManager.achievementScreenName)){
|
||||
achievements = AchievementPage.getAchievementPage(AchievementManager.achievementScreenName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package chylex.hee.gui;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonState extends GuiButton{
|
||||
public boolean forcedHover;
|
||||
|
||||
public GuiButtonState(int id, int x, int y, int width, int height, String text){
|
||||
super(id,x,y,width,height,text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHoverState(boolean hover){
|
||||
return forcedHover ? 2 : super.getHoverState(hover);
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,7 @@ import chylex.hee.mechanics.compendium.render.ObjectDisplayElement;
|
||||
import chylex.hee.mechanics.compendium.render.PurchaseDisplayElement;
|
||||
import chylex.hee.packets.PacketPipeline;
|
||||
import chylex.hee.packets.server.S02CompendiumPurchase;
|
||||
import chylex.hee.packets.server.S05OpenCompendiumHelp;
|
||||
import chylex.hee.proxy.ModCommonProxy;
|
||||
import chylex.hee.system.ConfigHandler;
|
||||
import chylex.hee.system.util.MathUtil;
|
||||
@@ -79,6 +80,9 @@ public class GuiEnderCompendium extends GuiScreen implements ITooltipRenderer{
|
||||
private byte pageIndex;
|
||||
private GuiButton[] pageArrows = new GuiButton[2];
|
||||
|
||||
private GuiButtonState btnHelp;
|
||||
private byte btnHelpTrigger;
|
||||
|
||||
public GuiEnderCompendium(PlayerCompendiumData compendiumData){
|
||||
this.compendiumData = compendiumData;
|
||||
animationList.add(offsetY = new AnimatedFloat(Easing.CUBIC));
|
||||
@@ -116,15 +120,17 @@ public class GuiEnderCompendium extends GuiScreen implements ITooltipRenderer{
|
||||
public void initGui(){
|
||||
this.portalRenderer = new GuiEndPortalRenderer(this,width-48,height-48,0);
|
||||
|
||||
buttonList.add(new GuiButton(0,(width>>1)-120,height-27,98,20,I18n.format("gui.back")));
|
||||
buttonList.add(new GuiButton(1,(width>>1)-10,height-27,20,20,"?"));
|
||||
buttonList.add(new GuiButton(2,(width>>1)+22,height-27,98,20,I18n.format("gui.done")));
|
||||
buttonList.add(new GuiButton(0,(width>>1)-120,height-27,98,20,I18n.format("gui.achievements")));
|
||||
buttonList.add(btnHelp = new GuiButtonState(1,(width>>1)-10,height-27,20,20,"?"));
|
||||
buttonList.add(new GuiButton(2,(width>>1)+22,height-27,98,20,I18n.format("gui.back")));
|
||||
buttonList.add(pageArrows[0] = new GuiButtonPageArrow(3,0,((height+guiPageTexHeight)>>1)-32,false));
|
||||
buttonList.add(pageArrows[1] = new GuiButtonPageArrow(4,0,((height+guiPageTexHeight)>>1)-32,true));
|
||||
buttonList.add(new GuiButton(5,width-60,height-27,20,20,""));
|
||||
|
||||
for(int a = 0; a < 2; a++)pageArrows[a].visible = false;
|
||||
|
||||
if (currentObject == KnowledgeRegistrations.HELP)btnHelp.forcedHover = true;
|
||||
|
||||
offsetY.set(0);
|
||||
}
|
||||
|
||||
@@ -135,17 +141,16 @@ public class GuiEnderCompendium extends GuiScreen implements ITooltipRenderer{
|
||||
if (!(button.enabled && button.visible))return;
|
||||
|
||||
if (button.id == 0 && !offsetY.isAnimating()){
|
||||
mc.displayGuiScreen(new GuiAchievementsCustom(this,mc.thePlayer.getStatFileWriter()));
|
||||
}
|
||||
else if (button.id == 1)showObject(KnowledgeRegistrations.HELP);
|
||||
else if (button.id == 2 && !offsetY.isAnimating()){
|
||||
if (currentObject != null)showObject(null);
|
||||
else{
|
||||
mc.displayGuiScreen((GuiScreen)null);
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
}
|
||||
else if (button.id == 1)showObject(KnowledgeRegistrations.HELP);
|
||||
else if (button.id == 2){
|
||||
mc.displayGuiScreen((GuiScreen)null);
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
else if (button.id == 3)pageIndex = (byte)Math.max(0,pageIndex-1);
|
||||
else if (button.id == 4)pageIndex = (byte)Math.min(currentObjectPages.size()-1,pageIndex+1);
|
||||
else if (button.id == 5){
|
||||
@@ -166,7 +171,7 @@ public class GuiEnderCompendium extends GuiScreen implements ITooltipRenderer{
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int buttonId){
|
||||
if (buttonId == 1)actionPerformed((GuiButton)buttonList.get(0));
|
||||
if (buttonId == 1)actionPerformed((GuiButton)buttonList.get(2));
|
||||
else if (buttonId == 0){
|
||||
int offY = (int)offsetY.value();
|
||||
|
||||
@@ -266,13 +271,22 @@ public class GuiEnderCompendium extends GuiScreen implements ITooltipRenderer{
|
||||
|
||||
if (offsetY.value() > 0)offsetY.set(0F);
|
||||
else if (offsetY.value() < -totalHeight+height-32)offsetY.set(-totalHeight+height-32);
|
||||
|
||||
if (!compendiumData.seenHelp() && ++btnHelpTrigger > 10){
|
||||
btnHelp.forcedHover = !btnHelp.forcedHover;
|
||||
btnHelpTrigger = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void showObject(KnowledgeObject<? extends IKnowledgeObjectInstance<?>> object){
|
||||
if (currentObject != null){
|
||||
currentObjectPages.clear();
|
||||
purchaseElements.clear();
|
||||
if (currentObject != object)pageIndex = 0;
|
||||
|
||||
if (currentObject != object){
|
||||
pageIndex = 0;
|
||||
btnHelp.forcedHover = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((currentObject = object) == null)return;
|
||||
@@ -302,7 +316,16 @@ public class GuiEnderCompendium extends GuiScreen implements ITooltipRenderer{
|
||||
yy += height;
|
||||
}
|
||||
|
||||
if (object == KnowledgeRegistrations.HELP)return;
|
||||
if (object == KnowledgeRegistrations.HELP){
|
||||
btnHelp.forcedHover = true;
|
||||
|
||||
if (!compendiumData.seenHelp()){
|
||||
PacketPipeline.sendToServer(new S05OpenCompendiumHelp());
|
||||
compendiumData.setSeenHelp();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!compendiumData.hasDiscoveredObject(currentObject)){
|
||||
if (currentObject.isBuyable())purchaseElements.add(new PurchaseDisplayElement(currentObject,(this.height>>1)-3,compendiumData.getPoints() >= currentObject.getUnlockPrice() ? FragmentPurchaseStatus.CAN_PURCHASE : FragmentPurchaseStatus.NOT_ENOUGH_POINTS));
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package chylex.hee.item;
|
||||
import java.util.ArrayList;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
@@ -23,8 +25,9 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemScorchingPickaxe extends Item{
|
||||
private static final Pattern blockRegex = Pattern.compile("(?:^ore[A-Z].+$)|(?:^ore_.+$)|(?:.+_ore$)|(?:.+Ore$)");
|
||||
private static final Pattern oreRegex = Pattern.compile("(?:^ore[A-Z].+$)|(?:^ore_.+$)|(?:.+_ore$)|(?:.+Ore$)");
|
||||
private static final Map<Block,Boolean> cachedBlocks = new IdentityHashMap<>();
|
||||
private static final List<Block> cachedOres = new ArrayList<>();
|
||||
private static final Random cacheRand = new Random(0);
|
||||
|
||||
public static final boolean isBlockValid(Block block){
|
||||
@@ -41,7 +44,7 @@ public class ItemScorchingPickaxe extends Item{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (blockRegex.matcher(name.name).find()){
|
||||
if (oreRegex.matcher(name.name).find()){
|
||||
Item drop = block.getItemDropped(0,cacheRand,0);
|
||||
|
||||
if (drop != null && !(drop instanceof ItemBlock)){
|
||||
@@ -50,6 +53,7 @@ public class ItemScorchingPickaxe extends Item{
|
||||
boolean isValid = testAmt > 50;
|
||||
|
||||
cachedBlocks.put(block,isValid);
|
||||
cachedOres.add(block);
|
||||
return isValid;
|
||||
}
|
||||
}
|
||||
@@ -58,6 +62,10 @@ public class ItemScorchingPickaxe extends Item{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static final boolean isBlockOre(Block block){
|
||||
return isBlockValid(block) && cachedOres.contains(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack is, World world, Block block, int x, int y, int z, EntityLivingBase owner){
|
||||
if (block.getBlockHardness(world,x,y,z) != 0D)is.damageItem(1,owner);
|
||||
|
||||
@@ -272,6 +272,7 @@ public final class KnowledgeRegistrations{
|
||||
new KnowledgeFragmentText(7),
|
||||
new KnowledgeFragmentText(8),
|
||||
new KnowledgeFragmentText(9),
|
||||
new KnowledgeFragmentText(17),
|
||||
new KnowledgeFragmentText(18)
|
||||
});
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.lwjgl.input.Mouse;
|
||||
import chylex.hee.HardcoreEnderExpansion;
|
||||
import chylex.hee.gui.ContainerEndPowderEnhancements;
|
||||
import chylex.hee.gui.GuiEnderCompendium;
|
||||
import chylex.hee.mechanics.compendium.KnowledgeRegistrations;
|
||||
import chylex.hee.mechanics.compendium.content.KnowledgeObject;
|
||||
import chylex.hee.mechanics.compendium.objects.IKnowledgeObjectInstance;
|
||||
import chylex.hee.mechanics.compendium.player.PlayerCompendiumData;
|
||||
@@ -70,6 +71,7 @@ public final class CompendiumEventsClient{
|
||||
compendium.showObject(obj);
|
||||
compendium.moveToCurrentObject(false);
|
||||
}
|
||||
else if (!instance.data.seenHelp())compendium.showObject(KnowledgeRegistrations.HELP);
|
||||
}
|
||||
|
||||
public static int getCompendiumKeyCode(){
|
||||
|
||||
@@ -27,6 +27,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PlayerCompendiumData implements IExtendedEntityProperties{
|
||||
private boolean seenHelp;
|
||||
private int pointAmount;
|
||||
|
||||
private final PlayerDiscoveryList<ObjectBlock,BlockMetaWrapper> discoveredBlocks = new PlayerDiscoveryList<>(new DiscoveryBlockSerializer());
|
||||
@@ -43,6 +44,14 @@ public class PlayerCompendiumData implements IExtendedEntityProperties{
|
||||
loadNBTData(nbt);
|
||||
}
|
||||
|
||||
public boolean seenHelp(){
|
||||
return seenHelp;
|
||||
}
|
||||
|
||||
public void setSeenHelp(){
|
||||
seenHelp = true;
|
||||
}
|
||||
|
||||
public int getPoints(){
|
||||
return pointAmount;
|
||||
}
|
||||
@@ -154,6 +163,7 @@ public class PlayerCompendiumData implements IExtendedEntityProperties{
|
||||
public void saveNBTData(NBTTagCompound nbt){
|
||||
Stopwatch.time("PlayerCompendiumData - save");
|
||||
NBTTagCompound hee = new NBTTagCompound();
|
||||
hee.setBoolean("hlp",seenHelp);
|
||||
hee.setInteger("kps",pointAmount);
|
||||
hee.setTag("fndBlocks",discoveredBlocks.saveToNBTList());
|
||||
hee.setTag("fndItems",discoveredItems.saveToNBTList());
|
||||
@@ -168,6 +178,7 @@ public class PlayerCompendiumData implements IExtendedEntityProperties{
|
||||
public void loadNBTData(NBTTagCompound nbt){
|
||||
Stopwatch.time("PlayerCompendiumData - load");
|
||||
NBTTagCompound hee = nbt.getCompoundTag("HEE");
|
||||
seenHelp = hee.getBoolean("hlp");
|
||||
pointAmount = hee.getInteger("kps");
|
||||
discoveredBlocks.loadFromNBTList(hee.getTagList("fndBlocks",NBT.TAG_STRING));
|
||||
discoveredItems.loadFromNBTList(hee.getTagList("fndItems",NBT.TAG_STRING));
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package chylex.hee.packets.server;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import chylex.hee.mechanics.compendium.events.CompendiumEvents;
|
||||
import chylex.hee.packets.AbstractServerPacket;
|
||||
|
||||
public class S05OpenCompendiumHelp extends AbstractServerPacket{
|
||||
public S05OpenCompendiumHelp(){}
|
||||
|
||||
@Override
|
||||
public void write(ByteBuf buffer){}
|
||||
|
||||
@Override
|
||||
public void read(ByteBuf buffer){}
|
||||
|
||||
@Override
|
||||
protected void handle(EntityPlayerMP player){
|
||||
CompendiumEvents.getPlayerData(player).setSeenHelp();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package chylex.hee.render.tileentity;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.Random;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
@@ -9,8 +8,8 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.RenderEndPortal;
|
||||
import net.minecraft.tileentity.TileEntityEndPortal;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
// TODO remove in 1.8 which has my fix applied
|
||||
public class RenderTileEndPortalFixed extends RenderEndPortal{
|
||||
private static final ResourceLocation texPortalBackground = new ResourceLocation("textures/environment/end_sky.png");
|
||||
private static final ResourceLocation texPortalLayers = new ResourceLocation("textures/entity/end_portal.png");
|
||||
|
||||
@@ -16,6 +16,9 @@ import chylex.hee.item.ItemSpecialEffects;
|
||||
import chylex.hee.proxy.ModCommonProxy;
|
||||
|
||||
public final class AchievementManager{
|
||||
public static final String achievementScreenName = "HEE Achievements";
|
||||
public static final String challengeScreenName = "HEE Challenges";
|
||||
|
||||
private static List<Achievement> achievements = new ArrayList<>();
|
||||
private static List<Achievement> challenges = new ArrayList<>();
|
||||
public static Map<String,String> challengeStrings = new HashMap<>();
|
||||
@@ -39,8 +42,8 @@ public final class AchievementManager{
|
||||
CHALLENGE_NOENDERMAN = addChallenge(2, "noEnderman", "mediumorhard");
|
||||
|
||||
public static void register(){
|
||||
AchievementPage.registerAchievementPage(new AchievementPage("HEE Achievements",achievements.toArray(new Achievement[achievements.size()])));
|
||||
AchievementPage.registerAchievementPage(new AchievementPage("HEE Challenges",challenges.toArray(new Achievement[challenges.size()])));
|
||||
AchievementPage.registerAchievementPage(new AchievementPage(achievementScreenName,achievements.toArray(new Achievement[achievements.size()])));
|
||||
AchievementPage.registerAchievementPage(new AchievementPage(challengeScreenName,challenges.toArray(new Achievement[challenges.size()])));
|
||||
}
|
||||
|
||||
private static Achievement addAchievement(int id, String stringId, int x, int y, Block block, int metadata, Achievement parentAchievement){
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package chylex.hee.system.collections;
|
||||
import gnu.trove.map.hash.TObjectIntHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Random;
|
||||
import chylex.hee.system.collections.weight.IWeightProvider;
|
||||
import chylex.hee.system.collections.weight.ObjectWeightPair;
|
||||
import chylex.hee.system.commands.HeeDebugCommand.HeeTest;
|
||||
|
||||
public class WeightedList<T extends IWeightProvider> extends ArrayList<T>{
|
||||
private static final long serialVersionUID = -382485527777212023L;
|
||||
@@ -56,7 +59,7 @@ public class WeightedList<T extends IWeightProvider> extends ArrayList<T>{
|
||||
for(T obj:this)totalWeight += obj.getWeight();
|
||||
}
|
||||
|
||||
public T getRandomItem(Random rand){ // TODO check
|
||||
public T getRandomItem(Random rand){
|
||||
if (totalWeight == 0)return null;
|
||||
int i = rand.nextInt(totalWeight);
|
||||
|
||||
@@ -67,4 +70,22 @@ public class WeightedList<T extends IWeightProvider> extends ArrayList<T>{
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static final HeeTest $debugTest = new HeeTest(){
|
||||
@Override
|
||||
public void run(String...args){
|
||||
WeightedList<ObjectWeightPair<String>> list = new WeightedList<>();
|
||||
list.add(ObjectWeightPair.of("A",50));
|
||||
list.add(ObjectWeightPair.of("B",25));
|
||||
list.add(ObjectWeightPair.of("C",10));
|
||||
list.add(ObjectWeightPair.of("D",5));
|
||||
list.add(ObjectWeightPair.of("E",5));
|
||||
list.add(ObjectWeightPair.of("F",1));
|
||||
|
||||
TObjectIntHashMap<String> freq = new TObjectIntHashMap<>();
|
||||
for(int a = 0; a < 5000; a++)freq.adjustOrPutValue(list.getRandomItem(world.rand).getObject(),1,1);
|
||||
|
||||
for(String key:freq.keySet())System.out.println(key+" ... "+freq.get(key));
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
import chylex.hee.mechanics.misc.TempleEvents;
|
||||
import chylex.hee.system.savedata.WorldSavefile;
|
||||
import chylex.hee.system.util.DragonUtil;
|
||||
|
||||
public class DragonSavefile extends WorldSavefile{
|
||||
private Map<String,ChunkCoordinates> crystals = new HashMap<>();
|
||||
@@ -158,7 +157,7 @@ public class DragonSavefile extends WorldSavefile{
|
||||
NBTTagList tagTemplePlayers = nbt.getTagList("templePlayers",NBT.TAG_STRING);
|
||||
|
||||
for(int a = 0; a < tagTemplePlayers.tagCount(); a++){
|
||||
templePlayers.add(DragonUtil.convertNameToUUID(tagTemplePlayers.getStringTagAt(a)));
|
||||
templePlayers.add(UUID.fromString(tagTemplePlayers.getStringTagAt(a)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import java.util.UUID;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import chylex.hee.system.savedata.WorldSavefile;
|
||||
import chylex.hee.system.util.DragonUtil;
|
||||
|
||||
public class InfestationSavefile extends WorldSavefile{
|
||||
private TObjectIntHashMap<UUID> infestationPower = new TObjectIntHashMap<>();
|
||||
@@ -67,10 +66,10 @@ public class InfestationSavefile extends WorldSavefile{
|
||||
protected void onLoad(NBTTagCompound nbt){
|
||||
for(String key:(Set<String>)nbt.func_150296_c()){
|
||||
if (key.endsWith("_pow")){
|
||||
infestationPower.put(DragonUtil.convertNameToUUID(key.substring(0,key.length()-4)),nbt.getInteger(key));
|
||||
infestationPower.put(UUID.fromString(key.substring(0,key.length()-4)),nbt.getInteger(key));
|
||||
}
|
||||
else if (key.endsWith("_tim")){
|
||||
infestationTimer.put(DragonUtil.convertNameToUUID(key.substring(0,key.length()-4)),nbt.getByte(key));
|
||||
infestationTimer.put(UUID.fromString(key.substring(0,key.length()-4)),nbt.getByte(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import chylex.hee.mechanics.misc.LoreTexts;
|
||||
import chylex.hee.system.savedata.WorldSavefile;
|
||||
import chylex.hee.system.util.DragonUtil;
|
||||
|
||||
public class LoreSavefile extends WorldSavefile{
|
||||
private final Map<UUID,byte[]> unlockedPages = new HashMap<>();
|
||||
@@ -67,6 +66,6 @@ public class LoreSavefile extends WorldSavefile{
|
||||
@Override
|
||||
protected void onLoad(NBTTagCompound nbt){
|
||||
unlockedPages.clear();
|
||||
for(String key:(Set<String>)nbt.func_150296_c())unlockedPages.put(DragonUtil.convertNameToUUID(key),nbt.getByteArray(key));
|
||||
for(String key:(Set<String>)nbt.func_150296_c())unlockedPages.put(UUID.fromString(key),nbt.getByteArray(key));
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ import java.lang.reflect.Array;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -11,7 +10,6 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.management.PreYggdrasilConverter;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import net.minecraft.util.Vec3;
|
||||
@@ -174,10 +172,6 @@ public final class DragonUtil{
|
||||
world.newExplosion(null,x,y,z,strength,fire,world.getGameRules().getGameRuleBooleanValue("mobGriefing"));
|
||||
}
|
||||
|
||||
public static UUID convertNameToUUID(String name){
|
||||
return name.length() == 32 ? UUID.fromString(name) : UUID.fromString(PreYggdrasilConverter.func_152719_a(name));
|
||||
}
|
||||
|
||||
public static String stripChatFormatting(String str){
|
||||
return regexChatFormatting.matcher(str).replaceAll("");
|
||||
}
|
||||
|
||||
@@ -28,8 +28,9 @@ ec.reg.4=Newly discovered object will show up in the bottom right corner of your
|
||||
ec.reg.5=Note that discovering objects also unlocks some of their fragments and gives you points, whereas buying the object does neither.
|
||||
ec.reg.6=Prices of objects and fragments will gradually increase the further you progress.
|
||||
ec.reg.7=Knowledge Notes are items found in dungeons and traded by villagers. Using them gives you Knowledge Points.
|
||||
ec.reg.8=For easier control of the Compendium, you can use the right mouse button instead of the Back button, and mouse wheel to scroll objects and pages.
|
||||
ec.reg.9=Opening the Compendium while looking at a block, item, or a mob opens the appropriate object.
|
||||
ec.reg.8=Important progression points are shown in the Achievements screen.
|
||||
ec.reg.9=For easier control of the Compendium, you can use the right mouse button instead of the Back button, and mouse wheel to scroll objects and pages.
|
||||
ec.reg.17=Opening the Compendium while looking at a block, item, or a mob opens the appropriate object.
|
||||
ec.reg.18=The same happens when you press the Compendium key while hovering over and item in a GUI.
|
||||
ec.reg.19=This behavior works with Not Enough Items too, but you can bypass it by holding CTRL.
|
||||
|
||||
|
||||
Reference in new issue
Block a user