From f613c0097088c384cc57fb3ab86cbc910df6653f Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 9 Feb 2016 18:49:38 -0800 Subject: [PATCH] Change Revealing upgrade to follow other upgrades Obtained the same way as before. --- .../WayofTime/bloodmagic/api/Constants.java | 1 - .../item/armour/ItemLivingArmour.java | 17 ++++---- .../upgrade/LivingArmourUpgradeRevealing.java | 42 +++++++++++++++++++ .../registry/ModArmourTrackers.java | 13 +----- .../bloodmagic/util/handler/EventHandler.java | 7 +++- .../assets/bloodmagic/lang/en_US.lang | 2 +- 6 files changed, 57 insertions(+), 25 deletions(-) create mode 100644 src/main/java/WayofTime/bloodmagic/livingArmour/upgrade/LivingArmourUpgradeRevealing.java diff --git a/src/main/java/WayofTime/bloodmagic/api/Constants.java b/src/main/java/WayofTime/bloodmagic/api/Constants.java index 1663ed9f..8c4e1b33 100644 --- a/src/main/java/WayofTime/bloodmagic/api/Constants.java +++ b/src/main/java/WayofTime/bloodmagic/api/Constants.java @@ -132,7 +132,6 @@ public class Constants public static final String WAILA_CONFIG_RITUAL = Mod.MODID + ".ritualController"; public static final String WAILA_CONFIG_ARRAY = Mod.MODID + ".array"; - public static final String THAUMCRAFT_HAS_GOGGLES = "hasGoggles"; public static final Item THAUMCRAFT_GOGGLES = GameRegistry.findItem("Thaumcraft", "goggles"); } diff --git a/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java b/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java index 3e7ce7cd..69a1f34a 100644 --- a/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java +++ b/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java @@ -188,12 +188,6 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IRevea } } - if (this == ModItems.livingArmourHelmet) - { - if (stack.getTagCompound().getBoolean(Constants.Compat.THAUMCRAFT_HAS_GOGGLES)) - tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.livingArmour.hasGoggles")); - } - super.addInformation(stack, player, tooltip, advanced); } @@ -326,16 +320,19 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IRevea } @Override - public boolean showIngamePopups(ItemStack stack, EntityLivingBase entityLivingBase) - { + public boolean showIngamePopups(ItemStack stack, EntityLivingBase entityLivingBase) { stack = NBTHelper.checkNBT(stack); - return stack != null && stack.getItem() == ModItems.livingArmourHelmet && stack.getTagCompound().getBoolean(Constants.Compat.THAUMCRAFT_HAS_GOGGLES); + LivingArmour armor = getLivingArmour(stack); + + return armor.upgradeMap.containsKey(Constants.Mod.MODID + ".upgrade.revealing") && LivingArmour.hasFullSet((EntityPlayer) entityLivingBase); } @Override public boolean showNodes(ItemStack stack, EntityLivingBase entityLivingBase) { stack = NBTHelper.checkNBT(stack); - return stack != null && stack.getItem() == ModItems.livingArmourHelmet && stack.getTagCompound().getBoolean(Constants.Compat.THAUMCRAFT_HAS_GOGGLES); + LivingArmour armor = getLivingArmour(stack); + + return armor.upgradeMap.containsKey(Constants.Mod.MODID + ".upgrade.revealing") && LivingArmour.hasFullSet((EntityPlayer) entityLivingBase); } } diff --git a/src/main/java/WayofTime/bloodmagic/livingArmour/upgrade/LivingArmourUpgradeRevealing.java b/src/main/java/WayofTime/bloodmagic/livingArmour/upgrade/LivingArmourUpgradeRevealing.java new file mode 100644 index 00000000..b0e48348 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/livingArmour/upgrade/LivingArmourUpgradeRevealing.java @@ -0,0 +1,42 @@ +package WayofTime.bloodmagic.livingArmour.upgrade; + +import WayofTime.bloodmagic.api.Constants; +import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade; +import net.minecraft.nbt.NBTTagCompound; + +public class LivingArmourUpgradeRevealing extends LivingArmourUpgrade { + + public LivingArmourUpgradeRevealing(int level) { + super(level); + } + + @Override + public String getUniqueIdentifier() { + return Constants.Mod.MODID + ".upgrade.revealing"; + } + + @Override + public String getUnlocalizedName() { + return tooltipBase + "revealing"; + } + + @Override + public int getMaxTier() { + return 1; + } + + @Override + public int getCostOfUpgrade() { + return 5; + } + + @Override + public void writeToNBT(NBTTagCompound tag) { + + } + + @Override + public void readFromNBT(NBTTagCompound tag) { + + } +} diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModArmourTrackers.java b/src/main/java/WayofTime/bloodmagic/registry/ModArmourTrackers.java index 734e425d..a3971dff 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModArmourTrackers.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModArmourTrackers.java @@ -11,17 +11,7 @@ import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerMovement; import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerPhysicalProtect; import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerPoison; import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerSelfSacrifice; -import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeArrowShot; -import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeDigging; -import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeGrimReaperSprint; -import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeHealthboost; -import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeKnockbackResist; -import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeMeleeDamage; -import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradePhysicalProtect; -import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradePoisonResist; -import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSelfSacrifice; -import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSpeed; -import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeStepAssist; +import WayofTime.bloodmagic.livingArmour.upgrade.*; public class ModArmourTrackers { @@ -49,5 +39,6 @@ public class ModArmourTrackers LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeArrowShot(0)); LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeStepAssist(0)); LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeGrimReaperSprint(0)); + LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeRevealing(0)); } } diff --git a/src/main/java/WayofTime/bloodmagic/util/handler/EventHandler.java b/src/main/java/WayofTime/bloodmagic/util/handler/EventHandler.java index 891d050e..0f36532d 100644 --- a/src/main/java/WayofTime/bloodmagic/util/handler/EventHandler.java +++ b/src/main/java/WayofTime/bloodmagic/util/handler/EventHandler.java @@ -3,6 +3,8 @@ package WayofTime.bloodmagic.util.handler; import java.util.List; import java.util.Random; +import WayofTime.bloodmagic.api.livingArmour.LivingArmourHandler; +import WayofTime.bloodmagic.item.ItemUpgradeTome; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; @@ -181,9 +183,10 @@ public class EventHandler { if (event.left.getItem() == ModItems.livingArmourHelmet && event.right.getItem() == Constants.Compat.THAUMCRAFT_GOGGLES && !event.right.isItemDamaged()) { - ItemStack output = event.left.copy(); + ItemStack output = new ItemStack(ModItems.upgradeTome); output = NBTHelper.checkNBT(output); - output.getTagCompound().setBoolean(Constants.Compat.THAUMCRAFT_HAS_GOGGLES, true); + ((ItemUpgradeTome) output.getItem()).setKey(output, Constants.Mod.MODID + ".upgrade.revealing"); + ((ItemUpgradeTome) output.getItem()).setLevel(output, 1); event.cost = 1; event.output = output; diff --git a/src/main/resources/assets/bloodmagic/lang/en_US.lang b/src/main/resources/assets/bloodmagic/lang/en_US.lang index e1f39505..de59a552 100644 --- a/src/main/resources/assets/bloodmagic/lang/en_US.lang +++ b/src/main/resources/assets/bloodmagic/lang/en_US.lang @@ -282,8 +282,8 @@ tooltip.BloodMagic.livingArmour.upgrade.meleeDamage=Fierce Strike tooltip.BloodMagic.livingArmour.upgrade.arrowShot=Trick Shot tooltip.BloodMagic.livingArmour.upgrade.stepAssist=Step Assist tooltip.BloodMagic.livingArmour.upgrade.grimReaper=Grim Reaper's Sprint +tooltip.BloodMagic.livingArmour.upgrade.revealing=Revealing tooltip.BloodMagic.livingArmour.upgrade.level=%s (Level %d) -tooltip.BloodMagic.livingArmour.hasGoggles=&oContains Goggles of Revealing tooltip.BloodMagic.will=Will Quality: %1$,.2f tooltip.BloodMagic.sentientSword.desc=Uses demon will to unleash its full potential.