From dd439378fa663a40d7083c0b9e8e63d1f358780b Mon Sep 17 00:00:00 2001 From: cyilin Date: Thu, 17 Nov 2016 20:15:54 +0800 Subject: [PATCH] update to forge1.11-13.19.0.2141 --- .travis.yml | 4 +- build.gradle | 6 +- src/main/java/com/zyin/zyinhud/ZyinHUD.java | 4 +- .../helper/HUDEntityTrackerHelper.java | 5 +- .../com/zyin/zyinhud/mods/AnimalInfo.java | 68 +++++----- .../com/zyin/zyinhud/mods/DurabilityInfo.java | 30 ++--- .../java/com/zyin/zyinhud/mods/EatingAid.java | 4 +- .../com/zyin/zyinhud/mods/HealthMonitor.java | 12 +- .../com/zyin/zyinhud/mods/ItemSelector.java | 35 +++--- .../com/zyin/zyinhud/mods/Miscellaneous.java | 6 +- .../com/zyin/zyinhud/mods/PlayerLocator.java | 10 +- .../java/com/zyin/zyinhud/mods/PotionAid.java | 2 +- .../com/zyin/zyinhud/mods/QuickDeposit.java | 2 +- .../java/com/zyin/zyinhud/mods/TorchAid.java | 2 +- .../com/zyin/zyinhud/mods/WeaponSwapper.java | 21 ++-- .../com/zyin/zyinhud/util/InventoryUtil.java | 118 +++++++++--------- .../zyinhud/lang/{de_DE.lang => de_de.lang} | 0 .../zyinhud/lang/{en_PT.lang => en_pt.lang} | 0 .../zyinhud/lang/{en_US.lang => en_us.lang} | 2 + .../zyinhud/lang/{es_AR.lang => es_ar.lang} | 0 .../zyinhud/lang/{es_ES.lang => es_es.lang} | 0 .../zyinhud/lang/{es_MX.lang => es_mx.lang} | 0 .../zyinhud/lang/{es_UY.lang => es_uy.lang} | 0 .../zyinhud/lang/{es_VE.lang => es_ve.lang} | 0 .../zyinhud/lang/{fr_FR.lang => fr_fr.lang} | 0 .../zyinhud/lang/{id_ID.lang => id_id.lang} | 0 .../zyinhud/lang/{pl_PL.lang => pl_pl.lang} | 0 .../zyinhud/lang/{zh_CN.lang => zh_cn.lang} | 0 .../zyinhud/lang/{zh_TW.lang => zh_tw.lang} | 0 src/main/resources/assets/zyinhud/sounds.json | 36 +++--- .../{lowhealth_AoL.ogg => lowhealth_aol.ogg} | Bin .../{lowhealth_LA.ogg => lowhealth_la.ogg} | Bin .../{lowhealth_LoZ.ogg => lowhealth_loz.ogg} | Bin ...{lowhealth_LttP.ogg => lowhealth_lttp.ogg} | Bin .../{lowhealth_OoT.ogg => lowhealth_oot.ogg} | Bin ...health_Oracle.ogg => lowhealth_oracle.ogg} | Bin src/main/resources/pack.mcmeta | 6 + 37 files changed, 200 insertions(+), 173 deletions(-) rename src/main/resources/assets/zyinhud/lang/{de_DE.lang => de_de.lang} (100%) rename src/main/resources/assets/zyinhud/lang/{en_PT.lang => en_pt.lang} (100%) rename src/main/resources/assets/zyinhud/lang/{en_US.lang => en_us.lang} (99%) rename src/main/resources/assets/zyinhud/lang/{es_AR.lang => es_ar.lang} (100%) rename src/main/resources/assets/zyinhud/lang/{es_ES.lang => es_es.lang} (100%) rename src/main/resources/assets/zyinhud/lang/{es_MX.lang => es_mx.lang} (100%) rename src/main/resources/assets/zyinhud/lang/{es_UY.lang => es_uy.lang} (100%) rename src/main/resources/assets/zyinhud/lang/{es_VE.lang => es_ve.lang} (100%) rename src/main/resources/assets/zyinhud/lang/{fr_FR.lang => fr_fr.lang} (100%) rename src/main/resources/assets/zyinhud/lang/{id_ID.lang => id_id.lang} (100%) rename src/main/resources/assets/zyinhud/lang/{pl_PL.lang => pl_pl.lang} (100%) rename src/main/resources/assets/zyinhud/lang/{zh_CN.lang => zh_cn.lang} (100%) rename src/main/resources/assets/zyinhud/lang/{zh_TW.lang => zh_tw.lang} (100%) rename src/main/resources/assets/zyinhud/sounds/hud/{lowhealth_AoL.ogg => lowhealth_aol.ogg} (100%) rename src/main/resources/assets/zyinhud/sounds/hud/{lowhealth_LA.ogg => lowhealth_la.ogg} (100%) rename src/main/resources/assets/zyinhud/sounds/hud/{lowhealth_LoZ.ogg => lowhealth_loz.ogg} (100%) rename src/main/resources/assets/zyinhud/sounds/hud/{lowhealth_LttP.ogg => lowhealth_lttp.ogg} (100%) rename src/main/resources/assets/zyinhud/sounds/hud/{lowhealth_OoT.ogg => lowhealth_oot.ogg} (100%) rename src/main/resources/assets/zyinhud/sounds/hud/{lowhealth_Oracle.ogg => lowhealth_oracle.ogg} (100%) create mode 100644 src/main/resources/pack.mcmeta diff --git a/.travis.yml b/.travis.yml index 50f54de..3d50bf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,14 +4,14 @@ jdk: before_deploy: - git config --global user.email "builds@travis-ci.com" - git config --global user.name "Travis CI" - - git tag ZyinsHUD-1.10.2-1.5.2.${TRAVIS_BUILD_NUMBER} + - git tag ZyinsHUD-1.11-1.5.3.${TRAVIS_BUILD_NUMBER} - git push -q ${GITHUB_REPO} --tags deploy: provider: releases api_key: secure: HXomfzSScNHsqKBlgV4mLYrEoo/+19lIWoYtnngdq1S3kyKllbDrDGuw8jchpUD5PsFE42KMia6qOKWUXvcBNN6ZFH7WTlr+Tm9JvcmF/y5U1WmXyTTodmJggIG8SqCAt9hlwLapYY+b2X38U0BDDgv7886Kje4EhDr2jP4v9voSHLEJjI+U5SmtkRsehTJ73P3X2L3K12b6MDr/zGZ6QlWoS6gcBqC62Bm4Uyr+XcxSSU/Z1Wgh/qnQRBbz+sFfXWuzJhJig1jqFws7nJFBxDpai6I+5kOrZ0efZMDgR/tQVw6erZ58J4rxozfdCX9a05PFOeX5ddaeNmUqtm3r97+49I4fzZMHoDwX8gXrxO6k5LYixYYIUZfkLV/kvFll8aSL9UBVtEr3geVpicQ7J7lb2NLhNBdf3kmU9KT6XYDvzQjYrNd8F0e39YbW4pAhi7zVjbNbwcSkkxrDkE5vM9gFYX8VoAwHbRISXGBEVowNkokumSvv29QUyp1+Tcvxz5D+jDoo9QvTTHuJ4eWEaKxGlZi61FQQptqvTx2DqV6PiNsl7r/HPpPtjWofWVdYbxfZ8V0uGLI4h7sCg4GU2axKKp84wLXyosQHpEm2KGE61fSLfATLDLmnnfxLo40D21R5lzxTPNdJUyUMzA6+vgRvF709YXeu1cA5TRqekCg= file: - - build/libs/ZyinsHUD-1.10.2-1.5.2.${TRAVIS_BUILD_NUMBER}.jar + - build/libs/ZyinsHUD-1.11-1.5.3.${TRAVIS_BUILD_NUMBER}.jar on: repo: cyilin/zyinhud tags: false diff --git a/build.gradle b/build.gradle index 9ece744..c72b5cf 100644 --- a/build.gradle +++ b/build.gradle @@ -23,9 +23,9 @@ plugins { id "net.minecraftforge.gradle.forge" version "2.0.2" } */ -version = "1.5.2.%s" +version = "1.5.3.%s" group= "com.zyin.zyinhud" // http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = "ZyinsHUD-1.10.2" +archivesBaseName = "ZyinsHUD-1.11" if (System.getenv("TRAVIS_BUILD_NUMBER") != null) { version = String.format(version, System.getenv("TRAVIS_BUILD_NUMBER")) @@ -34,7 +34,7 @@ if (System.getenv("TRAVIS_BUILD_NUMBER") != null) { } minecraft { - version = "1.10.2-12.18.2.2125" + version = "1.11-13.19.0.2141" runDir = "run" // the mappings can be changed at any time, and must be in the following format. diff --git a/src/main/java/com/zyin/zyinhud/ZyinHUD.java b/src/main/java/com/zyin/zyinhud/ZyinHUD.java index 658d4a4..fa4d9f4 100644 --- a/src/main/java/com/zyin/zyinhud/ZyinHUD.java +++ b/src/main/java/com/zyin/zyinhud/ZyinHUD.java @@ -54,7 +54,7 @@ public class ZyinHUD { * * If incrementing the Minecraft version, also update "curseFilenameParser" in AddVersionChecker() */ - public static final String VERSION = "1.5.2.0"; + public static final String VERSION = "1.5.3.0"; /** * The constant MODID. */ @@ -66,7 +66,7 @@ public class ZyinHUD { public static final String updateJSON = "https://raw.githubusercontent.com/cyilin/zyinhud-update/master/update.json"; - public static final String dependencies = "required-after:Forge@[12.18.1.2094,);"; + public static final String dependencies = "required-after:forge@[13.19.0.2141,);"; /** * The constant proxy. diff --git a/src/main/java/com/zyin/zyinhud/helper/HUDEntityTrackerHelper.java b/src/main/java/com/zyin/zyinhud/helper/HUDEntityTrackerHelper.java index 7956400..0fb1293 100644 --- a/src/main/java/com/zyin/zyinhud/helper/HUDEntityTrackerHelper.java +++ b/src/main/java/com/zyin/zyinhud/helper/HUDEntityTrackerHelper.java @@ -7,8 +7,7 @@ import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.Entity; -import net.minecraft.entity.monster.EntitySkeleton; -import net.minecraft.entity.monster.SkeletonType; +import net.minecraft.entity.monster.EntityWitherSkeleton; import net.minecraft.entity.passive.EntityWolf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.Vec3d; @@ -107,7 +106,7 @@ public static void RenderEntityInfo(float partialTickTime) //only track entities that we are tracking (i.e. other players/wolves/witherskeletons) if(!(object instanceof EntityOtherPlayerMP || object instanceof EntityWolf || - (object instanceof EntitySkeleton) && ((EntitySkeleton)object).getSkeletonType() == SkeletonType.WITHER)) + object instanceof EntityWitherSkeleton)) continue; Entity entity = (Entity)object; diff --git a/src/main/java/com/zyin/zyinhud/mods/AnimalInfo.java b/src/main/java/com/zyin/zyinhud/mods/AnimalInfo.java index c0204ac..c366194 100644 --- a/src/main/java/com/zyin/zyinhud/mods/AnimalInfo.java +++ b/src/main/java/com/zyin/zyinhud/mods/AnimalInfo.java @@ -16,7 +16,6 @@ import java.text.DecimalFormat; import java.util.ArrayList; -import java.util.List; /** * Shows information about horses in the F3 menu. @@ -208,26 +207,26 @@ public static void SetNumberOfDecimalsDisplayed(int numDecimals) { public static void RenderOntoDebugMenu() { //if F3 is shown if (AnimalInfo.Enabled && ShowHorseStatsOnF3Menu && mc.gameSettings.showDebugInfo) { - if (mc.thePlayer.isRidingHorse()) { - EntityHorse horse = (EntityHorse) mc.thePlayer.getRidingEntity(); + if (mc.thePlayer.isRidingHorse() || + mc.thePlayer.isRiding() && mc.thePlayer.getRidingEntity() instanceof EntityLlama) { + AbstractHorse horse = (AbstractHorse) mc.thePlayer.getRidingEntity(); String horseSpeedMessage = Localization.get("animalinfo.debug.speed") + " " + GetHorseSpeedText(horse) + " m/s"; String horseJumpMessage = Localization.get("animalinfo.debug.jump") + " " + GetHorseJumpText(horse) + " blocks"; String horseHPMessage = Localization.get("animalinfo.debug.hp") + " " + GetHorseHPText(horse); - String horseColor = Localization.get("animalinfo.debug.color") + " " + GetHorseColoringText(horse); - String horseMarking = Localization.get("animalinfo.debug.markings") + " " + GetHorseMarkingText(horse); - - List list = new ArrayList(5); + ArrayList list = new ArrayList(); list.add(horseSpeedMessage); list.add(horseJumpMessage); list.add(horseHPMessage); - - if (horse.getHorseVariant() != 0) //not a donkey - { + if (horse instanceof EntityLlama) { + String llamaStrength = Localization.get("animalinfo.debug.strength") + " " + GetLlamaStrength((EntityLlama) horse); + list.add(llamaStrength); + } else if (horse instanceof EntityHorse) { + String horseColor = Localization.get("animalinfo.debug.color") + " " + GetHorseColoringText(horse); + String horseMarking = Localization.get("animalinfo.debug.markings") + " " + GetHorseMarkingText(horse); list.add(horseColor); list.add(horseMarking); } - for (int i = 0; i < list.size(); ++i) { String s = (String) list.get(i); @@ -299,17 +298,20 @@ protected static void RenderAnimalOverlay(EntityAgeable animal, float partialTic //a positive value means the horse has bred recently int animalGrowingAge = animal.getGrowingAge(); - ArrayList multilineOverlayArrayList = new ArrayList(4); + ArrayList multilineOverlayArrayList = new ArrayList(); - if (ShowHorseStatsOverlay && animal instanceof EntityHorse) { - EntityHorse horse = (EntityHorse) animal; + if (ShowHorseStatsOverlay && animal instanceof AbstractHorse) { + AbstractHorse horse = (AbstractHorse) animal; multilineOverlayArrayList.add(GetHorseSpeedText(horse) + " " + Localization.get("animalinfo.overlay.speed")); multilineOverlayArrayList.add(GetHorseHPText(horse) + " " + Localization.get("animalinfo.overlay.hp")); multilineOverlayArrayList.add(GetHorseJumpText(horse) + " " + Localization.get("animalinfo.overlay.jump")); + if (animal instanceof EntityLlama) { + multilineOverlayArrayList.add(GetLlamaStrength((EntityLlama) animal) + " " + Localization.get("animalinfo.overlay.strength")); + } - if (animalGrowingAge < 0) - multilineOverlayArrayList.add(GetHorseBabyGrowingAgeAsPercent(horse) + "%"); + //if (animalGrowingAge < 0) + // multilineOverlayArrayList.add(GetHorseBabyGrowingAgeAsPercent(horse) + "%"); } /* Breeding timer info no longer available on client in 1.8 if(ShowBreedingTimers && animal instanceof EntityAgeable) @@ -333,7 +335,7 @@ protected static void RenderAnimalOverlay(EntityAgeable animal, float partialTic !((EntityAnimal) animal).isInLove()) //animal is not currently breeding { //render the overlay icon - if (animal instanceof EntityHorse && ((EntityHorse) animal).isTame()) + if (animal instanceof AbstractHorse && ((AbstractHorse) animal).isTame()) ZyinHUDRenderer.RenderFloatingItemIcon(x, y + animal.height, z, Items.GOLDEN_CARROT, partialTickTime); else if (animal instanceof EntityCow) ZyinHUDRenderer.RenderFloatingItemIcon(x, y + animal.height, z, Items.WHEAT, partialTickTime); @@ -385,7 +387,7 @@ public static String CalculateMessageForInfoLine() { * @param horse * @return */ - private static int GetHorseBabyGrowingAgeAsPercent(EntityHorse horse) { + private static int GetHorseBabyGrowingAgeAsPercent(AbstractHorse horse) { float horseGrowingAge = horse.getHorseSize(); //horse size ranges from 0.5 to 1 return (int) ((horseGrowingAge - 0.5f) * 2.0f * 100f); } @@ -414,7 +416,7 @@ private static String GetTimeUntilBreedAgain(EntityAgeable animal) { * @param horse * @return e.x.:
aqua "13.5"
green "12.5"
white "11.3"
red "7.0" */ - private static String GetHorseSpeedText(EntityHorse horse) { + private static String GetHorseSpeedText(AbstractHorse horse) { double horseSpeed = GetEntityMaxSpeed(horse); String horseSpeedString = decimalFormat.format(horseSpeed); @@ -434,7 +436,7 @@ else if (horseSpeed < badHorseSpeedThreshold) * @param horse * @return e.x.:
aqua "28"
green "26"
white "22"
red "18" */ - private static String GetHorseHPText(EntityHorse horse) { + private static String GetHorseHPText(AbstractHorse horse) { int horseHP = GetEntityMaxHP(horse); String horseHPString = decimalFormat.format(GetEntityMaxHP(horse)); @@ -454,7 +456,7 @@ else if (horseHP < badHorseHPThreshold) * @param horse * @return e.x.:
aqua "15"
green "13"
white "11"
red "9" */ - private static String GetHorseHeartsText(EntityHorse horse) { + private static String GetHorseHeartsText(AbstractHorse horse) { int horseHP = GetEntityMaxHP(horse); int horseHearts = GetEntityMaxHearts(horse); String horseHeartsString = "" + horseHearts; @@ -475,7 +477,7 @@ else if (horseHP < badHorseHPThreshold) * @param horse * @return e.x.:
aqua "5.4"
green "4"
white "3"
red "1.5" */ - private static String GetHorseJumpText(EntityHorse horse) { + private static String GetHorseJumpText(AbstractHorse horse) { double horseJump = GetHorseMaxJump(horse); String horseJumpString = decimalFormat.format(horseJump); @@ -495,8 +497,11 @@ else if (horseJump < badHorseJumpThreshold) * @param horse * @return empty string if there is no coloring (for donkeys) */ - private static String GetHorseColoringText(EntityHorse horse) { - String texture = horse.getVariantTexturePaths()[0]; + private static String GetHorseColoringText(AbstractHorse horse) { + String texture = ""; + if (horse instanceof EntityHorse) { + texture = ((EntityHorse) horse).getVariantTexturePaths()[0]; + } if (texture == null || texture.isEmpty()) return ""; @@ -515,9 +520,11 @@ private static String GetHorseColoringText(EntityHorse horse) { * @param horse * @return empty string if there is no secondary coloring (for donkeys) */ - private static String GetHorseMarkingText(EntityHorse horse) { - String texture = horse.getVariantTexturePaths()[1]; - + private static String GetHorseMarkingText(AbstractHorse horse) { + String texture = ""; + if (horse instanceof EntityHorse) { + texture = ((EntityHorse) horse).getVariantTexturePaths()[1]; + } if (texture == null || texture.isEmpty()) return ""; @@ -535,7 +542,7 @@ private static String GetHorseMarkingText(EntityHorse horse) { * @param horse * @return e.x. 1.2?-5.5? */ - private static double GetHorseMaxJump(EntityHorse horse) { + private static double GetHorseMaxJump(AbstractHorse horse) { //simulate gravity and air resistance to determine the jump height double yVelocity = horse.getHorseJumpStrength(); //horses's jump strength attribute double jumpHeight = 0; @@ -546,6 +553,11 @@ private static double GetHorseMaxJump(EntityHorse horse) { } return jumpHeight; } + + private static int GetLlamaStrength(EntityLlama llama) { + int strength = llama.func_190707_dL(); + return strength; + } /** * Gets an entity's max hit points diff --git a/src/main/java/com/zyin/zyinhud/mods/DurabilityInfo.java b/src/main/java/com/zyin/zyinhud/mods/DurabilityInfo.java index 0903e68..b2b01da 100644 --- a/src/main/java/com/zyin/zyinhud/mods/DurabilityInfo.java +++ b/src/main/java/com/zyin/zyinhud/mods/DurabilityInfo.java @@ -8,11 +8,13 @@ import com.zyin.zyinhud.util.ModCompatibility; import net.minecraft.client.gui.GuiChat; import net.minecraft.item.*; +import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import org.lwjgl.opengl.GL11; import java.util.ArrayList; +import java.util.List; /** * Durability Info checks to see if any equipment (items in the hotbar, and armor) is damaged @@ -444,21 +446,21 @@ protected static void CalculateDurabilityIcons() */ private static void CalculateDurabilityIconsForTools() { - ItemStack[] items = mc.thePlayer.inventory.mainInventory; - ItemStack[] offhanditems = mc.thePlayer.inventory.offHandInventory; + NonNullList items = mc.thePlayer.inventory.mainInventory; + NonNullList offhanditems = mc.thePlayer.inventory.offHandInventory; for (int i = 0; i < 10; i++) { ItemStack itemStack; if (i < 9) { - itemStack = items[i]; + itemStack = items.get(i); }else{ - itemStack = offhanditems[0];//There will be only one item here + itemStack = offhanditems.get(0);//There will be only one item here } - if (itemStack != null) + if (!itemStack.func_190926_b()) { Item item = itemStack.getItem(); if (IsTool(item)) @@ -482,13 +484,13 @@ private static void CalculateDurabilityIconsForTools() */ private static void CalculateDurabilityIconsForArmor() { - ItemStack[] armorStacks = mc.thePlayer.inventory.armorInventory; + NonNullList armorStacks = mc.thePlayer.inventory.armorInventory; //iterate backwards over the armor the user is wearing so the helm is displayed first - for(int i = armorStacks.length-1; i >= 0 ; i--) + for(int i = armorStacks.size()-1; i >= 0 ; i--) { - ItemStack armorStack = armorStacks[i]; - if (armorStack != null) + ItemStack armorStack = armorStacks.get(i); + if (!armorStack.func_190926_b()) { int itemDamage = armorStack.getItemDamage(); int maxDamage = armorStack.getMaxDamage(); @@ -529,13 +531,13 @@ private static void UnequipDamagedArmor() { if(AutoUnequipArmor) { - ItemStack[] itemStacks = mc.thePlayer.inventory.armorInventory; + NonNullList itemStacks = mc.thePlayer.inventory.armorInventory; //iterate over the armor the user is wearing - for(int i = 0; i < itemStacks.length; i++) + for(int i = 0; i < itemStacks.size(); i++) { - ItemStack itemStack = itemStacks[i]; - if (itemStack != null && !(itemStack.getItem() instanceof ItemElytra)) + ItemStack itemStack = itemStacks.get(i); + if (!itemStack.func_190926_b() && !(itemStack.getItem() instanceof ItemElytra)) { int itemDamage = itemStack.getItemDamage(); int maxDamage = itemStack.getMaxDamage(); @@ -563,7 +565,7 @@ private static void UnequipDamagedTool() { ItemStack itemStack = mc.thePlayer.inventory.getCurrentItem(); - if (itemStack != null) + if (!itemStack.func_190926_b()) { Item item = itemStack.getItem(); diff --git a/src/main/java/com/zyin/zyinhud/mods/EatingAid.java b/src/main/java/com/zyin/zyinhud/mods/EatingAid.java index 4c88797..96706e8 100644 --- a/src/main/java/com/zyin/zyinhud/mods/EatingAid.java +++ b/src/main/java/com/zyin/zyinhud/mods/EatingAid.java @@ -387,7 +387,7 @@ public int GetStrongestFoodItemIndexFromInventory() Slot slot = (Slot)inventorySlots.get(i); ItemStack itemStack = slot.getStack(); - if (itemStack == null) + if (itemStack.func_190926_b()) { continue; } @@ -489,7 +489,7 @@ public int GetBestFoodItemIndexFromInventory() Slot slot = (Slot)inventorySlots.get(i); ItemStack itemStack = slot.getStack(); - if (itemStack == null) + if (itemStack.func_190926_b()) { continue; } diff --git a/src/main/java/com/zyin/zyinhud/mods/HealthMonitor.java b/src/main/java/com/zyin/zyinhud/mods/HealthMonitor.java index dec1d06..7931c6c 100644 --- a/src/main/java/com/zyin/zyinhud/mods/HealthMonitor.java +++ b/src/main/java/com/zyin/zyinhud/mods/HealthMonitor.java @@ -45,27 +45,27 @@ public static enum Modes { /** * Oot modes. */ - OOT(Localization.get("healthmonitor.mode.oot"), "lowhealth_OoT"), + OOT(Localization.get("healthmonitor.mode.oot"), "lowhealth_oot"), /** * Lttp modes. */ - LTTP(Localization.get("healthmonitor.mode.lttp"), "lowhealth_LttP"), + LTTP(Localization.get("healthmonitor.mode.lttp"), "lowhealth_lttp"), /** * Oracle modes. */ - ORACLE(Localization.get("healthmonitor.mode.oracle"), "lowhealth_Oracle"), + ORACLE(Localization.get("healthmonitor.mode.oracle"), "lowhealth_oracle"), /** * La modes. */ - LA(Localization.get("healthmonitor.mode.la"), "lowhealth_LA"), + LA(Localization.get("healthmonitor.mode.la"), "lowhealth_la"), /** * Loz modes. */ - LOZ(Localization.get("healthmonitor.mode.loz"), "lowhealth_LoZ"), + LOZ(Localization.get("healthmonitor.mode.loz"), "lowhealth_loz"), /** * Aol modes. */ - AOL(Localization.get("healthmonitor.mode.aol"), "lowhealth_AoL"); + AOL(Localization.get("healthmonitor.mode.aol"), "lowhealth_aol"); private String friendlyName; /** diff --git a/src/main/java/com/zyin/zyinhud/mods/ItemSelector.java b/src/main/java/com/zyin/zyinhud/mods/ItemSelector.java index d7d17c6..f06683f 100644 --- a/src/main/java/com/zyin/zyinhud/mods/ItemSelector.java +++ b/src/main/java/com/zyin/zyinhud/mods/ItemSelector.java @@ -1,11 +1,13 @@ package com.zyin.zyinhud.mods; +import com.zyin.zyinhud.util.ZyinHUDUtil; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; @@ -17,6 +19,8 @@ import com.zyin.zyinhud.util.InventoryUtil; import com.zyin.zyinhud.util.Localization; +import java.util.ArrayList; + /** * Item Selector allows the player to conveniently swap their currently selected * hotbar item with something in their inventory. @@ -170,7 +174,7 @@ public String GetFriendlyName() /** * The Current inventory. */ - protected static ItemStack[] currentInventory = null; + protected static NonNullList currentInventory = null; /** * Scrolls the selector towards the specified direction. This will cause the item selector overlay to show. @@ -181,8 +185,7 @@ public static void Scroll(int direction) { // Bind to current player state currentHotbarSlot = mc.thePlayer.inventory.currentItem; - currentInventory = mc.thePlayer.inventory.mainInventory.clone(); - + currentInventory = mc.thePlayer.inventory.mainInventory; if (!AdjustSlot(direction)) { Done(); @@ -204,7 +207,7 @@ public static void Scroll(int direction) public static void SideButton(int direction) { currentHotbarSlot = mc.thePlayer.inventory.currentItem; - currentInventory = mc.thePlayer.inventory.mainInventory.clone(); + currentInventory = mc.thePlayer.inventory.mainInventory; if (AdjustSlot(direction)) { @@ -226,7 +229,7 @@ private static boolean AdjustSlot(int direction) { if (!mc.isSingleplayer()) { - if (currentInventory[currentHotbarSlot] != null && currentInventory[currentHotbarSlot].isItemEnchanted()) + if (!currentInventory.get(currentHotbarSlot).func_190926_b() && currentInventory.get(currentHotbarSlot).isItemEnchanted()) { ZyinHUDRenderer.DisplayNotification(Localization.get("itemselector.error.enchant")); return false; @@ -251,11 +254,11 @@ private static boolean AdjustSlot(int direction) if (Mode == Modes.SAME_COLUMN && memory % 9 != currentHotbarSlot) continue; - if (currentInventory[memory] == null) + if (currentInventory.get(memory).func_190926_b()) continue; if (!mc.isSingleplayer() - && currentInventory[memory].isItemEnchanted()) + && currentInventory.get(memory).isItemEnchanted()) continue; targetInvSlot = memory; @@ -280,7 +283,7 @@ public static void OnHotkeyPressed() return; currentHotbarSlot = mc.thePlayer.inventory.currentItem; - currentInventory = mc.thePlayer.inventory.mainInventory.clone(); + currentInventory = mc.thePlayer.inventory.mainInventory; isCurrentlyRendering = true; } @@ -325,7 +328,7 @@ public static void RenderOntoHUD(float partialTicks) if(targetInvSlot > -1) { - String labelText = currentInventory[targetInvSlot].getDisplayName(); + String labelText = currentInventory.get(targetInvSlot).getDisplayName(); //String labelText = currentInventory[targetInvSlot].getChatComponent().getFormattedText(); int labelWidth = mc.fontRendererObj.getStringWidth(labelText); mc.fontRendererObj.drawStringWithShadow(labelText, (screenWidth / 2) - (labelWidth / 2), originZ - mc.fontRendererObj.FONT_HEIGHT - 2, 0xFFFFFFFF); @@ -360,11 +363,11 @@ public static void RenderOntoHUD(float partialTicks) //GL11.glDisable(GL11.GL_BLEND); //causes enchanted items to render incorrectly } - ItemStack itemStack = currentInventory[idx + 9]; + ItemStack itemStack = currentInventory.get(idx + 9); - if (itemStack != null) + if (!itemStack.func_190926_b()) { - float anim = itemStack.animationsToGo - partialTicks; + float anim = (int) ZyinHUDUtil.GetFieldByReflection(ItemStack.class, itemStack, "animationsToGo", "field_77992_b") - partialTicks; int dimX = originX + (x * 20) + 3; int dimZ = originZ + (z * 22) + 3; @@ -406,15 +409,15 @@ public static void RenderOntoHUD(float partialTicks) */ private static void SelectItem() { - ItemStack currentStack = mc.thePlayer.inventory.mainInventory[currentHotbarSlot]; - ItemStack targetStack = mc.thePlayer.inventory.mainInventory[targetInvSlot]; + ItemStack currentStack = mc.thePlayer.inventory.mainInventory.get(currentHotbarSlot); + ItemStack targetStack = mc.thePlayer.inventory.mainInventory.get(targetInvSlot); // Check if what was actually selected still exists in player's inventory - if (targetStack != null) + if (!targetStack.func_190926_b()) { if (!mc.isSingleplayer()) { - if ((currentStack != null && currentStack.isItemEnchanted()) + if ((!currentStack.func_190926_b() && currentStack.isItemEnchanted()) || targetStack.isItemEnchanted()) { ZyinHUDRenderer.DisplayNotification(Localization.get("itemselector.error.enchant")); diff --git a/src/main/java/com/zyin/zyinhud/mods/Miscellaneous.java b/src/main/java/com/zyin/zyinhud/mods/Miscellaneous.java index 033241a..42e70cf 100644 --- a/src/main/java/com/zyin/zyinhud/mods/Miscellaneous.java +++ b/src/main/java/com/zyin/zyinhud/mods/Miscellaneous.java @@ -91,7 +91,7 @@ public void DrawGuiRepairCounts(GuiRepair guiRepair) { ItemStack rightItemStack = inputSlots.getStackInSlot(1); ItemStack finalItemStack = inputSlots.getStackInSlot(2); - if(leftItemStack != null) + if(!leftItemStack.func_190926_b()) { int timesRepaired = GetTimesRepaired(leftItemStack); String leftItemRepairCost; @@ -103,7 +103,7 @@ public void DrawGuiRepairCounts(GuiRepair guiRepair) { mc.fontRendererObj.drawString(leftItemRepairCost, guiRepairXOrigin + 26, guiRepairYOrigin + 37, 0xffffff); } - if(rightItemStack != null) + if(!rightItemStack.func_190926_b()) { int timesRepaired = GetTimesRepaired(rightItemStack); String rightItemRepairCost; @@ -115,7 +115,7 @@ public void DrawGuiRepairCounts(GuiRepair guiRepair) { mc.fontRendererObj.drawString(rightItemRepairCost, guiRepairXOrigin + 76, guiRepairYOrigin + 37, 0xffffff); } - if(leftItemStack != null && rightItemStack != null) + if(!leftItemStack.func_190926_b() && !rightItemStack.func_190926_b()) { int timesRepaired = GetTimesRepaired(leftItemStack) + GetTimesRepaired(rightItemStack) + 1; String finalItemRepairCost = TextFormatting.DARK_GRAY.toString() + timesRepaired + "/" + maxRepairTimes; diff --git a/src/main/java/com/zyin/zyinhud/mods/PlayerLocator.java b/src/main/java/com/zyin/zyinhud/mods/PlayerLocator.java index 359fc67..212f4a7 100644 --- a/src/main/java/com/zyin/zyinhud/mods/PlayerLocator.java +++ b/src/main/java/com/zyin/zyinhud/mods/PlayerLocator.java @@ -10,7 +10,7 @@ import net.minecraft.entity.item.EntityMinecart; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.monster.EntitySkeleton; -import net.minecraft.entity.monster.SkeletonType; +import net.minecraft.entity.monster.EntityWitherSkeleton; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.EntityPig; import net.minecraft.entity.passive.EntitySheep; @@ -196,7 +196,7 @@ public static void RenderEntityInfoOnHUD(Entity entity, int x, int y) { if (!(entity instanceof EntityOtherPlayerMP || entity instanceof EntityWolf || - (entity instanceof EntitySkeleton) && ((EntitySkeleton) entity).getSkeletonType() == SkeletonType.WITHER)) { + entity instanceof EntityWitherSkeleton)) { return; //we only care about other players and wolves } @@ -249,11 +249,11 @@ public static void RenderEntityInfoOnHUD(Entity entity, int x, int y) { b = (0xFF - b) / 2; rgb = rgb + ((r << 4 * 4) + (g << 4 * 2) + b); //a more white version of the collar color } - } else if (entity instanceof EntitySkeleton && (((EntitySkeleton) entity).getSkeletonType() == SkeletonType.WITHER)) { + } else if (entity instanceof EntityWitherSkeleton) { if (!ShowWitherSkeletons) return; - overlayMessage = GetOverlayMessageForWitherSkeleton((EntitySkeleton) entity, distanceFromMe); + overlayMessage = GetOverlayMessageForWitherSkeleton((EntityWitherSkeleton) entity, distanceFromMe); rgb = 0x555555; alpha = alpha / 6; @@ -342,7 +342,7 @@ private static boolean PlayerIsWolfsOwner(EntityWolf wolf) { } - private static String GetOverlayMessageForWitherSkeleton(EntitySkeleton witherSkeleton, float distanceFromMe) { + private static String GetOverlayMessageForWitherSkeleton(EntityWitherSkeleton witherSkeleton, float distanceFromMe) { //String overlayMessage = "Wither " + witherSkeleton.getCommandSenderEntity().getName(); String overlayMessage = ""; if (witherSkeleton.hasCustomName()) { diff --git a/src/main/java/com/zyin/zyinhud/mods/PotionAid.java b/src/main/java/com/zyin/zyinhud/mods/PotionAid.java index 54f0b33..8aa9d7d 100644 --- a/src/main/java/com/zyin/zyinhud/mods/PotionAid.java +++ b/src/main/java/com/zyin/zyinhud/mods/PotionAid.java @@ -228,7 +228,7 @@ public int GetMostAppropriatePotionItemIndexFromInventory() Slot slot = (Slot)inventorySlots.get(i); ItemStack itemStack = slot.getStack(); - if (itemStack == null) + if (itemStack.func_190926_b()) { continue; } diff --git a/src/main/java/com/zyin/zyinhud/mods/QuickDeposit.java b/src/main/java/com/zyin/zyinhud/mods/QuickDeposit.java index 95cdf0c..6816301 100644 --- a/src/main/java/com/zyin/zyinhud/mods/QuickDeposit.java +++ b/src/main/java/com/zyin/zyinhud/mods/QuickDeposit.java @@ -148,7 +148,7 @@ else if(mc.currentScreen instanceof GuiBrewingStand) */ public static boolean IsAllowedToBeDepositedInContainer(ItemStack itemStack) { - if(itemStack == null) + if(itemStack.func_190926_b()) return false; if((BlacklistTorch && itemStack.getItem() == Item.getItemFromBlock(Blocks.TORCH)) || (BlacklistTools && itemStack.getItem() instanceof ItemTool || itemStack.getItem() instanceof ItemHoe || itemStack.getItem() instanceof ItemShears || ModCompatibility.TConstruct.IsTConstructHarvestTool(itemStack.getItem())) diff --git a/src/main/java/com/zyin/zyinhud/mods/TorchAid.java b/src/main/java/com/zyin/zyinhud/mods/TorchAid.java index 1263e8d..332b031 100644 --- a/src/main/java/com/zyin/zyinhud/mods/TorchAid.java +++ b/src/main/java/com/zyin/zyinhud/mods/TorchAid.java @@ -84,7 +84,7 @@ public void EquipTorchIfToolIsEquipped() if(mc.currentScreen == null && mc.inGameHasFocus) { ItemStack currentItemStack = mc.thePlayer.getHeldItemMainhand(); - if (currentItemStack != null) { + if (!currentItemStack.func_190926_b()) { if(currentItemStack.getItem() instanceof ItemTool || ModCompatibility.TConstruct.IsTConstructToolWithoutARightClickAction(currentItemStack.getItem())) { diff --git a/src/main/java/com/zyin/zyinhud/mods/WeaponSwapper.java b/src/main/java/com/zyin/zyinhud/mods/WeaponSwapper.java index bc12c0c..8c71a67 100644 --- a/src/main/java/com/zyin/zyinhud/mods/WeaponSwapper.java +++ b/src/main/java/com/zyin/zyinhud/mods/WeaponSwapper.java @@ -15,6 +15,7 @@ import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; +import net.minecraft.util.NonNullList; import java.util.ArrayList; import java.util.Collection; @@ -52,7 +53,7 @@ public static void SwapWeapons() ItemStack currentItemStack = mc.thePlayer.getHeldItemMainhand(); //getHeldItem(); Item currentItem = null; - if (currentItemStack != null) + if (!currentItemStack.func_190926_b()) { currentItem = currentItemStack.getItem(); } @@ -118,7 +119,7 @@ else if (meleeWeaponSlot < 0 && rangedWeaponSlot >= 0) */ protected static int GetMostDamagingWeaponSlot(int minInventoryIndex, int maxInventoryIndex) { - ItemStack[] items = mc.thePlayer.inventory.mainInventory; + NonNullList items = mc.thePlayer.inventory.mainInventory; double highestWeaponDamage = -1; double highestAttackSpeed = -1; int highestWeaponDamageSlot = -1; @@ -128,9 +129,9 @@ protected static int GetMostDamagingWeaponSlot(int minInventoryIndex, int maxInv for (int i = minInventoryIndex; i <= maxInventoryIndex; i++) { - ItemStack itemStack = items[i]; + ItemStack itemStack = items.get(i); - if (itemStack != null) + if (!itemStack.func_190926_b()) { if (itemStack.getItem() instanceof ItemSword) { double swordDamage = GetItemWeaponDamage(itemStack); @@ -278,13 +279,13 @@ protected static void SelectHotbarSlot(int slot) */ protected static int GetItemSlot(List itemClasses, int minInventoryIndex, int maxInventoryIndex) { - ItemStack[] items = mc.thePlayer.inventory.mainInventory; + NonNullList items = mc.thePlayer.inventory.mainInventory; for (int i = minInventoryIndex; i <= maxInventoryIndex; i++) { - ItemStack itemStack = items[i]; + ItemStack itemStack = items.get(i); - if (itemStack != null) + if (!itemStack.func_190926_b()) { Item item = itemStack.getItem(); @@ -357,13 +358,13 @@ public static double GetBowDamage(ItemStack item) { } public static int GetBowSlotFromHotbar(List itemClasses) { - ItemStack[] items = mc.thePlayer.inventory.mainInventory; + NonNullList items = mc.thePlayer.inventory.mainInventory; double highestDamage = -1; int slot = -1; for (int i = 0; i <= 8; i++) { - ItemStack itemStack = items[i]; + ItemStack itemStack = items.get(i); - if (itemStack != null) { + if (!itemStack.func_190926_b()) { Item item = itemStack.getItem(); for (Class itemClass : itemClasses) { diff --git a/src/main/java/com/zyin/zyinhud/util/InventoryUtil.java b/src/main/java/com/zyin/zyinhud/util/InventoryUtil.java index 59932bd..4c4aaf3 100644 --- a/src/main/java/com/zyin/zyinhud/util/InventoryUtil.java +++ b/src/main/java/com/zyin/zyinhud/util/InventoryUtil.java @@ -214,7 +214,7 @@ public static boolean UseItemInInventory(Object object, int itemSlotIndex) { public static boolean SendUseItem() { //Items need to use the sendUseItem() function to work properly (only works for instant-use items, NOT something like food!) boolean sendUseItem = false;//mc.playerController.sendUseItem((EntityPlayer) mc.thePlayer, (World) mc.theWorld, mc.thePlayer.getHeldItemMainhand()); - EnumActionResult sendUseItem_result = mc.playerController.processRightClick(mc.thePlayer, mc.theWorld, mc.thePlayer.getHeldItem(EnumHand.MAIN_HAND), EnumHand.MAIN_HAND); + EnumActionResult sendUseItem_result = mc.playerController.processRightClick(mc.thePlayer, mc.theWorld, EnumHand.MAIN_HAND); //TODO: More expressions!! if (sendUseItem_result == EnumActionResult.SUCCESS) { sendUseItem = true; @@ -235,7 +235,6 @@ public static boolean SendUseBlock() { //boolean EnumActionResult sendUseBlock_result = mc.playerController.processRightClickBlock(mc.thePlayer, mc.theWorld, - mc.thePlayer.getHeldItemMainhand(), new BlockPos(mc.objectMouseOver.hitVec.xCoord, mc.objectMouseOver.hitVec.yCoord, mc.objectMouseOver.hitVec.zCoord), mc.objectMouseOver.sideHit, mc.objectMouseOver.hitVec, @@ -284,7 +283,7 @@ public static boolean Swap(int srcIndex, int destIndex) { ItemStack handStack = mc.thePlayer.inventory.getItemStack(); - if (handStack != null) { + if (!handStack.func_190926_b()) { int emptyIndex = GetFirstEmptyIndexInInventory(); if (emptyIndex < 0) emptyIndex = 1; //use the crafting area @@ -294,17 +293,17 @@ public static boolean Swap(int srcIndex, int destIndex) { //there are 4 cases we need to handle: //1: src = null, dest = null - if (srcStack == null && destStack == null) { + if (srcStack.func_190926_b() && destStack.func_190926_b()) { return false; } //2: src = null, dest = item - else if (srcStack == null && destStack != null) { + else if (srcStack.func_190926_b() && !destStack.func_190926_b()) { LeftClickInventorySlot(destIndex); LeftClickInventorySlot(srcIndex); return true; } //3: src = item, dest = null - else if (srcStack != null && destStack == null) { + else if (!srcStack.func_190926_b() && destStack.func_190926_b()) { LeftClickInventorySlot(srcIndex); LeftClickInventorySlot(destIndex); return true; @@ -354,7 +353,7 @@ else if (srcStack != null && destStack == null) { public static boolean DepositAllMatchingItemsInContainer(boolean onlyDepositMatchingItems, boolean ignoreItemsInHotbar) { //check to see if the player is holding an item ItemStack handStack = mc.thePlayer.inventory.getItemStack(); - if (handStack != null) { + if (!handStack.func_190926_b()) { int emptyIndex; //if we can't deposit this item being held in the cursor, put it down in our inventory if (!QuickDeposit.IsAllowedToBeDepositedInContainer(handStack)) { @@ -378,7 +377,7 @@ public static boolean DepositAllMatchingItemsInContainer(boolean onlyDepositMatc //keep putting into next available slot until we deposit all the items in this stack handStack = mc.thePlayer.inventory.getItemStack(); - while (handStack != null) { + while (!handStack.func_190926_b()) { emptyIndex = GetFirstEmptyIndexInContainer(handStack); if (emptyIndex < 0) return false; @@ -412,7 +411,7 @@ public static boolean DepositAllMatchingItemsInContainer(boolean onlyDepositMatc for (int i = iStart; i < iEnd; i++) { Slot slot = (Slot) chestSlots.get(i); ItemStack itemStack = slot.getStack(); - if (itemStack != null) { + if (!itemStack.func_190926_b()) { if (onlyDepositMatchingItems) { int itemIndex = GetFirstItemIndexInContainer(itemStack); @@ -482,15 +481,15 @@ public static boolean DepositItemInContainer(int srcIndex, int destIndex) { //there are 4 cases we need to handle: //1: src = null, dest = null - if (srcStack == null && destStack == null) { + if (srcStack.func_190926_b() && destStack.func_190926_b()) { return false; } //2: src = null, dest = item - else if (srcStack == null && destStack != null) { + else if (srcStack.func_190926_b() && !destStack.func_190926_b()) { return false; } //3: src = item, dest = null - else if (srcStack != null && destStack == null) { + else if (!srcStack.func_190926_b() && destStack.func_190926_b()) { LeftClickContainerSlot(srcIndex); LeftClickContainerSlot(destIndex); return true; @@ -507,7 +506,7 @@ else if (srcStack != null && destStack == null) { { //there are 3 cases we need to handle: //1: dest is a full stack - if (destStack.stackSize == destStack.getMaxStackSize()) { + if ((int)ZyinHUDUtil.GetFieldByReflection(ItemStack.class, destStack, "stackSize", "field_77994_a") == destStack.getMaxStackSize()) { //put this in the next available slot int emptyIndex = GetFirstEmptyIndexInContainer(destStack); if (emptyIndex < 0) { @@ -519,7 +518,7 @@ else if (srcStack != null && destStack == null) { //keep putting into next available slot until we deposit all the items in this stack ItemStack handStack = mc.thePlayer.inventory.getItemStack(); - while (handStack != null) { + while (!handStack.func_190926_b()) { emptyIndex = GetFirstEmptyIndexInContainer(destStack); if (emptyIndex < 0) { LeftClickContainerSlot(srcIndex); @@ -533,7 +532,8 @@ else if (srcStack != null && destStack == null) { return true; } //2: if the combined stacks overflow past the stack limit - else if (srcStack.stackSize + destStack.stackSize > destStack.getMaxStackSize()) { + else if ((int) ZyinHUDUtil.GetFieldByReflection(ItemStack.class, srcStack, "stackSize", "field_77994_a") + + (int) ZyinHUDUtil.GetFieldByReflection(ItemStack.class, destStack, "stackSize", "field_77994_a") > destStack.getMaxStackSize()) { int emptyIndex = GetFirstEmptyIndexInContainer(destStack); if (emptyIndex < 0) { LeftClickContainerSlot(destIndex); @@ -546,7 +546,7 @@ else if (srcStack.stackSize + destStack.stackSize > destStack.getMaxStackSize()) //keep putting into next available slot until we deposit all the items in this stack ItemStack handStack = mc.thePlayer.inventory.getItemStack(); - while (handStack != null) { + while (!handStack.func_190926_b()) { emptyIndex = GetFirstEmptyIndexInContainer(destStack); if (emptyIndex < 0) { LeftClickContainerSlot(srcIndex); @@ -606,10 +606,10 @@ public static boolean DepositAllMatchingItemsInMerchant() { //check if we have an item in our cursor ItemStack handStack = mc.thePlayer.inventory.getItemStack(); - if (handStack != null) { - if (buyingItemStack1 != null && handStack.isItemEqual(buyingItemStack1)) { + if (!handStack.func_190926_b()) { + if (!buyingItemStack1.func_190926_b() && handStack.isItemEqual(buyingItemStack1)) { LeftClickContainerSlot(0); - } else if (buyingItemStack2 != null && handStack.isItemEqual(buyingItemStack2)) { + } else if (!buyingItemStack2.func_190926_b() && handStack.isItemEqual(buyingItemStack2)) { LeftClickContainerSlot(1); } } @@ -623,10 +623,10 @@ public static boolean DepositAllMatchingItemsInMerchant() { for (int i = iStart; i < iEnd; i++) { Slot slot = (Slot) merchantSlots.get(i); ItemStack itemStack = slot.getStack(); - if (itemStack != null) { - if (buyingItemStack1 != null && itemStack.isItemEqual(buyingItemStack1)) { + if (!itemStack.func_190926_b()) { + if (!buyingItemStack1.func_190926_b() && itemStack.isItemEqual(buyingItemStack1)) { DepositItemInMerchant(i, 0); - } else if (buyingItemStack2 != null && itemStack.isItemEqual(buyingItemStack2)) { + } else if (!buyingItemStack2.func_190926_b() && itemStack.isItemEqual(buyingItemStack2)) { DepositItemInMerchant(i, 1); } } @@ -646,15 +646,15 @@ private static boolean DepositItemInMerchant(int srcIndex, int destIndex) { //there are 4 cases we need to handle: //1: src = null, dest = null - if (srcStack == null && destStack == null) { + if (srcStack.func_190926_b() && destStack.func_190926_b()) { return false; } //2: src = null, dest = item - else if (srcStack == null && destStack != null) { + else if (srcStack.func_190926_b() && !destStack.func_190926_b()) { return false; } //3: src = item, dest = null - else if (srcStack != null && destStack == null) { + else if (!srcStack.func_190926_b() && destStack.func_190926_b()) { LeftClickContainerSlot(srcIndex); LeftClickContainerSlot(destIndex); return true; @@ -667,7 +667,7 @@ else if (srcStack != null && destStack == null) { LeftClickContainerSlot(destIndex); ItemStack handStack = mc.thePlayer.inventory.getItemStack(); - if (handStack != null) { + if (!handStack.func_190926_b()) { LeftClickContainerSlot(srcIndex); } return true; @@ -704,10 +704,10 @@ public static boolean DepositAllMatchingItemsInFurance() { //check to see if we have an item in our cursor ItemStack handStack = mc.thePlayer.inventory.getItemStack(); - if (handStack != null) { - if (inputStack != null && handStack.isItemEqual(inputStack)) { + if (!handStack.func_190926_b()) { + if (!inputStack.func_190926_b() && handStack.isItemEqual(inputStack)) { LeftClickContainerSlot(0); - } else if (fuelStack != null && handStack.isItemEqual(fuelStack)) { + } else if (!fuelStack.func_190926_b() && handStack.isItemEqual(fuelStack)) { LeftClickContainerSlot(1); } } @@ -719,17 +719,17 @@ public static boolean DepositAllMatchingItemsInFurance() { for (int i = iStart; i < iEnd; i++) { Slot slot = (Slot) furanceSlots.get(i); ItemStack itemStack = slot.getStack(); - if (itemStack != null) { - if (inputStack != null && itemStack.isItemEqual(inputStack)) { + if (!itemStack.func_190926_b()) { + if (!inputStack.func_190926_b() && itemStack.isItemEqual(inputStack)) { DepositItemInFurance(i, 0); - } else if (fuelStack != null && itemStack.isItemEqual(fuelStack)) { + } else if (!fuelStack.func_190926_b() && itemStack.isItemEqual(fuelStack)) { DepositItemInFurance(i, 1); } } } //take the item from the output slot and put it in our inventory - if (outputStack != null) { + if (!outputStack.func_190926_b()) { int openSlot = GetFirstEmptyIndexInContainerInventory(outputStack); if (openSlot > 0) DepositItemInFurance(2, openSlot); //'deposit' it from the output slot into an empty slot in our inventory @@ -751,15 +751,15 @@ private static boolean DepositItemInFurance(int srcIndex, int destIndex) { //there are 4 cases we need to handle: //1: src = null, dest = null - if (srcStack == null && destStack == null) { + if (srcStack.func_190926_b() && destStack.func_190926_b()) { return false; } //2: src = null, dest = item - else if (srcStack == null && destStack != null) { + else if (srcStack.func_190926_b() && !destStack.func_190926_b()) { return false; } //3: src = item, dest = null - else if (srcStack != null && destStack == null) { + else if (!srcStack.func_190926_b() && destStack.func_190926_b()) { LeftClickContainerSlot(srcIndex); LeftClickContainerSlot(destIndex); return true; @@ -772,7 +772,7 @@ else if (srcStack != null && destStack == null) { LeftClickContainerSlot(destIndex); ItemStack handStack = mc.thePlayer.inventory.getItemStack(); - if (handStack != null) { + if (!handStack.func_190926_b()) { LeftClickContainerSlot(srcIndex); do { @@ -782,7 +782,7 @@ else if (srcStack != null && destStack == null) { LeftClickContainerSlot(openSlot); handStack = mc.thePlayer.inventory.getItemStack(); - } while (handStack != null); + } while (!handStack.func_190926_b()); } return true; } @@ -820,8 +820,8 @@ public static boolean DepositAllMatchingItemsInBrewingStand() { //check to see if we have an item in our cursor ItemStack handStack = mc.thePlayer.inventory.getItemStack(); - if (handStack != null) { - if (inputStack != null && handStack.isItemEqual(inputStack)) { + if (!handStack.func_190926_b()) { + if (!inputStack.func_190926_b() && handStack.isItemEqual(inputStack)) { LeftClickContainerSlot(3); } else if (handStack.getItemDamage() == 0 && Items.POTIONITEM == handStack.getItem()) { //if handStack is a "Water Bottle" @@ -846,21 +846,21 @@ public static boolean DepositAllMatchingItemsInBrewingStand() { for (int i = iStart; i < iEnd; i++) { Slot slot = (Slot) brewingStandSlots.get(i); ItemStack itemStack = slot.getStack(); - if (itemStack != null) { - if (inputStack != null && itemStack.isItemEqual(inputStack)) { + if (!itemStack.func_190926_b()) { + if (!inputStack.func_190926_b() && itemStack.isItemEqual(inputStack)) { DepositItemInBrewingStand(i, 3); } else if (itemStack.getItemDamage() == 0 && Items.POTIONITEM == itemStack.getItem()) { //if itemStack is a "Water Bottle" //then deposit the water bottle in an empty output slot - if (outputStack1 == null) { + if (outputStack1.func_190926_b()) { DepositItemInBrewingStand(i, 0); outputStack1 = mc.thePlayer.openContainer.inventorySlots.get(0).getStack(); continue; - } else if (outputStack2 == null) { + } else if (outputStack2.func_190926_b()) { DepositItemInBrewingStand(i, 1); outputStack2 = mc.thePlayer.openContainer.inventorySlots.get(1).getStack(); continue; - } else if (outputStack3 == null) { + } else if (outputStack3.func_190926_b()) { DepositItemInBrewingStand(i, 2); outputStack3 = mc.thePlayer.openContainer.inventorySlots.get(2).getStack(); continue; @@ -884,15 +884,15 @@ private static boolean DepositItemInBrewingStand(int srcIndex, int destIndex) { //there are 4 cases we need to handle: //1: src = null, dest = null - if (srcStack == null && destStack == null) { + if (srcStack.func_190926_b() && destStack.func_190926_b()) { return false; } //2: src = null, dest = item - else if (srcStack == null && destStack != null) { + else if (srcStack.func_190926_b() && !destStack.func_190926_b()) { return false; } //3: src = item, dest = null - else if (srcStack != null && destStack == null) { + else if (!srcStack.func_190926_b() && destStack.func_190926_b()) { LeftClickContainerSlot(srcIndex); LeftClickContainerSlot(destIndex); return true; @@ -905,7 +905,7 @@ else if (srcStack != null && destStack == null) { LeftClickContainerSlot(destIndex); ItemStack handStack = mc.thePlayer.inventory.getItemStack(); - if (handStack != null) { + if (!handStack.func_190926_b()) { LeftClickContainerSlot(srcIndex); } return true; @@ -930,7 +930,7 @@ private static int GetItemIndex(Object object, int iStart, int iEnd) { for (int i = iStart; i <= iEnd; i++) { Slot slot = (Slot) inventorySlots.get(i); ItemStack itemStack = slot.getStack(); - if (itemStack != null) { + if (!itemStack.func_190926_b()) { if (object instanceof BlockPos) { Block blockToFind = ZyinHUDUtil.GetBlock((BlockPos) object); @@ -990,7 +990,7 @@ private static int GetFirstEmptyIndexInInventory() { for (int i = 9; i <= 44; i++) { Slot slot = (Slot) inventorySlots.get(i); ItemStack itemStack = slot.getStack(); - if (itemStack == null) { + if (itemStack.func_190926_b()) { return i; } } @@ -1032,11 +1032,12 @@ private static int GetFirstEmptyIndexInContainerInventory(ItemStack itemStackToM for (int i = iStart; i <= iEnd - 1; i++) { Slot slot = (Slot) containerSlots.get(i); ItemStack itemStack = slot.getStack(); - if (itemStack == null && firstEmptyIndex == -1) { + if (itemStack.func_190926_b() && firstEmptyIndex == -1) { firstEmptyIndex = i; - } else if (itemStack != null && itemStackToMatch != null + } else if (!itemStack.func_190926_b() && itemStackToMatch != null && !itemStackToMatch.func_190926_b() && itemStack.isItemEqual(itemStackToMatch) - && itemStack.stackSize < itemStack.getMaxStackSize() + && (int) ZyinHUDUtil.GetFieldByReflection(ItemStack.class, itemStack, "stackSize", + "field_77994_a") < itemStack.getMaxStackSize() && firstEmptyMatchingItemStackIndex == -1) { firstEmptyMatchingItemStackIndex = i; break; @@ -1086,11 +1087,12 @@ private static int GetFirstEmptyIndexInContainer(ItemStack itemStackToMatch) { for (int i = iStart; i <= iEnd - 1; i++) { Slot slot = (Slot) containerSlots.get(i); ItemStack itemStack = slot.getStack(); - if (itemStack == null && firstEmptyIndex == -1) { + if (itemStack.func_190926_b() && firstEmptyIndex == -1) { firstEmptyIndex = i; - } else if (itemStack != null && itemStackToMatch != null + } else if (!itemStack.func_190926_b() && itemStackToMatch != null && itemStack.isItemEqual(itemStackToMatch) - && itemStack.stackSize < itemStack.getMaxStackSize() + && (int) ZyinHUDUtil.GetFieldByReflection(ItemStack.class, itemStack, "stackSize", + "field_77994_a") < itemStack.getMaxStackSize() && firstEmptyMatchingItemStackIndex == -1) { firstEmptyMatchingItemStackIndex = i; break; @@ -1127,7 +1129,7 @@ private static int GetFirstItemIndexInContainer(ItemStack itemStackToMatch) { for (int i = iStart; i <= iEnd - 1; i++) { Slot slot = (Slot) chestSlots.get(i); ItemStack itemStack = slot.getStack(); - if (itemStack != null && itemStack.isItemEqual(itemStackToMatch)) { + if (!itemStack.func_190926_b() && itemStack.isItemEqual(itemStackToMatch)) { return i; } } diff --git a/src/main/resources/assets/zyinhud/lang/de_DE.lang b/src/main/resources/assets/zyinhud/lang/de_de.lang similarity index 100% rename from src/main/resources/assets/zyinhud/lang/de_DE.lang rename to src/main/resources/assets/zyinhud/lang/de_de.lang diff --git a/src/main/resources/assets/zyinhud/lang/en_PT.lang b/src/main/resources/assets/zyinhud/lang/en_pt.lang similarity index 100% rename from src/main/resources/assets/zyinhud/lang/en_PT.lang rename to src/main/resources/assets/zyinhud/lang/en_pt.lang diff --git a/src/main/resources/assets/zyinhud/lang/en_US.lang b/src/main/resources/assets/zyinhud/lang/en_us.lang similarity index 99% rename from src/main/resources/assets/zyinhud/lang/en_US.lang rename to src/main/resources/assets/zyinhud/lang/en_us.lang index 2cd8a60..eae6fac 100644 --- a/src/main/resources/assets/zyinhud/lang/en_US.lang +++ b/src/main/resources/assets/zyinhud/lang/en_us.lang @@ -37,10 +37,12 @@ animalinfo.overlay.speed=m/s animalinfo.overlay.jump=jump animalinfo.overlay.hp=hp animalinfo.overlay.hearts=hearts +animalinfo.overlay.strength=strength animalinfo.debug.speed=Horse Speed: animalinfo.debug.jump=Horse Jump: animalinfo.debug.hp=Horse HP: animalinfo.debug.color=Horse Color: +animalinfo.debug.strength=Llama Strength: animalinfo.debug.markings=Horse Markings: clock.name=Clock diff --git a/src/main/resources/assets/zyinhud/lang/es_AR.lang b/src/main/resources/assets/zyinhud/lang/es_ar.lang similarity index 100% rename from src/main/resources/assets/zyinhud/lang/es_AR.lang rename to src/main/resources/assets/zyinhud/lang/es_ar.lang diff --git a/src/main/resources/assets/zyinhud/lang/es_ES.lang b/src/main/resources/assets/zyinhud/lang/es_es.lang similarity index 100% rename from src/main/resources/assets/zyinhud/lang/es_ES.lang rename to src/main/resources/assets/zyinhud/lang/es_es.lang diff --git a/src/main/resources/assets/zyinhud/lang/es_MX.lang b/src/main/resources/assets/zyinhud/lang/es_mx.lang similarity index 100% rename from src/main/resources/assets/zyinhud/lang/es_MX.lang rename to src/main/resources/assets/zyinhud/lang/es_mx.lang diff --git a/src/main/resources/assets/zyinhud/lang/es_UY.lang b/src/main/resources/assets/zyinhud/lang/es_uy.lang similarity index 100% rename from src/main/resources/assets/zyinhud/lang/es_UY.lang rename to src/main/resources/assets/zyinhud/lang/es_uy.lang diff --git a/src/main/resources/assets/zyinhud/lang/es_VE.lang b/src/main/resources/assets/zyinhud/lang/es_ve.lang similarity index 100% rename from src/main/resources/assets/zyinhud/lang/es_VE.lang rename to src/main/resources/assets/zyinhud/lang/es_ve.lang diff --git a/src/main/resources/assets/zyinhud/lang/fr_FR.lang b/src/main/resources/assets/zyinhud/lang/fr_fr.lang similarity index 100% rename from src/main/resources/assets/zyinhud/lang/fr_FR.lang rename to src/main/resources/assets/zyinhud/lang/fr_fr.lang diff --git a/src/main/resources/assets/zyinhud/lang/id_ID.lang b/src/main/resources/assets/zyinhud/lang/id_id.lang similarity index 100% rename from src/main/resources/assets/zyinhud/lang/id_ID.lang rename to src/main/resources/assets/zyinhud/lang/id_id.lang diff --git a/src/main/resources/assets/zyinhud/lang/pl_PL.lang b/src/main/resources/assets/zyinhud/lang/pl_pl.lang similarity index 100% rename from src/main/resources/assets/zyinhud/lang/pl_PL.lang rename to src/main/resources/assets/zyinhud/lang/pl_pl.lang diff --git a/src/main/resources/assets/zyinhud/lang/zh_CN.lang b/src/main/resources/assets/zyinhud/lang/zh_cn.lang similarity index 100% rename from src/main/resources/assets/zyinhud/lang/zh_CN.lang rename to src/main/resources/assets/zyinhud/lang/zh_cn.lang diff --git a/src/main/resources/assets/zyinhud/lang/zh_TW.lang b/src/main/resources/assets/zyinhud/lang/zh_tw.lang similarity index 100% rename from src/main/resources/assets/zyinhud/lang/zh_TW.lang rename to src/main/resources/assets/zyinhud/lang/zh_tw.lang diff --git a/src/main/resources/assets/zyinhud/sounds.json b/src/main/resources/assets/zyinhud/sounds.json index 1f37c48..71ec076 100644 --- a/src/main/resources/assets/zyinhud/sounds.json +++ b/src/main/resources/assets/zyinhud/sounds.json @@ -1,74 +1,74 @@ { - "lowhealth_AoL": { + "lowhealth_aol": { "category": "master", "replace": false, "sounds": [ { - "name": "lowhealth_AoL", + "name": "lowhealth_aol", "type": "event", "weight": 6 }, - "zyinhud:hud/lowhealth_AoL" + "zyinhud:hud/lowhealth_aol" ] }, - "lowhealth_LA": { + "lowhealth_la": { "category": "master", "replace": false, "sounds": [ { - "name": "lowhealth_LA", + "name": "lowhealth_la", "type": "event", "weight": 6 }, - "zyinhud:hud/lowhealth_LA" + "zyinhud:hud/lowhealth_la" ] }, - "lowhealth_LoZ": { + "lowhealth_loz": { "category": "master", "replace": false, "sounds": [ { - "name": "lowhealth_LoZ", + "name": "lowhealth_loz", "type": "event", "weight": 6 }, - "zyinhud:hud/lowhealth_LoZ" + "zyinhud:hud/lowhealth_loz" ] }, - "lowhealth_LttP": { + "lowhealth_lttp": { "category": "master", "replace": false, "sounds": [ { - "name": "lowhealth_LttP", + "name": "lowhealth_lttp", "type": "event", "weight": 6 }, - "zyinhud:hud/lowhealth_LttP" + "zyinhud:hud/lowhealth_lttp" ] }, - "lowhealth_OoT": { + "lowhealth_oot": { "category": "master", "replace": false, "sounds": [ { - "name": "lowhealth_OoT", + "name": "lowhealth_oot", "type": "event", "weight": 6 }, - "zyinhud:hud/lowhealth_OoT" + "zyinhud:hud/lowhealth_oot" ] }, - "lowhealth_Oracle": { + "lowhealth_oracle": { "category": "master", "replace": false, "sounds": [ { - "name": "lowhealth_Oracle", + "name": "lowhealth_oracle", "type": "event", "weight": 6 }, - "zyinhud:hud/lowhealth_Oracle" + "zyinhud:hud/lowhealth_oracle" ] } } diff --git a/src/main/resources/assets/zyinhud/sounds/hud/lowhealth_AoL.ogg b/src/main/resources/assets/zyinhud/sounds/hud/lowhealth_aol.ogg similarity index 100% rename from src/main/resources/assets/zyinhud/sounds/hud/lowhealth_AoL.ogg rename to src/main/resources/assets/zyinhud/sounds/hud/lowhealth_aol.ogg diff --git a/src/main/resources/assets/zyinhud/sounds/hud/lowhealth_LA.ogg b/src/main/resources/assets/zyinhud/sounds/hud/lowhealth_la.ogg similarity index 100% rename from src/main/resources/assets/zyinhud/sounds/hud/lowhealth_LA.ogg rename to src/main/resources/assets/zyinhud/sounds/hud/lowhealth_la.ogg diff --git a/src/main/resources/assets/zyinhud/sounds/hud/lowhealth_LoZ.ogg b/src/main/resources/assets/zyinhud/sounds/hud/lowhealth_loz.ogg similarity index 100% rename from src/main/resources/assets/zyinhud/sounds/hud/lowhealth_LoZ.ogg rename to src/main/resources/assets/zyinhud/sounds/hud/lowhealth_loz.ogg diff --git a/src/main/resources/assets/zyinhud/sounds/hud/lowhealth_LttP.ogg b/src/main/resources/assets/zyinhud/sounds/hud/lowhealth_lttp.ogg similarity index 100% rename from src/main/resources/assets/zyinhud/sounds/hud/lowhealth_LttP.ogg rename to src/main/resources/assets/zyinhud/sounds/hud/lowhealth_lttp.ogg diff --git a/src/main/resources/assets/zyinhud/sounds/hud/lowhealth_OoT.ogg b/src/main/resources/assets/zyinhud/sounds/hud/lowhealth_oot.ogg similarity index 100% rename from src/main/resources/assets/zyinhud/sounds/hud/lowhealth_OoT.ogg rename to src/main/resources/assets/zyinhud/sounds/hud/lowhealth_oot.ogg diff --git a/src/main/resources/assets/zyinhud/sounds/hud/lowhealth_Oracle.ogg b/src/main/resources/assets/zyinhud/sounds/hud/lowhealth_oracle.ogg similarity index 100% rename from src/main/resources/assets/zyinhud/sounds/hud/lowhealth_Oracle.ogg rename to src/main/resources/assets/zyinhud/sounds/hud/lowhealth_oracle.ogg diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..13957a6 --- /dev/null +++ b/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "pack_format": 3, + "description": "Zyin's HUD" + } +} \ No newline at end of file