aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item/base
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-11-23 15:31:59 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-11-23 15:31:59 +1000
commited52e8c83916cac101e8dd50cfe179c23a6122b2 (patch)
tree53ceb9487dd754f5d809a31a9f9702e4d78aece6 /src/Java/gtPlusPlus/core/item/base
parentd2493ffb71f880483a93a2d896097185bee9e63e (diff)
downloadGT5-Unofficial-ed52e8c83916cac101e8dd50cfe179c23a6122b2.tar.gz
GT5-Unofficial-ed52e8c83916cac101e8dd50cfe179c23a6122b2.tar.bz2
GT5-Unofficial-ed52e8c83916cac101e8dd50cfe179c23a6122b2.zip
+ Added proper components for the ENERGYCRYSTAL material.
+ Added proper components for the BLOODSTEEL material. + Added a feature to CoreItem.java that allows items to be replaced (easy deprecation of older items). $ Fancied up the PlaceHolder Texture. % Tweaked the recipe for the Maceration Stack Controller.
Diffstat (limited to 'src/Java/gtPlusPlus/core/item/base')
-rw-r--r--src/Java/gtPlusPlus/core/item/base/CoreItem.java39
1 files changed, 35 insertions, 4 deletions
diff --git a/src/Java/gtPlusPlus/core/item/base/CoreItem.java b/src/Java/gtPlusPlus/core/item/base/CoreItem.java
index e43834a317..5f4ef7a823 100644
--- a/src/Java/gtPlusPlus/core/item/base/CoreItem.java
+++ b/src/Java/gtPlusPlus/core/item/base/CoreItem.java
@@ -1,13 +1,16 @@
package gtPlusPlus.core.item.base;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.*;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -19,6 +22,9 @@ 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;
//0
/*
@@ -28,6 +34,17 @@ public class CoreItem extends Item
{
this(unlocalizedName, creativeTab, 64, 0); //Calls 3
}
+
+ //0.1
+ /*
+ * Name, Tab - 64 Stack, 0 Dmg
+ */
+ 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
/*
* Name, Tab, Stack - 0 Dmg
@@ -58,7 +75,7 @@ public class CoreItem extends Item
*/
public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description)
{
- this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, EnumChatFormatting.GRAY, false); //Calls 4.5
+ this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, EnumChatFormatting.GRAY, false, null); //Calls 4.5
}
//4.5
/*
@@ -66,7 +83,7 @@ public class CoreItem extends Item
*/
public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description, EnumChatFormatting colour)
{
- this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, colour, false); //Calls 5
+ this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, colour, false, null); //Calls 5
}
//4.75
@@ -75,14 +92,14 @@ public class CoreItem extends Item
*/
public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description, EnumRarity rarity)
{
- this(unlocalizedName, creativeTab, stackSize, maxDmg, description, rarity, EnumChatFormatting.GRAY, false); //Calls 5
+ this(unlocalizedName, creativeTab, stackSize, maxDmg, description, rarity, EnumChatFormatting.GRAY, false, null); //Calls 5
}
//5
/*
* Name, Tab, Stack, Dmg, Description, Rarity, Text Colour, Effect
*/
- public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect)
+ public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect, ItemStack OverrideItem)
{
setUnlocalizedName(unlocalizedName);
setTextureName(CORE.MODID + ":" + unlocalizedName);
@@ -93,6 +110,7 @@ public class CoreItem extends Item
this.itemDescription = description;
this.descColour = colour;
this.hasEffect = Effect;
+ this.turnsInto = OverrideItem;
GameRegistry.registerItem(this, unlocalizedName);
}
@@ -113,4 +131,17 @@ 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);
+ }
+ }
+ }
} \ No newline at end of file