From 54d04c96fb8915c84e6323b1bd4ee5c68e2c678f Mon Sep 17 00:00:00 2001 From: CrazyPants Date: Mon, 10 Nov 2014 21:04:48 +0800 Subject: [PATCH] Thaumcraft API no longer distributed with EIO. Fixed crash when upgrading helm with goggles of revealing. --- ReleaseNotes.txt | 4 +- .../java/thaumcraft/api/IGoggles.java | 0 .../java/thaumcraft/api/IVisDiscountGear.java | 0 .../java/thaumcraft/api/aspects/Aspect.java | 0 .../java/thaumcraft/api/nodes/IRevealer.java | 0 .../java/thaumcraft/api/package-info.java | 0 .../item/darksteel/AbstractUpgrade.java | 8 +- .../darksteel/DarkSteelRecipeManager.java | 5 +- .../darksteel/GogglesOfRevealingUpgrade.java | 20 +++- .../item/darksteel/ItemDarkSteelArmor.java | 108 +++++------------- 10 files changed, 56 insertions(+), 89 deletions(-) rename src/{main => api}/java/thaumcraft/api/IGoggles.java (100%) rename src/{main => api}/java/thaumcraft/api/IVisDiscountGear.java (100%) rename src/{main => api}/java/thaumcraft/api/aspects/Aspect.java (100%) rename src/{main => api}/java/thaumcraft/api/nodes/IRevealer.java (100%) rename src/{main => api}/java/thaumcraft/api/package-info.java (100%) diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index e389c666..880c684f 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -15,7 +15,8 @@ Changes - Added tool blacklist to prevent broken spawners dropping when using those tools - Allow dark pick to work on glass material blocks such as glowstone (tterrag) - Add comparator support to tanks and capacitor banks (tterrag) -- Ender Rail dependence on Railcraft API removed. RC API no longer distributed EIO +- Railcraft API no longer distributed with EIO +- Thaumcraft API no longer distributed with EIO - Added support for Ender Zoo enchants to Enchanter - #1188 Updated zh_CN.lang (Mrkwtkr) - #1199 Create Korean translation (puyo061) @@ -25,6 +26,7 @@ Bugs - Fix NEI handler for vat showing fire if a recipe only has one item. (tterrag) - Fix spoon upgrade only working on certain blocks (tterrag) - Fixed ore dictionary registration of sand to include red sand +- Fixed crash when upgrading Daek Steel Helm with Goggles of Revealing - #1157 Ender IO and Staff of Traveling not working in Mystcraft Ages - #1184 Dimensional Transceiver forgets connections bug Code Complete - #1191 #1203 Fixed crash with wireless electric light diff --git a/src/main/java/thaumcraft/api/IGoggles.java b/src/api/java/thaumcraft/api/IGoggles.java similarity index 100% rename from src/main/java/thaumcraft/api/IGoggles.java rename to src/api/java/thaumcraft/api/IGoggles.java diff --git a/src/main/java/thaumcraft/api/IVisDiscountGear.java b/src/api/java/thaumcraft/api/IVisDiscountGear.java similarity index 100% rename from src/main/java/thaumcraft/api/IVisDiscountGear.java rename to src/api/java/thaumcraft/api/IVisDiscountGear.java diff --git a/src/main/java/thaumcraft/api/aspects/Aspect.java b/src/api/java/thaumcraft/api/aspects/Aspect.java similarity index 100% rename from src/main/java/thaumcraft/api/aspects/Aspect.java rename to src/api/java/thaumcraft/api/aspects/Aspect.java diff --git a/src/main/java/thaumcraft/api/nodes/IRevealer.java b/src/api/java/thaumcraft/api/nodes/IRevealer.java similarity index 100% rename from src/main/java/thaumcraft/api/nodes/IRevealer.java rename to src/api/java/thaumcraft/api/nodes/IRevealer.java diff --git a/src/main/java/thaumcraft/api/package-info.java b/src/api/java/thaumcraft/api/package-info.java similarity index 100% rename from src/main/java/thaumcraft/api/package-info.java rename to src/api/java/thaumcraft/api/package-info.java diff --git a/src/main/java/crazypants/enderio/item/darksteel/AbstractUpgrade.java b/src/main/java/crazypants/enderio/item/darksteel/AbstractUpgrade.java index 7a197bfc..55e6c2ed 100644 --- a/src/main/java/crazypants/enderio/item/darksteel/AbstractUpgrade.java +++ b/src/main/java/crazypants/enderio/item/darksteel/AbstractUpgrade.java @@ -46,10 +46,10 @@ public abstract class AbstractUpgrade implements IDarkSteelUpgrade { @Override public boolean isUpgradeItem(ItemStack stack) { - if(stack == null || stack.getItem() == null || upgradeItem == null) { + if(stack == null || stack.getItem() == null || getUpgradeItem() == null) { return false; } - return stack.isItemEqual(upgradeItem) && stack.stackSize == upgradeItem.stackSize; + return stack.isItemEqual(getUpgradeItem()) && stack.stackSize == getUpgradeItem().stackSize; } @Override @@ -111,9 +111,9 @@ public abstract class AbstractUpgrade implements IDarkSteelUpgrade { upgradeRoot.setInteger(KEY_LEVEL_COST, levelCost); upgradeRoot.setString(KEY_UNLOC_NAME, getUnlocalizedName()); - if(upgradeItem != null) { + if(getUpgradeItem() != null) { NBTTagCompound itemRoot = new NBTTagCompound(); - upgradeItem.writeToNBT(itemRoot); + getUpgradeItem().writeToNBT(itemRoot); upgradeRoot.setTag(KEY_UPGRADE_ITEM, itemRoot); } diff --git a/src/main/java/crazypants/enderio/item/darksteel/DarkSteelRecipeManager.java b/src/main/java/crazypants/enderio/item/darksteel/DarkSteelRecipeManager.java index fe61d927..fe5294a7 100644 --- a/src/main/java/crazypants/enderio/item/darksteel/DarkSteelRecipeManager.java +++ b/src/main/java/crazypants/enderio/item/darksteel/DarkSteelRecipeManager.java @@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.event.AnvilUpdateEvent; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import crazypants.enderio.EnderIO; import crazypants.enderio.material.Alloy; @@ -40,7 +41,9 @@ public class DarkSteelRecipeManager { upgrades.add(NightVisionUpgrade.INSTANCE); upgrades.add(TravelUpgrade.INSTANCE); upgrades.add(SpoonUpgrade.INSTANCE); - upgrades.add(GogglesOfRevealingUpgrade.INSTANCE); + if(Loader.isModLoaded("Thaumcraft")) { + upgrades.add(GogglesOfRevealingUpgrade.INSTANCE); + } } @SubscribeEvent diff --git a/src/main/java/crazypants/enderio/item/darksteel/GogglesOfRevealingUpgrade.java b/src/main/java/crazypants/enderio/item/darksteel/GogglesOfRevealingUpgrade.java index dcd057ca..4886086b 100644 --- a/src/main/java/crazypants/enderio/item/darksteel/GogglesOfRevealingUpgrade.java +++ b/src/main/java/crazypants/enderio/item/darksteel/GogglesOfRevealingUpgrade.java @@ -1,11 +1,10 @@ package crazypants.enderio.item.darksteel; -import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import cpw.mods.fml.common.registry.GameRegistry; import crazypants.enderio.EnderIO; import crazypants.enderio.config.Config; @@ -65,4 +64,21 @@ public class GogglesOfRevealingUpgrade extends AbstractUpgrade { public void writeUpgradeToNBT(NBTTagCompound upgradeRoot) { } + @Override + public ItemStack getUpgradeItem() { + if(upgradeItem != null) { + return upgradeItem; + } + upgradeItem = getGoggles(); + return upgradeItem; + } + + @Override + public String getUpgradeItemName() { + if(getUpgradeItem() == null) { + return "Goggles of Revealing"; + } + return super.getUpgradeItemName(); + } + } diff --git a/src/main/java/crazypants/enderio/item/darksteel/ItemDarkSteelArmor.java b/src/main/java/crazypants/enderio/item/darksteel/ItemDarkSteelArmor.java index 31e76809..3ffc39b5 100644 --- a/src/main/java/crazypants/enderio/item/darksteel/ItemDarkSteelArmor.java +++ b/src/main/java/crazypants/enderio/item/darksteel/ItemDarkSteelArmor.java @@ -2,11 +2,6 @@ package crazypants.enderio.item.darksteel; import java.util.List; -import thaumcraft.api.IGoggles; -import thaumcraft.api.IVisDiscountGear; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.nodes.IRevealer; - import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -19,8 +14,15 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.ISpecialArmor; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.EnumHelper; +import thaumcraft.api.IGoggles; +import thaumcraft.api.IVisDiscountGear; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.nodes.IRevealer; import cofh.api.energy.IEnergyContainerItem; import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.Optional.Interface; +import cpw.mods.fml.common.Optional.InterfaceList; +import cpw.mods.fml.common.Optional.Method; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -31,7 +33,13 @@ import crazypants.enderio.gui.IAdvancedTooltipProvider; import crazypants.util.ItemUtil; import crazypants.util.Lang; -public class ItemDarkSteelArmor extends ItemArmor implements IEnergyContainerItem, ISpecialArmor, IAdvancedTooltipProvider, IDarkSteelItem, IGoggles, IRevealer, IVisDiscountGear { +@InterfaceList({ + @Interface(iface = "thaumcraft.api.IGoggles", modid = "Thaumcraft"), + @Interface(iface = "thaumcraft.api.IVisDiscountGear", modid = "Thaumcraft"), + @Interface(iface = "thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft") +}) +public class ItemDarkSteelArmor extends ItemArmor implements IEnergyContainerItem, ISpecialArmor, IAdvancedTooltipProvider, IDarkSteelItem, IGoggles, + IRevealer, IVisDiscountGear { public static final ArmorMaterial MATERIAL = EnumHelper.addArmorMaterial("darkSteel", 35, new int[] { 2, 6, 5, 2 }, 15); @@ -124,7 +132,7 @@ public class ItemDarkSteelArmor extends ItemArmor implements IEnergyContainerIte GogglesOfRevealingUpgrade.INSTANCE.writeToItem(is); } } - + par3List.add(is); } @@ -164,7 +172,7 @@ public class ItemDarkSteelArmor extends ItemArmor implements IEnergyContainerIte } if(EnergyUpgrade.itemHasAnyPowerUpgrade(itemstack)) { list.add(EnumChatFormatting.WHITE + Lang.localize("item.darkSteel_armor.tooltip.line1")); - list.add(EnumChatFormatting.WHITE + Lang.localize("item.darkSteel_armor.tooltip.line2")); + list.add(EnumChatFormatting.WHITE + Lang.localize("item.darkSteel_armor.tooltip.line2")); if(itemstack.getItem() == EnderIO.itemDarkSteelBoots) { list.add(EnumChatFormatting.WHITE + Lang.localize("item.darkSteel_boots.tooltip.line1")); list.add(EnumChatFormatting.WHITE + Lang.localize("item.darkSteel_boots.tooltip.line2")); @@ -222,7 +230,7 @@ public class ItemDarkSteelArmor extends ItemArmor implements IEnergyContainerIte } stack.setItemDamage(damage); } - if(eu != null) { + if(eu != null) { eu.writeToItem(stack); } } @@ -253,25 +261,28 @@ public class ItemDarkSteelArmor extends ItemArmor implements IEnergyContainerIte } //Thaumcraft - + @Override + @Method(modid = "Thaumcraft") public boolean showNodes(ItemStack itemstack, EntityLivingBase player) { if(itemstack == null || itemstack.getItem() == null || !gogglesUgradeActive) { - return false; - } + return false; + } return GogglesOfRevealingUpgrade.loadFromItem(itemstack) != null; - + } @Override + @Method(modid = "Thaumcraft") public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player) { if(itemstack == null || itemstack.getItem() == null || !gogglesUgradeActive) { - return false; - } + return false; + } return GogglesOfRevealingUpgrade.loadFromItem(itemstack) != null; } - + @Override + @Method(modid = "Thaumcraft") public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) { if(stack == null || stack.getItem() != EnderIO.itemDarkSteelHelmet) { return 0; @@ -287,69 +298,4 @@ public class ItemDarkSteelArmor extends ItemArmor implements IEnergyContainerIte this.gogglesUgradeActive = gogglesUgradeActive; } - - - - - //Idea from Mekanism - // @ForgeSubscribe - // public void onLivingSpecialSpawn(LivingSpawnEvent event) - // { - // int chance = event.world.rand.nextInt(100); - // int armorType = event.world.rand.nextInt(4); - // - // if(chance < 3) - // { - // if(event.entityLiving instanceof EntityZombie || event.entityLiving instanceof EntitySkeleton) - // { - // int sword = event.world.rand.nextInt(100); - // int helmet = event.world.rand.nextInt(100); - // int chestplate = event.world.rand.nextInt(100); - // int leggings = event.world.rand.nextInt(100); - // int boots = event.world.rand.nextInt(100); - // - // if(armorType == 0) - // { - // if(event.entityLiving instanceof EntityZombie && sword < 50) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(GlowstoneSword)); - // if(helmet < 50) event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(GlowstoneHelmet)); - // if(chestplate < 50) event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(GlowstoneChestplate)); - // if(leggings < 50) event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(GlowstoneLeggings)); - // if(boots < 50) event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(GlowstoneBoots)); - // } - // else if(armorType == 1) - // { - // if(event.entityLiving instanceof EntityZombie && sword < 50) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(LazuliSword)); - // if(helmet < 50) event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(LazuliHelmet)); - // if(chestplate < 50) event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(LazuliChestplate)); - // if(leggings < 50) event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(LazuliLeggings)); - // if(boots < 50) event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(LazuliBoots)); - // } - // else if(armorType == 2) - // { - // if(event.entityLiving instanceof EntityZombie && sword < 50) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(OsmiumSword)); - // if(helmet < 50) event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(OsmiumHelmet)); - // if(chestplate < 50) event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(OsmiumChestplate)); - // if(leggings < 50) event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(OsmiumLeggings)); - // if(boots < 50) event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(OsmiumBoots)); - // } - // else if(armorType == 3) - // { - // if(event.entityLiving instanceof EntityZombie && sword < 50) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(SteelSword)); - // if(helmet < 50) event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(SteelHelmet)); - // if(chestplate < 50) event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(SteelChestplate)); - // if(leggings < 50) event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(SteelLeggings)); - // if(boots < 50) event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(SteelBoots)); - // } - // else if(armorType == 4) - // { - // if(event.entityLiving instanceof EntityZombie && sword < 50) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(BronzeSword)); - // if(helmet < 50) event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(BronzeHelmet)); - // if(chestplate < 50) event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(BronzeChestplate)); - // if(leggings < 50) event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(BronzeLeggings)); - // if(boots < 50) event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(BronzeBoots)); - // } - // } - // } - // } - }