diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-06-19 14:53:32 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-06-19 14:53:32 +1000 |
commit | d4f11459f2e78e954a4c060c92861614c114d1cb (patch) | |
tree | a9d22e4f658e25163ae0fdbe4a1e3395da9efac9 /src/Java/miscutil/core/item/base | |
parent | 2615992e7d0d4ed3ac205800be71c831029b2dc5 (diff) | |
download | GT5-Unofficial-d4f11459f2e78e954a4c060c92861614c114d1cb.tar.gz GT5-Unofficial-d4f11459f2e78e954a4c060c92861614c114d1cb.tar.bz2 GT5-Unofficial-d4f11459f2e78e954a4c060c92861614c114d1cb.zip |
+More classes stolen from GT to implement my own items on a metaitem.
+Added LuV -> Max Voltage Machine components.
+Added Rocket Engines, High tier diesel generators.
+Added new textures for everything.
+Added BedLocator_Base.java - Debug item for testing and NBT data storage.
+Added Machine_Charger.java - Another Debug machine for testing NBT value manipulation.
Diffstat (limited to 'src/Java/miscutil/core/item/base')
-rw-r--r-- | src/Java/miscutil/core/item/base/BaseItemWithCharge.java | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/Java/miscutil/core/item/base/BaseItemWithCharge.java b/src/Java/miscutil/core/item/base/BaseItemWithCharge.java new file mode 100644 index 0000000000..7c88a62ed0 --- /dev/null +++ b/src/Java/miscutil/core/item/base/BaseItemWithCharge.java @@ -0,0 +1,74 @@ +package miscutil.core.item.base; + +import java.util.List; + +import miscutil.core.creative.AddToCreativeTab; +import miscutil.core.lib.CORE; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +public class BaseItemWithCharge extends Item{ + + public int int_Charge = 0; + public int int_Max_Charge = 0; + + public BaseItemWithCharge(String unlocalizedName, int constructor_Charge, int constructor_Max_Charge) { + this.setUnlocalizedName(unlocalizedName); + this.setTextureName(CORE.MODID + ":" + unlocalizedName); + this.setMaxStackSize(1); + this.setCreativeTab(AddToCreativeTab.tabMachines); + this.int_Charge = constructor_Charge; + this.int_Max_Charge = constructor_Max_Charge; + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + int NBT_Charge = int_Charge; + int NBT_Max_Charge = int_Max_Charge; + if (stack.stackTagCompound != null) { + NBT_Charge = stack.stackTagCompound.getInteger("charge_Current"); + NBT_Max_Charge = stack.stackTagCompound.getInteger("charge_Max"); + String tempX = String.valueOf(NBT_Charge); + String tempY = String.valueOf(NBT_Max_Charge); + String formattedX = EnumChatFormatting.RED+tempX+EnumChatFormatting.GRAY; + String formattedY = EnumChatFormatting.DARK_RED+tempY+EnumChatFormatting.GRAY; + list.add(EnumChatFormatting.GRAY+"Charge:"+formattedX+"/"+formattedY+"."); + super.addInformation(stack, aPlayer, list, bool); + } + } + + //Ticking and NBT Handling + /* Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and + * update it's contents. + * + * public int fuelRemaining = 0; + public int maximumFuel = 0; + public String fuelType = ""; + public float heat = 0; + public float maxHeat = 5000; + * + */ + @Override + public void onCreated(ItemStack itemStack, World world, EntityPlayer player) { + + } + + @Override + public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + + } + + @Override + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) { + itemStack.stackTagCompound = new NBTTagCompound(); + return super.onItemRightClick(itemStack, world, par3Entity); + } + + + +} |