aboutsummaryrefslogtreecommitdiff
path: root/src/Java
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-11-11 23:18:02 +1000
committerAlkalus <draknyte1@hotmail.com>2017-11-11 23:18:02 +1000
commit9a0083c498a8014286fec71683c53b9ec797ee47 (patch)
treeb7098738737d53f6af9da14b4a948975c1e5c1e0 /src/Java
parentb9168d6c0d36a0bc3aa1dab551f2bd2fdda1dc9b (diff)
downloadGT5-Unofficial-9a0083c498a8014286fec71683c53b9ec797ee47.tar.gz
GT5-Unofficial-9a0083c498a8014286fec71683c53b9ec797ee47.tar.bz2
GT5-Unofficial-9a0083c498a8014286fec71683c53b9ec797ee47.zip
$ Fixed HP boost not applying properly.
$ Fixed modifiers not stacking properly.
Diffstat (limited to 'src/Java')
-rw-r--r--src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java19
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java2
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java20
-rw-r--r--src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java12
4 files changed, 41 insertions, 12 deletions
diff --git a/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java b/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java
index ec3d9dca43..f20cfefb5e 100644
--- a/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java
+++ b/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java
@@ -9,6 +9,7 @@ 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;
@@ -72,7 +73,7 @@ public class ModularBauble extends BaseBauble{
}
}
if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HP)) > 0){
- if (mStatlevel > 0 && mStatlevel < 20){
+ /*if (mStatlevel > 0 && mStatlevel < 20){
attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP"+mStatlevel, 15, 0));
}
else if (mStatlevel > 20 && mStatlevel < 45){
@@ -86,7 +87,19 @@ public class ModularBauble extends BaseBauble{
}
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){
@@ -136,7 +149,7 @@ public class ModularBauble extends BaseBauble{
}
if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HP)) > 0){
- list.add(EnumChatFormatting.GRAY+"Health Boost: "+EnumChatFormatting.RED+mStatlevel+EnumChatFormatting.GRAY+"/100.");
+ 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.");
diff --git a/src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java b/src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java
index 74802beb84..042700d352 100644
--- a/src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java
+++ b/src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java
@@ -4,12 +4,10 @@ import static gtPlusPlus.core.tileentities.machines.TileEntityModularityTable.mV
import static gtPlusPlus.core.tileentities.machines.TileEntityModularityTable.mValidUpgradeListFormChange;
import java.util.Iterator;
-import java.util.Map;
import java.util.Map.Entry;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.array.Pair;
-import gtPlusPlus.core.util.nbt.ModularArmourUtils;
import gtPlusPlus.core.util.nbt.ModularArmourUtils.BT;
import gtPlusPlus.core.util.nbt.ModularArmourUtils.Modifiers;
import net.minecraft.inventory.IInventory;
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java
index 2d6082da99..39bef9b11a 100644
--- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java
+++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java
@@ -88,12 +88,15 @@ public class TileEntityModularityTable extends TileEntity {
}
- Utils.LOG_INFO("set new Modular bauble");
if (removeInputA && removeInputB){
+ Utils.LOG_INFO("set new Modular bauble");
this.inventoryOutputs.setInventorySlotContents(0, null);
this.inventoryOutputs.setInventorySlotContents(1, null);
this.inventoryOutputs.setInventorySlotContents(2, tBauble);
- }
+ }
+ else {
+ Utils.LOG_INFO("1: "+removeInputA+" | 2: "+removeInputB);
+ }
}
}
}
@@ -157,6 +160,7 @@ public class TileEntityModularityTable extends TileEntity {
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();
@@ -166,19 +170,25 @@ public class TileEntityModularityTable extends TileEntity {
return true;
}
}
-
+ } catch (Throwable t){
+
+ }
+ try {
Iterator<Entry<ItemStack, Pair<Modifiers, Integer>>> it2 = mValidUpgradeList.entrySet().iterator();
while (it2.hasNext()) {
Entry<ItemStack, Pair<Modifiers, Integer>> pair = it2.next();
if (pair.getKey().getItem() == tStack.getItem()
&& pair.getKey().getItemDamage() == tStack.getItemDamage()){
Pair<Modifiers, Integer> newPair = pair.getValue();
+ int mCurrentLevel = ModularArmourUtils.getModifierLevel(tBauble, newPair);
ModularArmourUtils.setModifierLevel(tBauble, newPair);
return true;
}
}
-
- //Utils.LOG_INFO("Could not find valid upgrade: "+tStack.getDisplayName()+".");
+ } 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 629dcea636..72f65c7924 100644
--- a/src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java
+++ b/src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java
@@ -96,9 +96,13 @@ public class ModularArmourUtils {
}
public static void setModifierLevel(ItemStack aStack, Modifiers aMod, int aInt) {
+
+ int mCurrentLevel = getModifierLevel(aStack, aMod);
+ int mNewTotalLevel = mCurrentLevel+aInt;
+
NBTTagCompound tNBT = NBTUtils.getNBT(aStack);
- if (aMod.isValidLevel(aInt)){
- tNBT.setInteger(aMod.getModifier(), aInt);
+ if (aMod.isValidLevel(mNewTotalLevel)){
+ tNBT.setInteger(aMod.getModifier(), mNewTotalLevel);
GT_Utility.ItemNBT.setNBT(aStack, tNBT);
}
else {
@@ -107,6 +111,10 @@ public class ModularArmourUtils {
}
}
}
+
+ public static int getModifierLevel(ItemStack aStack, Pair<Modifiers, Integer> newPair) {
+ return getModifierLevel(aStack, newPair.getKey());
+ }
public static int getModifierLevel(ItemStack aStack, Modifiers aMod) {
NBTTagCompound tNBT = NBTUtils.getNBT(aStack);