aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-11-12 00:46:13 +1000
committerAlkalus <draknyte1@hotmail.com>2017-11-12 00:46:13 +1000
commit0e508a2821b8f51910c448a2385f1737a874d894 (patch)
tree5d258fbc9c0a4bb35b33098c01f158256d1b3b1c /src/Java/gtPlusPlus
parentbfc8a3974fc3d6c147d52a91d9c21b501cdce45f (diff)
downloadGT5-Unofficial-0e508a2821b8f51910c448a2385f1737a874d894.tar.gz
GT5-Unofficial-0e508a2821b8f51910c448a2385f1737a874d894.tar.bz2
GT5-Unofficial-0e508a2821b8f51910c448a2385f1737a874d894.zip
% Formatting.
Diffstat (limited to 'src/Java/gtPlusPlus')
-rw-r--r--src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java58
-rw-r--r--src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java384
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java96
-rw-r--r--src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java118
-rw-r--r--src/Java/gtPlusPlus/core/util/nbt/NBTUtils.java18
5 files changed, 317 insertions, 357 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;
}
-
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java
index 15116e8fc1..be2421b307 100644
--- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java
+++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java
@@ -1,7 +1,5 @@
package gtPlusPlus.core.tileentities.machines;
-import static gtPlusPlus.core.tileentities.machines.TileEntityModularityTable.mValidUpgradeListFormChange;
-
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -30,84 +28,72 @@ public class TileEntityModularityTable extends TileEntity {
public InventoryModularOutput inventoryOutputs;
private Container_ModularityTable container;
- public TileEntityModularityTable(){
- Utils.LOG_INFO("I am created.");
- this.inventoryGrid = new InventoryModularMain();//number of slots - without product slot
- this.inventoryOutputs = new InventoryModularOutput();//number of slots - without product slot
+ public TileEntityModularityTable() {
+ this.inventoryGrid = new InventoryModularMain();
+ this.inventoryOutputs = new InventoryModularOutput();
this.canUpdate();
generateAllValidUpgrades();
}
- public void setContainer(Container_ModularityTable container_ModularityTable){
+ public void setContainer(Container_ModularityTable container_ModularityTable) {
this.container = container_ModularityTable;
}
@SuppressWarnings("static-method")
- public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag){
- if(!nbt.hasKey(tag))
- {
+ public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) {
+ if (!nbt.hasKey(tag)) {
nbt.setTag(tag, new NBTTagCompound());
}
return nbt.getCompoundTag(tag);
}
@Override
- public void writeToNBT(final NBTTagCompound nbt){
+ public void writeToNBT(final NBTTagCompound nbt) {
super.writeToNBT(nbt);
this.inventoryOutputs.writeToNBT(this.getTag(nbt, "ContentsOutput"));
}
@Override
- public void readFromNBT(final NBTTagCompound nbt){
+ public void readFromNBT(final NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.inventoryOutputs.readFromNBT(nbt.getCompoundTag("ContentsOutput"));
}
@Override
public void updateEntity() {
- if (!this.worldObj.isRemote){
+ if (!this.worldObj.isRemote) {
boolean removeInputA = false;
boolean removeInputB = false;
- //Data stick
+ // Data stick
ItemStack tBauble = this.inventoryOutputs.getStackInSlot(0);
ItemStack tUpgrade = this.inventoryOutputs.getStackInSlot(1);
- if (tBauble != null && tUpgrade != null && this.container != null){
- if (tBauble.getItem() instanceof ModularBauble){
- if (tUpgrade != null && tBauble != null){
+ if (tBauble != null && tUpgrade != null && this.container != null) {
+ if (tBauble.getItem() instanceof ModularBauble) {
+ if (tUpgrade != null && tBauble != null) {
removeInputA = true;
-
- Utils.LOG_INFO("found "+tUpgrade.getDisplayName());
- try {
+ try {
removeInputB = addUpgrade(tUpgrade, tBauble);
- if (!removeInputB){
- Utils.LOG_INFO("Failed to add "+tUpgrade.getDisplayName());
+ if (!removeInputB) {
}
+ } catch (Throwable t) {
}
- catch (Throwable t){
-
- }
-
- if (removeInputA && removeInputB){
- Utils.LOG_INFO("set new Modular bauble");
- if (this.inventoryOutputs.getStackInSlot(1).stackSize > 1){
+ if (removeInputA && removeInputB) {
+ if (this.inventoryOutputs.getStackInSlot(1).stackSize > 1) {
ItemStack mTempStack = this.inventoryOutputs.getStackInSlot(1);
mTempStack.stackSize--;
this.inventoryOutputs.setInventorySlotContents(1, mTempStack);
- }
- else {
+ } else {
this.inventoryOutputs.setInventorySlotContents(1, null);
-
}
this.inventoryOutputs.setInventorySlotContents(0, null);
this.inventoryOutputs.setInventorySlotContents(2, tBauble);
- }
- else {
- Utils.LOG_INFO("1: "+removeInputA+" | 2: "+removeInputB);
+ } else {
+ Utils.LOG_INFO("1: " + removeInputA + " | 2: " + removeInputB);
}
}
}
- }
+ }
}
super.updateEntity();
}
@@ -120,67 +106,68 @@ public class TileEntityModularityTable extends TileEntity {
public static Map<ItemStack, Pair<Modifiers, Integer>> mValidUpgradeList = new HashMap<ItemStack, Pair<Modifiers, Integer>>();
public static Map<ItemStack, BT> mValidUpgradeListFormChange = new HashMap<ItemStack, BT>();
- private static boolean generateAllValidUpgrades(){
+ private static boolean generateAllValidUpgrades() {
- //Form Change
+ // Form Change
generateUpgradeFormData(ItemList.Sensor_MV.get(1), BT.TYPE_RING);
generateUpgradeFormData(ItemList.Electric_Piston_MV.get(1), BT.TYPE_BELT);
generateUpgradeFormData(ItemList.Emitter_MV.get(1), BT.TYPE_AMULET);
- //Damage Boost
+ // Damage Boost
generateUpgradeData(ItemList.Electric_Motor_LV.get(1), Modifiers.BOOST_DAMAGE, 1);
generateUpgradeData(ItemList.Electric_Motor_MV.get(1), Modifiers.BOOST_DAMAGE, 2);
generateUpgradeData(ItemList.Electric_Motor_HV.get(1), Modifiers.BOOST_DAMAGE, 3);
generateUpgradeData(ItemList.Electric_Motor_EV.get(1), Modifiers.BOOST_DAMAGE, 4);
generateUpgradeData(ItemList.Electric_Motor_IV.get(1), Modifiers.BOOST_DAMAGE, 5);
- //Defence Boost
+ // Defence Boost
generateUpgradeData(Materials.Aluminium.getPlates(1), Modifiers.BOOST_DEF, 1);
generateUpgradeData(Materials.StainlessSteel.getPlates(1), Modifiers.BOOST_DEF, 2);
generateUpgradeData(Materials.Tungsten.getPlates(1), Modifiers.BOOST_DEF, 3);
generateUpgradeData(Materials.TungstenSteel.getPlates(1), Modifiers.BOOST_DEF, 4);
generateUpgradeData(Materials.Naquadah.getPlates(1), Modifiers.BOOST_DEF, 5);
- //Hp Boost
+ // Hp Boost
generateUpgradeData(ItemUtils.simpleMetaStack(Items.golden_apple, 0, 1), Modifiers.BOOST_HP, 1);
generateUpgradeData(ItemUtils.simpleMetaStack(Items.golden_apple, 1, 1), Modifiers.BOOST_HP, 2);
generateUpgradeData(ItemUtils.simpleMetaStack(Items.nether_star, 0, 1), Modifiers.BOOST_HP, 3);
- generateUpgradeData(ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32725", 32725, 1), Modifiers.BOOST_HP, 4);
- generateUpgradeData(ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32726", 32726, 1), Modifiers.BOOST_HP, 5);
+ generateUpgradeData(ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32725", 32725, 1), Modifiers.BOOST_HP,
+ 4);
+ generateUpgradeData(ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32726", 32726, 1), Modifiers.BOOST_HP,
+ 5);
return true;
}
- public static boolean generateUpgradeData(ItemStack tStack, Modifiers tMod, int tLevel){
+ public static boolean generateUpgradeData(ItemStack tStack, Modifiers tMod, int tLevel) {
Pair<Modifiers, Integer> tTemp = new Pair<Modifiers, Integer>(tMod, tLevel);
- if (mValidUpgradeList.put(tStack, tTemp) != null){
+ if (mValidUpgradeList.put(tStack, tTemp) != null) {
return true;
}
return false;
}
- public static boolean generateUpgradeFormData(ItemStack tStack, BT tMod){
- if (mValidUpgradeListFormChange.put(tStack, tMod) != null){
+ public static boolean generateUpgradeFormData(ItemStack tStack, BT tMod) {
+ if (mValidUpgradeListFormChange.put(tStack, tMod) != null) {
return true;
}
return false;
}
- public static boolean addUpgrade(ItemStack tStack, ItemStack tBauble){
+ public static boolean addUpgrade(ItemStack tStack, ItemStack tBauble) {
try {
Iterator<Entry<ItemStack, BT>> it = mValidUpgradeListFormChange.entrySet().iterator();
while (it.hasNext()) {
Entry<ItemStack, BT> pair = it.next();
if (pair.getKey().getItem() == tStack.getItem()
- && pair.getKey().getItemDamage() == tStack.getItemDamage()){
+ && pair.getKey().getItemDamage() == tStack.getItemDamage()) {
ModularArmourUtils.setBaubleType(tBauble, pair.getValue());
tBauble.setItemDamage(ModularArmourUtils.getBaubleTypeID(tBauble));
- //ModularArmourUtils.setBaubleType(tBauble, mValidUpgradeListFormChange.get(tStack).getThis());
return true;
}
}
- } catch (Throwable t){
+ } catch (Throwable t) {
}
try {
@@ -188,19 +175,16 @@ public class TileEntityModularityTable extends TileEntity {
while (it2.hasNext()) {
Entry<ItemStack, Pair<Modifiers, Integer>> pair = it2.next();
if (pair.getKey().getItem() == tStack.getItem()
- && pair.getKey().getItemDamage() == tStack.getItemDamage()){
+ && pair.getKey().getItemDamage() == tStack.getItemDamage()) {
Pair<Modifiers, Integer> newPair = pair.getValue();
int mCurrentLevel = ModularArmourUtils.getModifierLevel(tBauble, newPair);
ModularArmourUtils.setModifierLevel(tBauble, newPair);
return true;
}
}
- } catch (Throwable t){
+ } catch (Throwable t) {
}
- Utils.LOG_INFO("Could not find valid upgrade: "+tStack.getDisplayName()+".");
- //Utils.LOG_INFO("Bool1: "+mValidUpgradeListFormChange.containsKey(tStack));
- //Utils.LOG_INFO("Bool2: "+mValidUpgradeList.containsKey(tStack));
return false;
}
diff --git a/src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java b/src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java
index 72f65c7924..81981bbac5 100644
--- a/src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java
+++ b/src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java
@@ -11,10 +11,10 @@ import net.minecraft.nbt.NBTTagCompound;
public class ModularArmourUtils {
- public static ItemStack addComponent(ItemStack tArmour, ItemStack[] tComponents){
- if (tArmour != null){
+ public static ItemStack addComponent(ItemStack tArmour, ItemStack[] tComponents) {
+ if (tArmour != null) {
ItemStack rArmour = NBTUtils.writeItemsToGtCraftingComponents(tArmour, tComponents, true);
- if (rArmour != null){
+ if (rArmour != null) {
}
}
@@ -22,96 +22,91 @@ public class ModularArmourUtils {
}
public static enum Modifiers {
- BOOST_HP("skill.hpboost"),
- BOOST_DEF("skill.defenceboost"),
- BOOST_SPEED("skill.speedboost"),
- BOOST_MINING("skill.miningboost"),
- BOOST_DAMAGE("skill.damageboost"),
- BOOST_HOLY("skill.holyboost");
+ BOOST_HP("skill.hpboost"), BOOST_DEF("skill.defenceboost"), BOOST_SPEED("skill.speedboost"), BOOST_MINING(
+ "skill.miningboost"), BOOST_DAMAGE("skill.damageboost"), BOOST_HOLY("skill.holyboost");
private String MODIFIER_NAME;
- private Modifiers (final String mModifier){
+
+ private Modifiers(final String mModifier) {
this.MODIFIER_NAME = mModifier;
}
+
public String getModifier() {
return this.MODIFIER_NAME;
- }
- public boolean isValidLevel(int i){
- if (i >= 0 && i <= 100){
+ }
+
+ public boolean isValidLevel(int i) {
+ if (i >= 0 && i <= 100) {
return true;
}
return false;
}
}
-
+
public static enum BT {
- TYPE_AMULET(BaubleType.AMULET, 0),
- TYPE_RING(BaubleType.RING, 1),
- TYPE_BELT(BaubleType.BELT, 2);
+ TYPE_AMULET(BaubleType.AMULET, 0), TYPE_RING(BaubleType.RING, 1), TYPE_BELT(BaubleType.BELT, 2);
private final BaubleType mType;
private final int mID;
private final String mBaubleType;
- private BT (final BaubleType tType, int tID){
+
+ private BT(final BaubleType tType, int tID) {
this.mType = tType;
this.mID = tID;
this.mBaubleType = tType.name().toLowerCase();
}
- public BaubleType getType(){
+
+ public BaubleType getType() {
return this.mType;
}
-
- public BT getThis(){
+
+ public BT getThis() {
return this;
}
-
- public BaubleType getBaubleByID(int tID){
- if (tID == 0){
+
+ public BaubleType getBaubleByID(int tID) {
+ if (tID == 0) {
return BaubleType.AMULET;
- }
- else if (tID == 1){
+ } else if (tID == 1) {
return BaubleType.RING;
- }
- else if (tID == 2){
+ } else if (tID == 2) {
return BaubleType.BELT;
- }
- else {
+ } else {
return BaubleType.RING;
}
}
-
- public int getID(){
+
+ public int getID() {
return this.mID;
}
-
- public String getTypeAsString(){
+
+ public String getTypeAsString() {
return this.mBaubleType;
}
}
-
+
public static void setModifierLevel(ItemStack aStack, Pair<Modifiers, Integer> mPair) {
setModifierLevel(aStack, mPair.getKey(), mPair.getValue().intValue());
}
-
+
public static void setModifierLevel(ItemStack aStack, Modifiers aMod, Integer aInt) {
setModifierLevel(aStack, aMod, aInt.intValue());
}
-
+
public static void setModifierLevel(ItemStack aStack, Modifiers aMod, int aInt) {
-
+
int mCurrentLevel = getModifierLevel(aStack, aMod);
- int mNewTotalLevel = mCurrentLevel+aInt;
-
+ int mNewTotalLevel = mCurrentLevel + aInt;
+
NBTTagCompound tNBT = NBTUtils.getNBT(aStack);
- if (aMod.isValidLevel(mNewTotalLevel)){
+ if (aMod.isValidLevel(mNewTotalLevel)) {
tNBT.setInteger(aMod.getModifier(), mNewTotalLevel);
- GT_Utility.ItemNBT.setNBT(aStack, tNBT);
- }
- else {
- if (getModifierLevel(aStack, aMod) > 100){
- setModifierLevel(aStack, aMod, 100);
+ GT_Utility.ItemNBT.setNBT(aStack, tNBT);
+ } else {
+ if (getModifierLevel(aStack, aMod) > 100) {
+ setModifierLevel(aStack, aMod, 100);
}
}
}
-
+
public static int getModifierLevel(ItemStack aStack, Pair<Modifiers, Integer> newPair) {
return getModifierLevel(aStack, newPair.getKey());
}
@@ -120,13 +115,13 @@ public class ModularArmourUtils {
NBTTagCompound tNBT = NBTUtils.getNBT(aStack);
return tNBT.getInteger(aMod.getModifier());
}
-
+
public static void setBaubleType(ItemStack aStack, BT aMod) {
Utils.LOG_INFO("Changing bauble type.");
NBTTagCompound tNBT = NBTUtils.getNBT(aStack);
- if (aMod != null){
+ if (aMod != null) {
tNBT.setInteger("mBaubleType", aMod.getID());
- GT_Utility.ItemNBT.setNBT(aStack, tNBT);
+ GT_Utility.ItemNBT.setNBT(aStack, tNBT);
}
}
@@ -134,28 +129,25 @@ public class ModularArmourUtils {
NBTTagCompound tNBT = NBTUtils.getNBT(aStack);
return tNBT.getInteger("mBaubleType");
}
-
+
public static BaubleType getBaubleType(ItemStack aStack) {
NBTTagCompound tNBT = NBTUtils.getNBT(aStack);
return getBaubleByID(tNBT.getInteger("mBaubleType"));
}
-
- public static BaubleType getBaubleByID(int tID){
- if (tID == 0){
+
+ public static BaubleType getBaubleByID(int tID) {
+ if (tID == 0) {
return BaubleType.AMULET;
- }
- else if (tID == 1){
+ } else if (tID == 1) {
return BaubleType.RING;
- }
- else if (tID == 2){
+ } else if (tID == 2) {
return BaubleType.BELT;
- }
- else {
+ } else {
return BaubleType.RING;
}
}
-
- public static ItemStack setDefaultStats(ItemStack aStack){
+
+ public static ItemStack setDefaultStats(ItemStack aStack) {
ItemStack tempStack = aStack;
setModifierLevel(tempStack, Modifiers.BOOST_DAMAGE, 0);
setModifierLevel(tempStack, Modifiers.BOOST_DEF, 0);
@@ -165,5 +157,5 @@ public class ModularArmourUtils {
setModifierLevel(tempStack, Modifiers.BOOST_SPEED, 0);
return tempStack;
}
-
+
}
diff --git a/src/Java/gtPlusPlus/core/util/nbt/NBTUtils.java b/src/Java/gtPlusPlus/core/util/nbt/NBTUtils.java
index d2e8ba867f..b023c64c77 100644
--- a/src/Java/gtPlusPlus/core/util/nbt/NBTUtils.java
+++ b/src/Java/gtPlusPlus/core/util/nbt/NBTUtils.java
@@ -162,7 +162,7 @@ public class NBTUtils {
NBTTagCompound tNBT = getNBT(aStack);
return tNBT.getInteger(aTag);
}
-
+
public static void setLong(ItemStack aStack, String aTag, long aInt) {
NBTTagCompound tNBT = getNBT(aStack);
tNBT.setLong(aTag, aInt);
@@ -173,7 +173,7 @@ public class NBTUtils {
NBTTagCompound tNBT = getNBT(aStack);
return tNBT.getLong(aTag);
}
-
+
public static void setFloat(ItemStack aStack, String aTag, float aInt) {
NBTTagCompound tNBT = getNBT(aStack);
tNBT.setFloat(aTag, aInt);
@@ -210,8 +210,9 @@ public class NBTUtils {
Map<?, ?> mInternalMap = ReflectionUtils.getField(aNBT, "tagMap");
if (mInternalMap != null) {
- //mInternalMap.forEach((k, v) -> Utils.LOG_INFO("Key: " + k + ": Value: " + v));
- for(Map.Entry<?,?> e:mInternalMap.entrySet()){
+ // mInternalMap.forEach((k, v) -> Utils.LOG_INFO("Key: "
+ // + k + ": Value: " + v));
+ for (Map.Entry<?, ?> e : mInternalMap.entrySet()) {
Utils.LOG_INFO("Key: " + e.getKey().toString() + " | Value: " + e.getValue().toString());
}
} else {
@@ -230,18 +231,15 @@ public class NBTUtils {
}
}
-
-
- //Botania soulbind handling
+ // Botania soulbind handling
public static boolean setBotanicaSoulboundOwner(ItemStack aStack, String aName) {
final String TAG_SOULBIND = "soulbind";
NBTTagCompound tNBT = getNBT(aStack);
tNBT.setString(TAG_SOULBIND, aName);
GT_Utility.ItemNBT.setNBT(aStack, tNBT);
- if (NBTUtils.doesStringExist(aStack, TAG_SOULBIND)){
+ if (NBTUtils.doesStringExist(aStack, TAG_SOULBIND)) {
return true;
- }
- else {
+ } else {
return false;
}
}