diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
-rw-r--r-- | src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java | 58 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java | 384 |
2 files changed, 214 insertions, 228 deletions
diff --git a/src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java index 9827b0281b..a280f17efb 100644 --- a/src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java +++ b/src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java @@ -29,19 +29,20 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingAttackEvent; -@Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) -public class BaseBauble extends Item implements IBauble{ +@Optional.InterfaceList(value = { @Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), + @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles") }) +public class BaseBauble extends Item implements IBauble { /** * Implementation suggestions taken from Botania. */ - + private BaubleType mThisBauble; private final String mDisplayName; private List<String> damageNegations = new ArrayList<String>(); Multimap<String, AttributeModifier> attributes = HashMultimap.create(); - - public BaseBauble(BaubleType type, String displayName){ + + public BaseBauble(BaubleType type, String displayName) { this.mThisBauble = type; this.mDisplayName = displayName; MinecraftForge.EVENT_BUS.register(this); @@ -50,33 +51,33 @@ public class BaseBauble extends Item implements IBauble{ this.setUnlocalizedName(Utils.sanitizeString(displayName.toLowerCase())); GameRegistry.registerItem(this, getUnlocalizedName()); } - + @Override public String getItemStackDisplayName(final ItemStack tItem) { return this.mDisplayName; } - + @SubscribeEvent public void onPlayerAttacked(LivingAttackEvent event) { - if(event.entityLiving instanceof EntityPlayer) { + if (event.entityLiving instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.entityLiving; - if(getCorrectBauble(player) != null && damageNegations.contains(event.source.damageType)) + if (getCorrectBauble(player) != null && damageNegations.contains(event.source.damageType)) event.setCanceled(true); } } - - public boolean addDamageNegation(DamageSource damageSource){ + + public boolean addDamageNegation(DamageSource damageSource) { return addDamageNegation(damageSource, null); } - - public boolean addDamageNegation(DamageSource damageSource,ItemStack aStack){ + + public boolean addDamageNegation(DamageSource damageSource, ItemStack aStack) { return damageNegations.add(damageSource.damageType); } - - public void clearDamageNegation(){ + + public void clearDamageNegation() { damageNegations.clear(); } - + @Override public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) { return EntityPlayer.class.isInstance(arg1) ? true : false; @@ -91,15 +92,15 @@ public class BaseBauble extends Item implements IBauble{ public BaubleType getBaubleType(ItemStack arg0) { return mThisBauble; } - + public boolean SetBaubleType(BT arg0) { return SetBaubleType(arg0.getType()); } - + public boolean SetBaubleType(BaubleType arg0) { BaubleType temp = this.mThisBauble; this.mThisBauble = arg0; - if (this.mThisBauble != temp){ + if (this.mThisBauble != temp) { return true; } return false; @@ -107,7 +108,7 @@ public class BaseBauble extends Item implements IBauble{ @Override public void onEquipped(ItemStack stack, EntityLivingBase entity) { - if(entity != null && EntityPlayer.class.isInstance(entity)) { + if (entity != null && EntityPlayer.class.isInstance(entity)) { onEquippedOrLoadedIntoWorld(stack, entity); setPlayerHashcode(stack, entity.hashCode()); } @@ -115,12 +116,12 @@ public class BaseBauble extends Item implements IBauble{ @Override public void onWornTick(ItemStack stack, EntityLivingBase player) { - if(getPlayerHashcode(stack) != player.hashCode()) { + if (getPlayerHashcode(stack) != player.hashCode()) { onEquippedOrLoadedIntoWorld(stack, player); setPlayerHashcode(stack, player.hashCode()); } } - + public void onEquippedOrLoadedIntoWorld(ItemStack stack, EntityLivingBase player) { attributes.clear(); fillModifiers(attributes, stack); @@ -134,11 +135,10 @@ public class BaseBauble extends Item implements IBauble{ player.getAttributeMap().removeAttributeModifiers(attributes); } - void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) { - + } - + public ItemStack getCorrectBauble(EntityPlayer player) { InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player); ItemStack stack1 = baubles.getStackInSlot(1); @@ -149,15 +149,15 @@ public class BaseBauble extends Item implements IBauble{ private boolean isCorrectBauble(ItemStack stack) { return stack != null && (stack.getItem() == this); } - + @Override public int getEntityLifespan(ItemStack itemStack, World world) { return Integer.MAX_VALUE; } - + public static UUID getBaubleUUID(ItemStack stack) { long most = NBTUtils.getLong(stack, "baubleUUIDMost"); - if(most == 0) { + if (most == 0) { UUID uuid = UUID.randomUUID(); NBTUtils.setLong(stack, "baubleUUIDMost", uuid.getMostSignificantBits()); NBTUtils.setLong(stack, "baubleUUIDLeast", uuid.getLeastSignificantBits()); @@ -171,7 +171,7 @@ public class BaseBauble extends Item implements IBauble{ public static int getPlayerHashcode(ItemStack stack) { return NBTUtils.getInteger(stack, "mPlayerHashcode"); } - + public static void setPlayerHashcode(ItemStack stack, int hash) { NBTUtils.setInteger(stack, "mPlayerHashcode", hash); } diff --git a/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java b/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java index 00eea9eaeb..2353058ba3 100644 --- a/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java +++ b/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java @@ -9,7 +9,6 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.nbt.ModularArmourUtils; import gtPlusPlus.core.util.nbt.ModularArmourUtils.BT; import gtPlusPlus.core.util.nbt.ModularArmourUtils.Modifiers; @@ -20,14 +19,23 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; -public class ModularBauble extends BaseBauble{ +public class ModularBauble extends BaseBauble { + @SideOnly(Side.CLIENT) + private IIcon mTextureAmulet; + @SideOnly(Side.CLIENT) + private IIcon mTextureRing; + @SideOnly(Side.CLIENT) + private IIcon mTextureBelt; + @SideOnly(Side.CLIENT) + private IIcon iconArray[] = new IIcon[3]; + @SideOnly(Side.CLIENT) + private IIcon mfallback; public ModularBauble() { super(BaubleType.AMULET, "Modular Bauble"); @@ -37,259 +45,248 @@ public class ModularBauble extends BaseBauble{ @Override void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) { - //Get Stats + // Get Stats int mStatlevel = 0; - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DAMAGE)) > 0){ - if (mStatlevel > 0 && mStatlevel < 20){ - attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "AD"+mStatlevel, 1, 0)); - } - else if (mStatlevel > 20 && mStatlevel < 45){ - attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "AD"+mStatlevel, 2, 0)); - } - else if (mStatlevel >= 45 && mStatlevel < 75){ - attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "AD"+mStatlevel, 4, 0)); - } - else if (mStatlevel >= 75 && mStatlevel < 99){ - attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "AD"+mStatlevel, 8, 0)); - } - else if (mStatlevel >= 100){ - attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "AD"+mStatlevel, 16, 0)); + if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DAMAGE)) > 0) { + if (mStatlevel > 0 && mStatlevel < 20) { + attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "AD" + mStatlevel, 1, 0)); + } else if (mStatlevel > 20 && mStatlevel < 45) { + attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "AD" + mStatlevel, 2, 0)); + } else if (mStatlevel >= 45 && mStatlevel < 75) { + attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "AD" + mStatlevel, 4, 0)); + } else if (mStatlevel >= 75 && mStatlevel < 99) { + attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "AD" + mStatlevel, 8, 0)); + } else if (mStatlevel >= 100) { + attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "AD" + mStatlevel, 16, 0)); } } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DEF)) > 0){ - if (mStatlevel > 0 && mStatlevel < 20){ - attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "BD"+mStatlevel, 1, 0)); - } - else if (mStatlevel > 20 && mStatlevel < 45){ - attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "BD"+mStatlevel, 2, 0)); + if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DEF)) > 0) { + if (mStatlevel > 0 && mStatlevel < 20) { + attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "BD" + mStatlevel, 1, 0)); + } else if (mStatlevel > 20 && mStatlevel < 45) { + attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "BD" + mStatlevel, 2, 0)); + } else if (mStatlevel > 45 && mStatlevel < 75) { + attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "BD" + mStatlevel, 3, 0)); + } else if (mStatlevel > 75 && mStatlevel < 99) { + attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "BD" + mStatlevel, 6, 0)); + } else if (mStatlevel >= 100) { + attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "BD" + mStatlevel, 10, 0)); } - else if (mStatlevel > 45 && mStatlevel < 75){ - attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "BD"+mStatlevel, 3, 0)); - } - else if (mStatlevel > 75 && mStatlevel < 99){ - attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "BD"+mStatlevel, 6, 0)); - } - else if (mStatlevel >= 100){ - attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "BD"+mStatlevel, 10, 0)); - } - } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HP)) > 0){ - /*if (mStatlevel > 0 && mStatlevel < 20){ - attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP"+mStatlevel, 15, 0)); - } - else if (mStatlevel > 20 && mStatlevel < 45){ - attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP"+mStatlevel, 20, 0)); - } - else if (mStatlevel > 45 && mStatlevel < 75){ - attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP"+mStatlevel, 25, 0)); - } - else if (mStatlevel > 75 && mStatlevel < 99){ - attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP"+mStatlevel, 30, 0)); - } - else if (mStatlevel >= 100){ - attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP"+mStatlevel, 40, 0)); - }*/ - - if (mStatlevel > 0 && mStatlevel <= 100){ - int bonus = (int) (mStatlevel/5); - attributes.put( - SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), - new AttributeModifier( - getBaubleUUID(stack), - "HP"+mStatlevel, - bonus*2, - 0)); - } - } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_SPEED)) > 0){ - if (mStatlevel > 0 && mStatlevel < 20){ - attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "SP"+mStatlevel, 1, 0)); - } - else if (mStatlevel > 20 && mStatlevel < 45){ - attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "SP"+mStatlevel, 2, 0)); - } - else if (mStatlevel > 45 && mStatlevel < 75){ - attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "SP"+mStatlevel, 3, 0)); - } - else if (mStatlevel > 75 && mStatlevel < 99){ - attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "SP"+mStatlevel, 4, 0)); + if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HP)) > 0) { + if (mStatlevel > 0 && mStatlevel <= 100) { + int bonus = (int) (mStatlevel / 5); + attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "HP" + mStatlevel, bonus * 2, 0)); } - else if (mStatlevel >= 100){ - attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "SP"+mStatlevel, 5, 0)); + } + if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_SPEED)) > 0) { + if (mStatlevel > 0 && mStatlevel < 20) { + attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "SP" + mStatlevel, 1, 0)); + } else if (mStatlevel > 20 && mStatlevel < 45) { + attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "SP" + mStatlevel, 2, 0)); + } else if (mStatlevel > 45 && mStatlevel < 75) { + attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "SP" + mStatlevel, 3, 0)); + } else if (mStatlevel > 75 && mStatlevel < 99) { + attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "SP" + mStatlevel, 4, 0)); + } else if (mStatlevel >= 100) { + attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), + new AttributeModifier(getBaubleUUID(stack), "SP" + mStatlevel, 5, 0)); } } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_MINING)) > 0){ + if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_MINING)) > 0) { } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HOLY)) > 0){ + if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HOLY)) > 0) { } } - @SuppressWarnings({ "unchecked"}) + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { - //Bauble Type - if (ModularArmourUtils.getBaubleType(stack) == BaubleType.AMULET){ - list.add(EnumChatFormatting.GRAY+"Current Form: "+EnumChatFormatting.RED+"Amulet"+EnumChatFormatting.GRAY+"."); - list.add(EnumChatFormatting.GRAY+"You can change this into a Ring or a Belt."); - } - else if (ModularArmourUtils.getBaubleType(stack) == BaubleType.RING){ - list.add(EnumChatFormatting.GRAY+"Current Form: "+EnumChatFormatting.RED+"Ring"+EnumChatFormatting.GRAY+"."); - list.add(EnumChatFormatting.GRAY+"You can change this into an Amulet or a Belt."); - } - else if (ModularArmourUtils.getBaubleType(stack) == BaubleType.BELT){ - list.add(EnumChatFormatting.GRAY+"Current Form: "+EnumChatFormatting.RED+"Belt"+EnumChatFormatting.GRAY+"."); - list.add(EnumChatFormatting.GRAY+"You can change this into a Ring or an Amulet."); + // Bauble Type + if (ModularArmourUtils.getBaubleType(stack) == BaubleType.AMULET) { + list.add(EnumChatFormatting.GRAY + "Current Form: " + EnumChatFormatting.RED + "Amulet" + + EnumChatFormatting.GRAY + "."); + list.add(EnumChatFormatting.GRAY + "You can change this into a Ring or a Belt."); + } else if (ModularArmourUtils.getBaubleType(stack) == BaubleType.RING) { + list.add(EnumChatFormatting.GRAY + "Current Form: " + EnumChatFormatting.RED + "Ring" + + EnumChatFormatting.GRAY + "."); + list.add(EnumChatFormatting.GRAY + "You can change this into an Amulet or a Belt."); + } else if (ModularArmourUtils.getBaubleType(stack) == BaubleType.BELT) { + list.add(EnumChatFormatting.GRAY + "Current Form: " + EnumChatFormatting.RED + "Belt" + + EnumChatFormatting.GRAY + "."); + list.add(EnumChatFormatting.GRAY + "You can change this into a Ring or an Amulet."); } - //Get Stats + // Get Stats int mStatlevel = 0; - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DAMAGE)) > 0){ - list.add(EnumChatFormatting.GRAY+"Damage Boost: "+EnumChatFormatting.DARK_RED+mStatlevel+EnumChatFormatting.GRAY+"/100."); + if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DAMAGE)) > 0) { + list.add(EnumChatFormatting.GRAY + "Damage Boost: " + EnumChatFormatting.DARK_RED + mStatlevel + + EnumChatFormatting.GRAY + "/100."); } - - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HP)) > 0){ - list.add(EnumChatFormatting.GRAY+"Health Boost: "+EnumChatFormatting.RED+mStatlevel+EnumChatFormatting.GRAY+"/100. Bonus "+((int) mStatlevel/5)+" hearts."); + if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HP)) > 0) { + list.add(EnumChatFormatting.GRAY + "Health Boost: " + EnumChatFormatting.RED + mStatlevel + + EnumChatFormatting.GRAY + "/100. Bonus " + ((int) mStatlevel / 5) + " hearts."); } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_SPEED)) > 0){ - list.add(EnumChatFormatting.GRAY+"Speed Boost: "+EnumChatFormatting.WHITE+mStatlevel+EnumChatFormatting.GRAY+"/100."); + if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_SPEED)) > 0) { + list.add(EnumChatFormatting.GRAY + "Speed Boost: " + EnumChatFormatting.WHITE + mStatlevel + + EnumChatFormatting.GRAY + "/100."); } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_MINING)) > 0){ - list.add(EnumChatFormatting.GRAY+"Mining Boost: "+EnumChatFormatting.DARK_GRAY+mStatlevel+EnumChatFormatting.GRAY+"/100."); + if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_MINING)) > 0) { + list.add(EnumChatFormatting.GRAY + "Mining Boost: " + EnumChatFormatting.DARK_GRAY + mStatlevel + + EnumChatFormatting.GRAY + "/100."); } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HOLY)) > 0){ - list.add(EnumChatFormatting.GRAY+"Holy Boost: "+EnumChatFormatting.GOLD+mStatlevel+EnumChatFormatting.GRAY+"/100."); + if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HOLY)) > 0) { + list.add(EnumChatFormatting.GRAY + "Holy Boost: " + EnumChatFormatting.GOLD + mStatlevel + + EnumChatFormatting.GRAY + "/100."); } - //Defence Boost - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DEF)) > 0){ - list.add(EnumChatFormatting.GRAY+"Defence Boost: "+EnumChatFormatting.BLUE+mStatlevel+EnumChatFormatting.GRAY+"/100."); - - if (mStatlevel >= 1){ - list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Cactus"+EnumChatFormatting.GRAY+"."); + // Defence Boost + if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DEF)) > 0) { + list.add(EnumChatFormatting.GRAY + "Defence Boost: " + EnumChatFormatting.BLUE + mStatlevel + + EnumChatFormatting.GRAY + "/100."); + if (mStatlevel >= 1) { + list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Cactus" + + EnumChatFormatting.GRAY + "."); } - if (mStatlevel >= 10){ - list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Falling Blocks"+EnumChatFormatting.GRAY+"."); + if (mStatlevel >= 10) { + list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Falling Blocks" + + EnumChatFormatting.GRAY + "."); } - if (mStatlevel >= 20){ - list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Wall Suffocation"+EnumChatFormatting.GRAY+"."); + if (mStatlevel >= 20) { + list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Wall Suffocation" + + EnumChatFormatting.GRAY + "."); } - if (mStatlevel >= 35){ - list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Drowning"+EnumChatFormatting.GRAY+"."); + if (mStatlevel >= 35) { + list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Drowning" + + EnumChatFormatting.GRAY + "."); } - if (mStatlevel >= 50){ - list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Starvation"+EnumChatFormatting.GRAY+"."); + if (mStatlevel >= 50) { + list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Starvation" + + EnumChatFormatting.GRAY + "."); } - if (mStatlevel >= 60){ - list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Falling"+EnumChatFormatting.GRAY+"."); + if (mStatlevel >= 60) { + list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Falling" + + EnumChatFormatting.GRAY + "."); } - if (mStatlevel >= 75){ - list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Lava"+EnumChatFormatting.GRAY+"."); + if (mStatlevel >= 75) { + list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Lava" + + EnumChatFormatting.GRAY + "."); } - if (mStatlevel >= 80){ - list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Magic"+EnumChatFormatting.GRAY+"."); + if (mStatlevel >= 80) { + list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Magic" + + EnumChatFormatting.GRAY + "."); } - if (mStatlevel >= 95){ - list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Wither"+EnumChatFormatting.GRAY+"."); + if (mStatlevel >= 95) { + list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Wither" + + EnumChatFormatting.GRAY + "."); } - if (mStatlevel >= 100){ - list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Fire"+EnumChatFormatting.GRAY+"."); + if (mStatlevel >= 100) { + list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Fire" + + EnumChatFormatting.GRAY + "."); } - if (mStatlevel >= 100){ - list.add(EnumChatFormatting.GRAY+"Protected From: "+EnumChatFormatting.BLUE+"Void"+EnumChatFormatting.GRAY+"."); + if (mStatlevel >= 100) { + list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Void" + + EnumChatFormatting.GRAY + "."); } - } - - if (NBTUtils.getBotanicaSoulboundOwner(stack) != null){ - if (!NBTUtils.getBotanicaSoulboundOwner(stack).equals("")){ - list.add(EnumChatFormatting.GRAY+"Relic Owner: "+EnumChatFormatting.GREEN+NBTUtils.getBotanicaSoulboundOwner(stack)+EnumChatFormatting.GRAY+"."); + if (NBTUtils.getBotanicaSoulboundOwner(stack) != null) { + if (!NBTUtils.getBotanicaSoulboundOwner(stack).equals("")) { + list.add(EnumChatFormatting.GRAY + "Owner: " + EnumChatFormatting.GREEN + + NBTUtils.getBotanicaSoulboundOwner(stack) + EnumChatFormatting.GRAY + "."); } } - super.addInformation(stack, player, list, bool); } @Override - public boolean addDamageNegation(DamageSource damageSource,ItemStack aStack) { + public boolean addDamageNegation(DamageSource damageSource, ItemStack aStack) { this.clearDamageNegation(); int mStatlevel = 0; - if ((mStatlevel = ModularArmourUtils.getModifierLevel(aStack, Modifiers.BOOST_HOLY)) > 0){ - if (mStatlevel >= 1){ + if ((mStatlevel = ModularArmourUtils.getModifierLevel(aStack, Modifiers.BOOST_HOLY)) > 0) { + if (mStatlevel >= 1) { addDamageNegation(DamageSource.cactus); } - if (mStatlevel >= 10){ + if (mStatlevel >= 10) { addDamageNegation(DamageSource.fallingBlock); } - if (mStatlevel >= 20){ + if (mStatlevel >= 20) { addDamageNegation(DamageSource.inWall); } - if (mStatlevel >= 35){ + if (mStatlevel >= 35) { addDamageNegation(DamageSource.drown); } - if (mStatlevel >= 50){ + if (mStatlevel >= 50) { addDamageNegation(DamageSource.starve); } - if (mStatlevel >= 60){ + if (mStatlevel >= 60) { addDamageNegation(DamageSource.fall); } - if (mStatlevel >= 75){ + if (mStatlevel >= 75) { addDamageNegation(DamageSource.lava); } - if (mStatlevel >= 80){ + if (mStatlevel >= 80) { addDamageNegation(DamageSource.magic); } - if (mStatlevel >= 95){ + if (mStatlevel >= 95) { addDamageNegation(DamageSource.wither); } - if (mStatlevel >= 100){ + if (mStatlevel >= 100) { addDamageNegation(DamageSource.inFire); } - if (mStatlevel >= 100){ + if (mStatlevel >= 100) { addDamageNegation(DamageSource.onFire); } - if (mStatlevel >= 100){ + if (mStatlevel >= 100) { addDamageNegation(DamageSource.outOfWorld); } - } + } return super.addDamageNegation(damageSource, null); } @Override public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) { - if (ModularArmourUtils.getBaubleTypeID(arg0) == BT.TYPE_AMULET.getID()){ + if (ModularArmourUtils.getBaubleTypeID(arg0) == BT.TYPE_AMULET.getID()) { this.SetBaubleType(BT.TYPE_AMULET); - } - else if (ModularArmourUtils.getBaubleTypeID(arg0) == BT.TYPE_RING.getID()){ + } else if (ModularArmourUtils.getBaubleTypeID(arg0) == BT.TYPE_RING.getID()) { this.SetBaubleType(BT.TYPE_RING); - } - else if (ModularArmourUtils.getBaubleTypeID(arg0) == BT.TYPE_BELT.getID()){ + } else if (ModularArmourUtils.getBaubleTypeID(arg0) == BT.TYPE_BELT.getID()) { this.SetBaubleType(BT.TYPE_BELT); - } - else { + } else { this.SetBaubleType(BT.TYPE_RING); } - if (PlayerUtils.isPlayerOP((EntityPlayer) arg1)){ - return true; //Let OPs wear other peoples shit. + if (PlayerUtils.isPlayerOP((EntityPlayer) arg1)) { + return true; // Let OPs wear other peoples shit. } String mOwner; - if (NBTUtils.getBotanicaSoulboundOwner(arg0) == null || NBTUtils.getBotanicaSoulboundOwner(arg0).equals("")){ + if (NBTUtils.getBotanicaSoulboundOwner(arg0) == null || NBTUtils.getBotanicaSoulboundOwner(arg0).equals("")) { return true; - } - else if ((mOwner = NBTUtils.getBotanicaSoulboundOwner(arg0)) != null){ + } else if ((mOwner = NBTUtils.getBotanicaSoulboundOwner(arg0)) != null) { String mPlayerName = arg1.getCommandSenderName(); - if (mOwner.toLowerCase().equals(mPlayerName.toLowerCase())){ + if (mOwner.toLowerCase().equals(mPlayerName.toLowerCase())) { return true; - } - else { + } else { return false; } - } - else { + } else { return false; } } @@ -301,64 +298,54 @@ public class ModularBauble extends BaseBauble{ @Override public void onEquipped(ItemStack stack, EntityLivingBase entity) { - if (entity instanceof EntityPlayer){ - if (NBTUtils.getBotanicaSoulboundOwner(stack) == null || NBTUtils.getBotanicaSoulboundOwner(stack).equals("")){ + if (entity instanceof EntityPlayer) { + if (NBTUtils.getBotanicaSoulboundOwner(stack) == null + || NBTUtils.getBotanicaSoulboundOwner(stack).equals("")) { NBTUtils.setBotanicaSoulboundOwner(stack, entity.getCommandSenderName()); - } + } } super.onEquipped(stack, entity); } - @SideOnly(Side.CLIENT) - private IIcon mTextureAmulet; - @SideOnly(Side.CLIENT) - private IIcon mTextureRing; - @SideOnly(Side.CLIENT) - private IIcon mTextureBelt; - @Override @SideOnly(Side.CLIENT) public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { - if (usingItem == null) { return mfallback; } + if (usingItem == null) { + return mfallback; + } try { - if (ModularArmourUtils.getBaubleType(stack) == BaubleType.AMULET){ + if (ModularArmourUtils.getBaubleType(stack) == BaubleType.AMULET) { return mTextureAmulet; } - if (ModularArmourUtils.getBaubleType(stack) == BaubleType.RING){ + if (ModularArmourUtils.getBaubleType(stack) == BaubleType.RING) { return mTextureRing; } - if (ModularArmourUtils.getBaubleType(stack) == BaubleType.BELT){ + if (ModularArmourUtils.getBaubleType(stack) == BaubleType.BELT) { return mTextureBelt; - } - else { + } else { return mfallback; } - } - catch (Throwable t){ + } catch (Throwable t) { return mfallback; } } - - private IIcon iconArray[] = new IIcon[3]; - private IIcon mfallback; - @Override public IIcon getIconFromDamage(int meta) { - return this.iconArray[meta]; + return this.iconArray[meta]; } - + @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) { this.mfallback = register.registerIcon("baubles" + ":" + "ring"); - // you cannot initialize iconArray when declared nor in the constructor, as it is client-side only, so do it here: - if (LoadedMods.Thaumcraft){ + // you cannot initialize iconArray when declared nor in the constructor, + // as it is client-side only, so do it here: + if (LoadedMods.Thaumcraft) { mTextureAmulet = register.registerIcon("thaumcraft" + ":" + "bauble_amulet"); mTextureRing = register.registerIcon("thaumcraft" + ":" + "bauble_ring"); mTextureBelt = register.registerIcon("thaumcraft" + ":" + "bauble_belt"); - } - else { + } else { mTextureAmulet = register.registerIcon("miscutils" + ":" + "itemAmulet"); mTextureRing = register.registerIcon("miscutils" + ":" + "itemRingWearable"); mTextureBelt = register.registerIcon("miscutils" + ":" + "itemBelt"); @@ -366,11 +353,11 @@ public class ModularBauble extends BaseBauble{ iconArray[0] = mTextureAmulet; iconArray[1] = mTextureRing; iconArray[2] = mTextureBelt; - + } @Override - public void onWornTick(ItemStack stack, EntityLivingBase player) { + public void onWornTick(ItemStack stack, EntityLivingBase player) { super.onWornTick(stack, player); } @@ -379,5 +366,4 @@ public class ModularBauble extends BaseBauble{ return false; } - } |