diff options
| author | Draknyte1 <Draknyte1@hotmail.com> | 2017-03-04 12:58:47 +1000 |
|---|---|---|
| committer | Draknyte1 <Draknyte1@hotmail.com> | 2017-03-04 12:58:47 +1000 |
| commit | ae21012d216df71f31aed6fbc9d76215fc24ceed (patch) | |
| tree | cc89accbe6ce5c04b72ed3c5e46b2a185f88be6a /src/Java/gtPlusPlus/core/item/general | |
| parent | ba89972a22a316030f8c3bd99974f915b1d7aefc (diff) | |
| download | GT5-Unofficial-ae21012d216df71f31aed6fbc9d76215fc24ceed.tar.gz GT5-Unofficial-ae21012d216df71f31aed6fbc9d76215fc24ceed.tar.bz2 GT5-Unofficial-ae21012d216df71f31aed6fbc9d76215fc24ceed.zip | |
+ New texture for the slow builders ring.
+ Added the Alkalus Disk.
$ Fixed Frame Box Assembler Recipes.
$ Fixed Missing 7Li material.
$ Fixed Tiered Tanks not showing their capacity in the tooltip.
$ Fixed tooltips for alloys containing Bronze or Steel.
$ Fixed Clay Pipe Extruder Recipes.
- Removed a handful of Plasma cells for misc. materials.
% Changed the Industrial Coke Oven's tooltip, to better describe the input/output requirements.
% Cleaned up The Entire Project.
Diffstat (limited to 'src/Java/gtPlusPlus/core/item/general')
11 files changed, 609 insertions, 616 deletions
diff --git a/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java b/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java index 5a05ac7655..55efc50c4e 100644 --- a/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java +++ b/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java @@ -1,10 +1,9 @@ package gtPlusPlus.core.item.general; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; - import java.util.List; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -18,87 +17,87 @@ public class BedLocator_Base extends Item{ public int bed_X = 0; public int bed_Y = 0; public int bed_Z = 0; - - public BedLocator_Base(String unlocalizedName) { + + public BedLocator_Base(final String unlocalizedName) { this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(1); + this.setMaxStackSize(1); this.setCreativeTab(AddToCreativeTab.tabMachines); } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + + + int NBT_X = this.bed_X; + int NBT_Y = this.bed_Y; + int NBT_Z = this.bed_Z; - - int NBT_X = bed_X; - int NBT_Y = bed_Y; - int NBT_Z = bed_Z; - if (stack.stackTagCompound != null) { NBT_X = stack.stackTagCompound.getInteger("pos_x"); NBT_Y = stack.stackTagCompound.getInteger("pos_y"); NBT_Z = stack.stackTagCompound.getInteger("pos_z"); - String tempX = String.valueOf(NBT_X); - String tempY = String.valueOf(NBT_Y); - String tempZ = String.valueOf(NBT_Z); - String formattedX = EnumChatFormatting.DARK_RED+tempX+EnumChatFormatting.GRAY; - String formattedY = EnumChatFormatting.RED+tempY+EnumChatFormatting.GRAY; - String formattedZ = EnumChatFormatting.RED+tempZ+EnumChatFormatting.GRAY; - - list.add(EnumChatFormatting.GRAY+"X: "+formattedX+"."); - list.add(EnumChatFormatting.GRAY+"Y: "+formattedY+"."); - list.add(EnumChatFormatting.GRAY+"Z: "+formattedZ+"."); - super.addInformation(stack, aPlayer, list, bool); - } + final String tempX = String.valueOf(NBT_X); + final String tempY = String.valueOf(NBT_Y); + final String tempZ = String.valueOf(NBT_Z); + final String formattedX = EnumChatFormatting.DARK_RED+tempX+EnumChatFormatting.GRAY; + final String formattedY = EnumChatFormatting.RED+tempY+EnumChatFormatting.GRAY; + final String formattedZ = EnumChatFormatting.RED+tempZ+EnumChatFormatting.GRAY; + + list.add(EnumChatFormatting.GRAY+"X: "+formattedX+"."); + list.add(EnumChatFormatting.GRAY+"Y: "+formattedY+"."); + list.add(EnumChatFormatting.GRAY+"Z: "+formattedZ+"."); + 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) { + public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) { itemStack.stackTagCompound = new NBTTagCompound(); this.bed_X = 0; this.bed_Y = 0; this.bed_Z = 0; - itemStack.stackTagCompound.setInteger("pos_x", bed_X); - itemStack.stackTagCompound.setInteger("pos_y", bed_Y); - itemStack.stackTagCompound.setInteger("pos_z", bed_Z); + itemStack.stackTagCompound.setInteger("pos_x", this.bed_X); + itemStack.stackTagCompound.setInteger("pos_y", this.bed_Y); + itemStack.stackTagCompound.setInteger("pos_z", this.bed_Z); } @Override - public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) { - + public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) { + } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) { + public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer par3Entity) { itemStack.stackTagCompound = new NBTTagCompound(); if (par3Entity.getBedLocation() != null){ - this.bed_X = par3Entity.getBedLocation().posX; - this.bed_Y = par3Entity.getBedLocation().posY; - this.bed_Z = par3Entity.getBedLocation().posZ; + this.bed_X = par3Entity.getBedLocation().posX; + this.bed_Y = par3Entity.getBedLocation().posY; + this.bed_Z = par3Entity.getBedLocation().posZ; } else { this.bed_X = 0; this.bed_Y = 0; this.bed_Z = 0; } - itemStack.stackTagCompound.setInteger("pos_x", bed_X); - itemStack.stackTagCompound.setInteger("pos_y", bed_Y); - itemStack.stackTagCompound.setInteger("pos_z", bed_Z); + itemStack.stackTagCompound.setInteger("pos_x", this.bed_X); + itemStack.stackTagCompound.setInteger("pos_y", this.bed_Y); + itemStack.stackTagCompound.setInteger("pos_z", this.bed_Z); return super.onItemRightClick(itemStack, world, par3Entity); } diff --git a/src/Java/gtPlusPlus/core/item/general/BufferCore.java b/src/Java/gtPlusPlus/core/item/general/BufferCore.java index 42f8c99c70..40136d7409 100644 --- a/src/Java/gtPlusPlus/core/item/general/BufferCore.java +++ b/src/Java/gtPlusPlus/core/item/general/BufferCore.java @@ -1,23 +1,22 @@ package gtPlusPlus.core.item.general; +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.item.base.BaseItemWithDamageValue; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; - -import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class BufferCore extends BaseItemWithDamageValue{ - + public int coreTier = 0; - - public BufferCore(String unlocalizedName, int i) { + + public BufferCore(final String unlocalizedName, final int i) { super(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); this.setMaxStackSize(2); @@ -25,74 +24,74 @@ public class BufferCore extends BaseItemWithDamageValue{ } @Override - public String getItemStackDisplayName(ItemStack stack) { + public String getItemStackDisplayName(final ItemStack stack) { return super.getItemStackDisplayName(stack)+" ["+CORE.VOLTAGES[this.coreTier-1]+"]."; } - + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { - return true; - } + public boolean requiresMultipleRenderPasses() + { + return true; + } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { list.add(EnumChatFormatting.GRAY+"A key crafting component for making energy buffers."); super.addInformation(stack, aPlayer, list, bool); } public final int getCoreTier() { - return coreTier; + return this.coreTier; } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { //Figure Out Damage - String s = String.format("%X", HEX_OxFFFFFF); + final String s = String.format("%X", HEX_OxFFFFFF); //Utils.LOG_INFO(s); //String rgb = Utils.hex2Rgb(s); //Utils.LOG_INFO(rgb); - if (coreTier == 1){ + if (this.coreTier == 1){ HEX_OxFFFFFF = 0x4d4d4d; } - else if (coreTier == 2){ + else if (this.coreTier == 2){ HEX_OxFFFFFF = 0x666666; } - else if (coreTier == 3){ + else if (this.coreTier == 3){ HEX_OxFFFFFF = 0x8c8c8c; } - else if (coreTier == 4){ + else if (this.coreTier == 4){ HEX_OxFFFFFF = 0xa6a6a6; } - else if (coreTier == 5){ + else if (this.coreTier == 5){ HEX_OxFFFFFF = 0xcccccc; } - else if (coreTier == 6){ + else if (this.coreTier == 6){ HEX_OxFFFFFF = 0xe6e6e6; } - else if (coreTier == 7){ + else if (this.coreTier == 7){ HEX_OxFFFFFF = 0xffffcc; } - else if (coreTier == 8){ + else if (this.coreTier == 8){ HEX_OxFFFFFF = 0xace600; } - else if (coreTier == 9){ + else if (this.coreTier == 9){ HEX_OxFFFFFF = 0xffff00; } /*else if (coreTier == 10){ HEX_OxFFFFFF = 0xff0000; }*/ - else if (coreTier == 10){ + else if (this.coreTier == 10){ HEX_OxFFFFFF = Utils.rgbtoHexValue(MathUtils.randInt(220, 250), MathUtils.randInt(221, 251), MathUtils.randInt(220, 250)); } else { HEX_OxFFFFFF = 0xffffff; } - + return HEX_OxFFFFFF; } - + } diff --git a/src/Java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java b/src/Java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java index a7a1526277..6bb1e8d7bc 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java @@ -14,15 +14,15 @@ import net.minecraft.world.World; public class ItemBasicFirestarter extends CoreItem { public ItemBasicFirestarter() { - super("itemSimpleFiremaker", AddToCreativeTab.tabTools, 1, 5, "Can probably make you a fire"); + super("itemSimpleFiremaker", AddToCreativeTab.tabTools, 1, 5, "Can probably make you a fire"); this.setTextureName(CORE.MODID+":"+"itemFireStarter"); } @Override public boolean onItemUse( - ItemStack thisItem, EntityPlayer thisPlayer, World thisWorld, + final ItemStack thisItem, final EntityPlayer thisPlayer, final World thisWorld, int blockX, int blockY, int blockZ, - int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { + final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) { if (p_77648_7_ == 0) { --blockY; } @@ -47,23 +47,23 @@ public class ItemBasicFirestarter extends CoreItem { if (thisWorld.getBlock(blockX, blockY, blockZ) instanceof FirePit){ thisWorld.setBlockMetadataWithNotify(blockX, blockY, blockZ, 2, 4); PlayerUtils.messagePlayer(thisPlayer, "You light the fire pit. "); - } + } if (thisWorld.isAirBlock(blockX, blockY, blockZ)) { - int random = MathUtils.randInt(0, 3); + final int random = MathUtils.randInt(0, 3); //Explode, lol. if (random == 0){ PlayerUtils.messagePlayer(thisPlayer, "You somehow managed to set yourself on fire... "); - thisWorld.playSoundEffect((double)thisPlayer.posX + 0.5D, (double)thisPlayer.posY + 0.5D, (double)thisPlayer.posZ + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - thisPlayer.setFire(4); + thisWorld.playSoundEffect(thisPlayer.posX + 0.5D, thisPlayer.posY + 0.5D, thisPlayer.posZ + 0.5D, "fire.ignite", 1.0F, (itemRand.nextFloat() * 0.4F) + 0.8F); + thisPlayer.setFire(4); thisItem.damageItem(thisItem.getMaxDamage(), thisPlayer); } //Create a fire else if (random == 2){ PlayerUtils.messagePlayer(thisPlayer, "You created a fire!"); - thisWorld.playSoundEffect((double)blockX + 0.5D, (double)blockY + 0.5D, (double)blockZ + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - thisWorld.setBlock(blockX, blockY, blockZ, Blocks.fire); + thisWorld.playSoundEffect(blockX + 0.5D, blockY + 0.5D, blockZ + 0.5D, "fire.ignite", 1.0F, (itemRand.nextFloat() * 0.4F) + 0.8F); + thisWorld.setBlock(blockX, blockY, blockZ, Blocks.fire); } //Do nothing @@ -78,7 +78,7 @@ public class ItemBasicFirestarter extends CoreItem { } @Override - public String getItemStackDisplayName(ItemStack thisItem) { + public String getItemStackDisplayName(final ItemStack thisItem) { return "Basic Firemaker"; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java index 0458a38110..65aa618cb3 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java @@ -1,5 +1,8 @@ package gtPlusPlus.core.item.general; +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.interfaces.IItemBlueprint; import gtPlusPlus.core.lib.CORE; @@ -7,9 +10,6 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.player.PlayerUtils; - -import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -19,14 +19,13 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; public class ItemBlueprint extends Item implements IItemBlueprint{ - public ItemBlueprint(String unlocalizedName) { + public ItemBlueprint(final String unlocalizedName) { this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(1); + this.setMaxStackSize(1); this.setCreativeTab(AddToCreativeTab.tabMachines); //this.bpID = MathUtils.randInt(0, 1000); GameRegistry.registerItem(this, unlocalizedName); @@ -34,10 +33,10 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack itemStack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack itemStack, final EntityPlayer aPlayer, final List list, final boolean bool) { //Create some NBT if it's not there, otherwise this does nothing. if (!itemStack.hasTagCompound()){ - createNBT(itemStack); + this.createNBT(itemStack); } //Set up some default variables. int id = -1; @@ -46,14 +45,14 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ //Get proper display vars from NBT if it's there if (itemStack.hasTagCompound()){ //Utils.LOG_WARNING("Found TagCompound"); - id = (int) getNBT(itemStack, "mID"); - name = (String) getNBT(itemStack, "mName"); - blueprint = (boolean) getNBT(itemStack, "mBlueprint"); + id = (int) this.getNBT(itemStack, "mID"); + name = (String) this.getNBT(itemStack, "mName"); + blueprint = (boolean) this.getNBT(itemStack, "mBlueprint"); } //Write to tooltip list for each viable setting. if (itemStack.hasTagCompound()) { if (id != -1){ - list.add(EnumChatFormatting.GRAY+"Technical Document No. "+id); + list.add(EnumChatFormatting.GRAY+"Technical Document No. "+id); } if(blueprint){ list.add(EnumChatFormatting.BLUE+"Currently holding a blueprint for "+name); @@ -61,7 +60,7 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ else { list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything."); } - } + } else { list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything."); } @@ -69,46 +68,46 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { return "Blueprint [I am useless]"; } @Override - public void onCreated(ItemStack itemStack, World world, EntityPlayer player) { - createNBT(itemStack); + public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) { + this.createNBT(itemStack); } @Override - public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) { } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) { + public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer par3Entity) { //Let the player know what blueprint is held if (itemStack.hasTagCompound()) { - PlayerUtils.messagePlayer(par3Entity, "This Blueprint holds NBT data. "+"|"+getNBT(itemStack, "mID")+"|"+getNBT(itemStack, "mBlueprint")+"|"+getNBT(itemStack, "mName")+"|"+ItemUtils.getArrayStackNames(readItemsFromNBT(itemStack))); + PlayerUtils.messagePlayer(par3Entity, "This Blueprint holds NBT data. "+"|"+this.getNBT(itemStack, "mID")+"|"+this.getNBT(itemStack, "mBlueprint")+"|"+this.getNBT(itemStack, "mName")+"|"+ItemUtils.getArrayStackNames(this.readItemsFromNBT(itemStack))); } else { - createNBT(itemStack); - PlayerUtils.messagePlayer(par3Entity, "This is a placeholder. "+getNBT(itemStack, "mID")); + this.createNBT(itemStack); + PlayerUtils.messagePlayer(par3Entity, "This is a placeholder. "+this.getNBT(itemStack, "mID")); } return super.onItemRightClick(itemStack, world, par3Entity); } - public ItemStack[] readItemsFromNBT(ItemStack itemStack){ + public ItemStack[] readItemsFromNBT(final ItemStack itemStack){ ItemStack[] blueprint = new ItemStack[9]; if (itemStack.hasTagCompound()){ - NBTTagCompound nbt = itemStack.getTagCompound(); - NBTTagList list = nbt.getTagList("Items", 10); + final NBTTagCompound nbt = itemStack.getTagCompound(); + final NBTTagList list = nbt.getTagList("Items", 10); blueprint = new ItemStack[INV_SIZE]; for(int i = 0;i<list.tagCount();i++) { - NBTTagCompound data = list.getCompoundTagAt(i); - int slot = data.getInteger("Slot"); - if(slot >= 0 && slot < INV_SIZE) + final NBTTagCompound data = list.getCompoundTagAt(i); + final int slot = data.getInteger("Slot"); + if((slot >= 0) && (slot < INV_SIZE)) { blueprint[slot] = ItemStack.loadItemStackFromNBT(data); } @@ -118,17 +117,17 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ return null; } - public ItemStack writeItemsToNBT(ItemStack itemStack, ItemStack[] craftingGrid){ - ItemStack[] blueprint = craftingGrid; + public ItemStack writeItemsToNBT(final ItemStack itemStack, final ItemStack[] craftingGrid){ + final ItemStack[] blueprint = craftingGrid; if (itemStack.hasTagCompound()){ - NBTTagCompound nbt = itemStack.getTagCompound(); - NBTTagList list = new NBTTagList(); + final NBTTagCompound nbt = itemStack.getTagCompound(); + final NBTTagList list = new NBTTagList(); for(int i = 0;i<INV_SIZE;i++) { - ItemStack stack = blueprint[i]; + final ItemStack stack = blueprint[i]; if(stack != null) { - NBTTagCompound data = new NBTTagCompound(); + final NBTTagCompound data = new NBTTagCompound(); stack.writeToNBT(data); data.setInteger("Slot", i); list.appendTag(data); @@ -142,18 +141,18 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ } @Override - public boolean isBlueprint(ItemStack stack) { + public boolean isBlueprint(final ItemStack stack) { return true; } @Override - public boolean setBlueprint(ItemStack stack, IInventory craftingTable, ItemStack output) { + public boolean setBlueprint(final ItemStack stack, final IInventory craftingTable, final ItemStack output) { boolean hasBP = false; ItemStack[] blueprint = new ItemStack[9]; if (stack.hasTagCompound()){ - hasBP = (boolean) getNBT(stack, "mBlueprint"); - blueprint = readItemsFromNBT(stack); + hasBP = (boolean) this.getNBT(stack, "mBlueprint"); + blueprint = this.readItemsFromNBT(stack); } if (!hasBP){ @@ -164,7 +163,7 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ blueprint[0].stackSize = 0; } } - writeItemsToNBT(stack, blueprint); + this.writeItemsToNBT(stack, blueprint); if (stack.hasTagCompound()){ if(stack.getTagCompound().getCompoundTag("Items") != null){ stack.stackTagCompound.setBoolean("mBlueprint", true); @@ -172,43 +171,43 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ else { //Invalid BP saved? } - hasBP = (boolean) getNBT(stack, "mBlueprint"); + hasBP = (boolean) this.getNBT(stack, "mBlueprint"); } - + if (output != null){ - setBlueprintName(stack, output.getDisplayName()); + this.setBlueprintName(stack, output.getDisplayName()); hasBP = true; return true; } return false; - } catch (Throwable t){ - return false; + } catch (final Throwable t){ + return false; } } return false; } @Override - public void setBlueprintName(ItemStack stack, String name) { + public void setBlueprintName(final ItemStack stack, final String name) { stack.stackTagCompound.setString("mName", name); } @Override - public boolean hasBlueprint(ItemStack stack) { + public boolean hasBlueprint(final ItemStack stack) { if (stack.hasTagCompound()){ - return (boolean) getNBT(stack, "mBlueprint"); + return (boolean) this.getNBT(stack, "mBlueprint"); } return false; } @Override - public ItemStack[] getBlueprint(ItemStack stack) { + public ItemStack[] getBlueprint(final ItemStack stack) { ItemStack[] blueprint = new ItemStack[9]; if (stack.hasTagCompound()){ - blueprint = readItemsFromNBT(stack); - } + blueprint = this.readItemsFromNBT(stack); + } try { - ItemStack[] returnStack = new ItemStack[9]; + final ItemStack[] returnStack = new ItemStack[9]; for (int o=0; o<blueprint.length; o++){ returnStack[o] = blueprint[o]; if (returnStack[0] != null){ @@ -216,12 +215,12 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ } } return returnStack; - } catch (Throwable t){ - return null; + } catch (final Throwable t){ + return null; } } - public boolean createNBT(ItemStack itemStack){ + public boolean createNBT(final ItemStack itemStack){ if (itemStack.hasTagCompound()){ if (!itemStack.stackTagCompound.getBoolean("mBlueprint") && !itemStack.stackTagCompound.getString("mName").equals("")){ //No Blueprint and no name Set @@ -245,9 +244,9 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ return false; } else if(!itemStack.hasTagCompound()){ - int bpID = MathUtils.randInt(0, 1000); - boolean hasRecipe = false; - String recipeName = ""; + final int bpID = MathUtils.randInt(0, 1000); + final boolean hasRecipe = false; + final String recipeName = ""; Utils.LOG_WARNING("Creating Blueprint, setting up it's NBT data. "+bpID); itemStack.stackTagCompound = new NBTTagCompound(); itemStack.stackTagCompound.setInteger("mID", bpID); @@ -256,19 +255,19 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ return true; } else { - int bpID = MathUtils.randInt(0, 1000); - boolean hasRecipe = false; - String recipeName = ""; + final int bpID = MathUtils.randInt(0, 1000); + final boolean hasRecipe = false; + final String recipeName = ""; Utils.LOG_WARNING("Creating a Blueprint, setting up it's NBT data. "+bpID); itemStack.stackTagCompound = new NBTTagCompound(); itemStack.stackTagCompound.setInteger("mID", bpID); itemStack.stackTagCompound.setBoolean("mBlueprint", hasRecipe); itemStack.stackTagCompound.setString("mName", recipeName); return true; - } + } } - public Object getNBT(ItemStack itemStack, String tagNBT){ + public Object getNBT(final ItemStack itemStack, final String tagNBT){ if (!itemStack.hasTagCompound()){ return null; } @@ -286,8 +285,9 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ //For More Tag Support //o = itemStack.stackTagCompound.getInteger(tagNBT); } - if (o != null) + if (o != null) { return o; + } return null; } } diff --git a/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java b/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java index 77aa6ce078..ad98df9c78 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java @@ -1,13 +1,16 @@ package gtPlusPlus.core.item.general; +import java.util.List; + +import baubles.api.BaubleType; +import baubles.api.IBauble; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import ic2.api.item.*; - -import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -17,10 +20,6 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import baubles.api.BaubleType; -import baubles.api.IBauble; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; @Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) public class ItemCloakingDevice extends Item implements IElectricItem, IElectricItemManager, IBauble{ @@ -30,35 +29,35 @@ public class ItemCloakingDevice extends Item implements IElectricItem, IElectric private final static int maxValueEU = 10000*20*500; protected double chargeEU = 0; - public ItemCloakingDevice(double charge){ + public ItemCloakingDevice(final double charge){ this.chargeEU = charge; this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setUnlocalizedName(unlocalizedName); + this.setUnlocalizedName(this.unlocalizedName); this.setMaxStackSize(1); this.setTextureName(CORE.MODID + ":" + "personalCloakingDevice"); this.thisStack = ItemUtils.getSimpleStack(this); - this.charge(thisStack, charge, 3, true, false); - if (charge == 10000*20*500){ - this.setDamage(thisStack, 13); + this.charge(this.thisStack, charge, 3, true, false); + if (charge == (10000*20*500)){ + this.setDamage(this.thisStack, 13); } - GameRegistry.registerItem(this, unlocalizedName+"-"+charge); + GameRegistry.registerItem(this, this.unlocalizedName+"-"+charge); } @Override - public void onUpdate(ItemStack itemStack, World worldObj, Entity player, int p_77663_4_, boolean p_77663_5_) { + public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, final boolean p_77663_5_) { if (worldObj.isRemote) { return; } if (player instanceof EntityPlayer){ - for (ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { + for (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { if (is == itemStack) { continue; } if (is != null) { if (is.getItem() instanceof IElectricItem) { - IElectricItem electricItem = (IElectricItem) is.getItem(); - chargeEU = ElectricItem.manager.getCharge(is); + final IElectricItem electricItem = (IElectricItem) is.getItem(); + this.chargeEU = ElectricItem.manager.getCharge(is); } } @@ -70,74 +69,74 @@ public class ItemCloakingDevice extends Item implements IElectricItem, IElectric } @Override - public boolean canProvideEnergy(ItemStack itemStack) { + public boolean canProvideEnergy(final ItemStack itemStack) { return true; } @Override - public Item getChargedItem(ItemStack itemStack) { - ItemStack x = itemStack.copy(); + public Item getChargedItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); x.setItemDamage(maxValueEU); return x.getItem(); } @Override - public Item getEmptyItem(ItemStack itemStack) { - ItemStack x = itemStack.copy(); + public Item getEmptyItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); x.setItemDamage(0); return x.getItem(); } @Override - public double getMaxCharge(ItemStack itemStack) { + public double getMaxCharge(final ItemStack itemStack) { return maxValueEU; } @Override - public int getTier(ItemStack itemStack) { + public int getTier(final ItemStack itemStack) { return 5; } @Override - public double getTransferLimit(ItemStack itemStack) { + public double getTransferLimit(final ItemStack itemStack) { return 8196; } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { return (EnumChatFormatting.BLUE+"Personal Cloaking Device"+EnumChatFormatting.GRAY); } @Override - public double getDurabilityForDisplay(ItemStack stack) + public double getDurabilityForDisplay(final ItemStack stack) { //return 1.0D - getEnergyStored(stack) / this.capacity; - return 1.0D - (double)getCharge(stack) / (double)getMaxCharge(stack); + return 1.0D - (this.getCharge(stack) / this.getMaxCharge(stack)); } @Override - public boolean showDurabilityBar(ItemStack stack) + public boolean showDurabilityBar(final ItemStack stack) { return true; } - - public int secondsLeft(ItemStack stack){ + + public int secondsLeft(final ItemStack stack){ double r = 0; - r = getCharge(stack)/(10000*20); + r = this.getCharge(stack)/(10000*20); return (int) MathUtils.decimalRounding(r); } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add(""); - list.add(EnumChatFormatting.GREEN+"Worn as a Belt within Baubles."+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN+"Drains 10,000EU/t to provide invisibility."+EnumChatFormatting.GRAY); - list.add(""); - list.add(EnumChatFormatting.GOLD+"IC2/EU Information"+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+getTier(thisStack)+EnumChatFormatting.GRAY+"] Input Limit: ["+EnumChatFormatting.YELLOW+getTransferLimit(thisStack)+EnumChatFormatting.GRAY +"EU/t]"); - list.add(EnumChatFormatting.GRAY+"Current Power: ["+EnumChatFormatting.YELLOW+(long) getCharge(stack)+EnumChatFormatting.GRAY+"EU] ["+EnumChatFormatting.YELLOW+MathUtils.findPercentage(getCharge(stack), getMaxCharge(stack))+EnumChatFormatting.GRAY +"%]"); - list.add(EnumChatFormatting.GRAY+"Time Remaining: ["+EnumChatFormatting.YELLOW+secondsLeft(stack)+ EnumChatFormatting.GRAY +" seconds]"); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(""); + list.add(EnumChatFormatting.GREEN+"Worn as a Belt within Baubles."+EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GREEN+"Drains 10,000EU/t to provide invisibility."+EnumChatFormatting.GRAY); + list.add(""); + list.add(EnumChatFormatting.GOLD+"IC2/EU Information"+EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+this.getTier(this.thisStack)+EnumChatFormatting.GRAY+"] Input Limit: ["+EnumChatFormatting.YELLOW+this.getTransferLimit(this.thisStack)+EnumChatFormatting.GRAY +"EU/t]"); + list.add(EnumChatFormatting.GRAY+"Current Power: ["+EnumChatFormatting.YELLOW+(long) this.getCharge(stack)+EnumChatFormatting.GRAY+"EU] ["+EnumChatFormatting.YELLOW+MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack))+EnumChatFormatting.GRAY +"%]"); + list.add(EnumChatFormatting.GRAY+"Time Remaining: ["+EnumChatFormatting.YELLOW+this.secondsLeft(stack)+ EnumChatFormatting.GRAY +" seconds]"); super.addInformation(stack, aPlayer, list, bool); } @@ -165,8 +164,8 @@ public class ItemCloakingDevice extends Item |
