diff options
Diffstat (limited to 'src/main/java/gtPlusPlus/core/item')
-rw-r--r-- | src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java b/src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java index 92468aa6d8..76121ef266 100644 --- a/src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java +++ b/src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java @@ -9,21 +9,16 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import net.minecraftforge.event.entity.living.LivingAttackEvent; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import baubles.api.BaubleType; import baubles.api.IBauble; -import baubles.common.container.InventoryBaubles; -import baubles.common.lib.PlayerHandler; import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gregtech.api.enums.Mods; import gregtech.api.util.GT_LanguageManager; import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.NBTUtils; @Optional.InterfaceList( @@ -41,11 +36,14 @@ public class BaseBauble extends Item implements IBauble { public BaseBauble(BaubleType type) { this.mThisBauble = type; - Utils.registerEvent(this); this.setMaxStackSize(1); this.setCreativeTab(AddToCreativeTab.tabMisc); } + public List<String> getDamageNegations() { + return damageNegations; + } + @Override public String getItemStackDisplayName(final ItemStack tItem) { String key = "gtplusplus." + getUnlocalizedName() + ".name"; @@ -55,14 +53,6 @@ public class BaseBauble extends Item implements IBauble { return GT_LanguageManager.getTranslation(key); } - @SubscribeEvent - public void onPlayerAttacked(LivingAttackEvent event) { - if (event.entityLiving instanceof EntityPlayer player) { - if (getCorrectBauble(player) != null && damageNegations.contains(event.source.damageType)) - event.setCanceled(true); - } - } - @Override public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) { return arg1 instanceof EntityPlayer; @@ -107,17 +97,6 @@ public class BaseBauble extends Item implements IBauble { .removeAttributeModifiers(attributes); } - public ItemStack getCorrectBauble(EntityPlayer player) { - InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player); - ItemStack stack1 = baubles.getStackInSlot(1); - ItemStack stack2 = baubles.getStackInSlot(2); - return isCorrectBauble(stack1) ? stack1 : isCorrectBauble(stack2) ? stack2 : null; - } - - private boolean isCorrectBauble(ItemStack stack) { - return stack != null && (stack.getItem() == this); - } - @Override public int getEntityLifespan(ItemStack itemStack, World world) { return Integer.MAX_VALUE; |