aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item
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
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')
-rw-r--r--src/Java/gtPlusPlus/core/item/ModItems.java18
-rw-r--r--src/Java/gtPlusPlus/core/item/base/CoreItem.java39
2 files changed, 49 insertions, 8 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java
index dcb80c75be..f2136c70c6 100644
--- a/src/Java/gtPlusPlus/core/item/ModItems.java
+++ b/src/Java/gtPlusPlus/core/item/ModItems.java
@@ -73,6 +73,7 @@ public final class ModItems {
public static Item itemIngotBatteryAlloy;
public static Item itemPlateBatteryAlloy;
public static Item itemHeliumBlob;
+ public static Item itemHydrogenBlob;
public static Item itemPLACEHOLDER_Circuit;
public static Item FuelRod_Empty;
@@ -146,6 +147,7 @@ public final class ModItems {
@SuppressWarnings("unused")
public static final void init(){
+ //Default item used when recipes fail, handy for debugging.
AAA_Broken = new BaseItemIngot("AAA_Broken", "Errors - Tell Alkalus", Utils.rgbtoHexValue(128, 128, 128), 0);
//Debug Loading
@@ -159,10 +161,18 @@ public final class ModItems {
GameRegistry.registerItem(itemStickyRubber, "itemStickyRubber");
GT_OreDictUnificator.registerOre("ingotRubber", ItemUtils.getItemStack(CORE.MODID+":itemStickyRubber", 1));
- itemHeliumBlob = new CoreItem("itemHeliumBlob", tabMisc).setTextureName(CORE.MODID + ":itemHeliumBlob");
- GT_OreDictUnificator.registerOre("dustHydrogen", new ItemStack(ModItems.itemHeliumBlob));
- //GameRegistry.registerItem(itemHeliumBlob, "itemHeliumBlob");
-
+
+
+
+
+
+ //Register Hydrogen Blobs first, so we can replace old helium blobs.
+ itemHydrogenBlob = new CoreItem("itemHydrogenBlob", tabMisc).setTextureName(CORE.MODID + ":itemHydrogenBlob");
+ GT_OreDictUnificator.registerOre("dustHydrogen", new ItemStack(ModItems.itemHydrogenBlob));
+ //Register Old Helium Blob, this will be replaced when held by a player.
+ itemHeliumBlob = new CoreItem("itemHeliumBlob", tabMisc, ItemUtils.getSimpleStack(itemHydrogenBlob)).setTextureName(CORE.MODID + ":itemHeliumBlob");
+
+
//Make some backpacks
//Primary colours
backpack_Red = new BaseItemBackpack("backpackRed", Utils.rgbtoHexValue(200, 0, 0));
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