aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-11-23 21:53:04 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-11-23 21:53:04 +1000
commitae8a4b14a0de47c081d518681647d14122163f8e (patch)
treecfad69fc4475cf6560fcfbe9454184d463c407ff /src/Java/gtPlusPlus/core/item
parent757d747a2f7a63bec084a48303250af2956876ef (diff)
downloadGT5-Unofficial-ae8a4b14a0de47c081d518681647d14122163f8e.tar.gz
GT5-Unofficial-ae8a4b14a0de47c081d518681647d14122163f8e.tar.bz2
GT5-Unofficial-ae8a4b14a0de47c081d518681647d14122163f8e.zip
$ Heavily improved the code for item replacements in CoreItem.java.
+ Added handlers in Material.java for materials with invalid names. % Changed logging on some math related functions in Utils.java. + Added an extra case for Infused dusts into MaterialUtils.java.
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
-rw-r--r--src/Java/gtPlusPlus/core/item/base/CoreItem.java23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/Java/gtPlusPlus/core/item/base/CoreItem.java b/src/Java/gtPlusPlus/core/item/base/CoreItem.java
index 5f4ef7a823..22896fcf9b 100644
--- a/src/Java/gtPlusPlus/core/item/base/CoreItem.java
+++ b/src/Java/gtPlusPlus/core/item/base/CoreItem.java
@@ -22,7 +22,7 @@ public class CoreItem extends Item
private final EnumChatFormatting descColour;
private final String itemDescription;
private final boolean hasEffect;
-
+
//Replace Item - What does this item turn into when held.
private final ItemStack turnsInto;
@@ -42,7 +42,7 @@ public class CoreItem extends Item
public CoreItem(String unlocalizedName, CreativeTabs creativeTab, ItemStack OverrideItem)
{
this(unlocalizedName, creativeTab, 64, 0, "This item will be replaced by another when helf by a player, it is old and should not be used in recipes.", EnumRarity.uncommon, EnumChatFormatting.UNDERLINE, false, OverrideItem); //Calls 5
-
+
}
//1
@@ -131,16 +131,27 @@ public class CoreItem extends Item
public boolean hasEffect(ItemStack par1ItemStack){
return hasEffect;
}
-
+
@Override
public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
if (turnsInto != null){
if (entityHolding instanceof EntityPlayer){
+
Utils.LOG_INFO("Replacing "+iStack.getDisplayName()+" with "+turnsInto.getDisplayName()+".");
ItemStack tempTransform = turnsInto;
- tempTransform.stackSize = iStack.stackSize;
- ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform));
- ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this);
+ if (iStack.stackSize == 64){
+ tempTransform.stackSize=64;
+ ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform));
+ for (int l=0;l<64;l++){
+ ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this);
+ }
+
+ }
+ else {
+ tempTransform.stackSize=1;
+ ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform));
+ ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this);
+ }
}
}
}