aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/inventories
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2017-03-04 12:58:47 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2017-03-04 12:58:47 +1000
commitae21012d216df71f31aed6fbc9d76215fc24ceed (patch)
treecc89accbe6ce5c04b72ed3c5e46b2a185f88be6a /src/Java/gtPlusPlus/core/inventories
parentba89972a22a316030f8c3bd99974f915b1d7aefc (diff)
downloadGT5-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/inventories')
-rw-r--r--src/Java/gtPlusPlus/core/inventories/BaseInventoryBackpack.java105
-rw-r--r--src/Java/gtPlusPlus/core/inventories/InventoryFishTrap.java113
-rw-r--r--src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java124
-rw-r--r--src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java138
-rw-r--r--src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java54
-rw-r--r--src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java96
-rw-r--r--src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java122
-rw-r--r--src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java126
8 files changed, 438 insertions, 440 deletions
diff --git a/src/Java/gtPlusPlus/core/inventories/BaseInventoryBackpack.java b/src/Java/gtPlusPlus/core/inventories/BaseInventoryBackpack.java
index 59fe8aa4fa..9d0f75acba 100644
--- a/src/Java/gtPlusPlus/core/inventories/BaseInventoryBackpack.java
+++ b/src/Java/gtPlusPlus/core/inventories/BaseInventoryBackpack.java
@@ -1,9 +1,8 @@
package gtPlusPlus.core.inventories;
-import gtPlusPlus.core.item.base.BaseItemBackpack;
-
import java.util.UUID;
+import gtPlusPlus.core.item.base.BaseItemBackpack;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@@ -13,7 +12,7 @@ import net.minecraftforge.common.util.Constants;
public class BaseInventoryBackpack implements IInventory{
- private String name = "Inventory Item";
+ private final String name = "Inventory Item";
/** Provides NBT Tag Compound to reference */
private final ItemStack invItem;
@@ -22,28 +21,28 @@ public class BaseInventoryBackpack implements IInventory{
public static final int INV_SIZE = 8;
/** Inventory's size must be same as number of slots you add to the Container class */
- private ItemStack[] inventory = new ItemStack[INV_SIZE];
+ private final ItemStack[] inventory = new ItemStack[INV_SIZE];
// declaration of variable:
- protected String uniqueID;
+ protected String uniqueID;
/**
* @param itemstack - the ItemStack to which this inventory belongs
*/
- public BaseInventoryBackpack(ItemStack stack)
+ public BaseInventoryBackpack(final ItemStack stack)
{
- invItem = stack;
+ this.invItem = stack;
/** initialize variable within the constructor: */
- uniqueID = "";
+ this.uniqueID = "";
if (!stack.hasTagCompound())
{
stack.setTagCompound(new NBTTagCompound());
// no tag compound means the itemstack does not yet have a UUID, so assign one:
- uniqueID = UUID.randomUUID().toString();
- }
-
+ this.uniqueID = UUID.randomUUID().toString();
+ }
+
// Create a new NBT Tag Compound if one doesn't already exist, or you will crash
if (!stack.hasTagCompound()) {
stack.setTagCompound(new NBTTagCompound());
@@ -53,75 +52,75 @@ public class BaseInventoryBackpack implements IInventory{
// either reference will change in the other
// Read the inventory contents from NBT
- readFromNBT(stack.getTagCompound());
+ this.readFromNBT(stack.getTagCompound());
}
@Override
public int getSizeInventory()
{
- return inventory.length;
+ return this.inventory.length;
}
@Override
- public ItemStack getStackInSlot(int slot)
+ public ItemStack getStackInSlot(final int slot)
{
- return inventory[slot];
+ return this.inventory[slot];
}
@Override
- public ItemStack decrStackSize(int slot, int amount)
+ public ItemStack decrStackSize(final int slot, final int amount)
{
- ItemStack stack = getStackInSlot(slot);
+ ItemStack stack = this.getStackInSlot(slot);
if(stack != null)
{
if(stack.stackSize > amount)
{
stack = stack.splitStack(amount);
// Don't forget this line or your inventory will not be saved!
- markDirty();
+ this.markDirty();
}
else
{
// this method also calls markDirty, so we don't need to call it again
- setInventorySlotContents(slot, null);
+ this.setInventorySlotContents(slot, null);
}
}
return stack;
}
@Override
- public ItemStack getStackInSlotOnClosing(int slot)
+ public ItemStack getStackInSlotOnClosing(final int slot)
{
- ItemStack stack = getStackInSlot(slot);
- setInventorySlotContents(slot, null);
+ final ItemStack stack = this.getStackInSlot(slot);
+ this.setInventorySlotContents(slot, null);
return stack;
}
@Override
- public void setInventorySlotContents(int slot, ItemStack stack)
+ public void setInventorySlotContents(final int slot, final ItemStack stack)
{
- inventory[slot] = stack;
+ this.inventory[slot] = stack;
- if (stack != null && stack.stackSize > getInventoryStackLimit())
+ if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit()))
{
- stack.stackSize = getInventoryStackLimit();
+ stack.stackSize = this.getInventoryStackLimit();
}
// Don't forget this line or your inventory will not be saved!
- markDirty();
+ this.markDirty();
}
// 1.7.2+ renamed to getInventoryName
@Override
public String getInventoryName()
{
- return name;
+ return this.name;
}
// 1.7.2+ renamed to hasCustomInventoryName
@Override
public boolean hasCustomInventoryName()
{
- return name.length() > 0;
+ return this.name.length() > 0;
}
@Override
@@ -139,19 +138,19 @@ public class BaseInventoryBackpack implements IInventory{
@Override
public void markDirty()
{
- for (int i = 0; i < getSizeInventory(); ++i)
+ for (int i = 0; i < this.getSizeInventory(); ++i)
{
- if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) {
- inventory[i] = null;
+ if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) {
+ this.inventory[i] = null;
}
}
- // This line here does the work:
- writeToNBT(invItem.getTagCompound());
+ // This line here does the work:
+ this.writeToNBT(this.invItem.getTagCompound());
}
@Override
- public boolean isUseableByPlayer(EntityPlayer entityplayer)
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer)
{
return true;
}
@@ -170,7 +169,7 @@ public class BaseInventoryBackpack implements IInventory{
* even when this returns false
*/
@Override
- public boolean isItemValidForSlot(int slot, ItemStack itemstack)
+ public boolean isItemValidForSlot(final int slot, final ItemStack itemstack)
{
// Don't want to be able to store the inventory item within itself
// Bad things will happen, like losing your inventory
@@ -181,32 +180,32 @@ public class BaseInventoryBackpack implements IInventory{
/**
* A custom method to read our inventory from an ItemStack's NBT compound
*/
- public void readFromNBT(NBTTagCompound compound)
+ public void readFromNBT(final NBTTagCompound compound)
{
// Gets the custom taglist we wrote to this compound, if any
// 1.7.2+ change to compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND);
- NBTTagList items = compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND);
-
- if ("".equals(uniqueID))
+ final NBTTagList items = compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND);
+
+ if ("".equals(this.uniqueID))
{
// try to read unique ID from NBT
- uniqueID = compound.getString("uniqueID");
+ this.uniqueID = compound.getString("uniqueID");
// if it's still "", assign a new one:
- if ("".equals(uniqueID))
+ if ("".equals(this.uniqueID))
{
- uniqueID = UUID.randomUUID().toString();
+ this.uniqueID = UUID.randomUUID().toString();
}
}
for (int i = 0; i < items.tagCount(); ++i)
{
// 1.7.2+ change to items.getCompoundTagAt(i)
- NBTTagCompound item = (NBTTagCompound) items.getCompoundTagAt(i);
- int slot = item.getInteger("Slot");
+ final NBTTagCompound item = items.getCompoundTagAt(i);
+ final int slot = item.getInteger("Slot");
// Just double-checking that the saved slot index is within our inventory array bounds
- if (slot >= 0 && slot < getSizeInventory()) {
- inventory[slot] = ItemStack.loadItemStackFromNBT(item);
+ if ((slot >= 0) && (slot < this.getSizeInventory())) {
+ this.inventory[slot] = ItemStack.loadItemStackFromNBT(item);
}
}
}
@@ -214,21 +213,21 @@ public class BaseInventoryBackpack implements IInventory{
/**
* A custom method to write our inventory to an ItemStack's NBT compound
*/
- public void writeToNBT(NBTTagCompound tagcompound)
+ public void writeToNBT(final NBTTagCompound tagcompound)
{
// Create a new NBT Tag List to store itemstacks as NBT Tags
- NBTTagList items = new NBTTagList();
+ final NBTTagList items = new NBTTagList();
- for (int i = 0; i < getSizeInventory(); ++i)
+ for (int i = 0; i < this.getSizeInventory(); ++i)
{
// Only write stacks that contain items
- if (getStackInSlot(i) != null)
+ if (this.getStackInSlot(i) != null)
{
// Make a new NBT Tag Compound to write the itemstack and slot index to
- NBTTagCompound item = new NBTTagCompound();
+ final NBTTagCompound item = new NBTTagCompound();
item.setInteger("Slot", i);
// Writes the itemstack in slot(i) to the Tag Compound we just made
- getStackInSlot(i).writeToNBT(item);
+ this.getStackInSlot(i).writeToNBT(item);
// add the tag compound to our tag list
items.appendTag(item);
diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryFishTrap.java b/src/Java/gtPlusPlus/core/inventories/InventoryFishTrap.java
index d3e2de8b99..429ff517c1 100644
--- a/src/Java/gtPlusPlus/core/inventories/InventoryFishTrap.java
+++ b/src/Java/gtPlusPlus/core/inventories/InventoryFishTrap.java
@@ -1,6 +1,5 @@
package gtPlusPlus.core.inventories;
-import gtPlusPlus.core.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@@ -9,113 +8,113 @@ import net.minecraft.nbt.NBTTagList;
public class InventoryFishTrap implements IInventory{
- private String name = "Fishtrap";
+ private final String name = "Fishtrap";
/** Defining your inventory size this way is handy */
public static final int INV_SIZE = 15;
/** Inventory's size must be same as number of slots you add to the Container class */
private ItemStack[] inventory = new ItemStack[INV_SIZE];
-
- public void readFromNBT(NBTTagCompound nbt){
- NBTTagList list = nbt.getTagList("Items", 10);
- inventory = 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){
- //Utils.LOG_INFO("Trying to read NBT data from inventory.");
- inventory[slot] = ItemStack.loadItemStackFromNBT(data);
- }
- }
- }
-
- public void writeToNBT(NBTTagCompound nbt){
- NBTTagList list = new NBTTagList();
- for(int i = 0;i<INV_SIZE;i++){
- ItemStack stack = inventory[i];
- if(stack != null){
- //Utils.LOG_INFO("Trying to write NBT data to inventory.");
- NBTTagCompound data = new NBTTagCompound();
- stack.writeToNBT(data);
- data.setInteger("Slot", i);
- list.appendTag(data);
- }
- }
- nbt.setTag("Items", list);
- }
-
+
+ public void readFromNBT(final NBTTagCompound nbt){
+ final NBTTagList list = nbt.getTagList("Items", 10);
+ this.inventory = new ItemStack[INV_SIZE];
+ for(int i = 0;i<list.tagCount();i++){
+ final NBTTagCompound data = list.getCompoundTagAt(i);
+ final int slot = data.getInteger("Slot");
+ if((slot >= 0) && (slot < INV_SIZE)){
+ //Utils.LOG_INFO("Trying to read NBT data from inventory.");
+ this.inventory[slot] = ItemStack.loadItemStackFromNBT(data);
+ }
+ }
+ }
+
+ public void writeToNBT(final NBTTagCompound nbt){
+ final NBTTagList list = new NBTTagList();
+ for(int i = 0;i<INV_SIZE;i++){
+ final ItemStack stack = this.inventory[i];
+ if(stack != null){
+ //Utils.LOG_INFO("Trying to write NBT data to inventory.");
+ final NBTTagCompound data = new NBTTagCompound();
+ stack.writeToNBT(data);
+ data.setInteger("Slot", i);
+ list.appendTag(data);
+ }
+ }
+ nbt.setTag("Items", list);
+ }
+
@Override
public int getSizeInventory()
{
- return inventory.length;
+ return this.inventory.length;
}
-
+
public ItemStack[] getInventory(){
- return inventory;
+ return this.inventory;
}
@Override
- public ItemStack getStackInSlot(int slot)
+ public ItemStack getStackInSlot(final int slot)
{
- return inventory[slot];
+ return this.inventory[slot];
}
@Override
- public ItemStack decrStackSize(int slot, int amount)
+ public ItemStack decrStackSize(final int slot, final int amount)
{
- ItemStack stack = getStackInSlot(slot);
+ ItemStack stack = this.getStackInSlot(slot);
if(stack != null)
{
if(stack.stackSize > amount)
{
stack = stack.splitStack(amount);
// Don't forget this line or your inventory will not be saved!
- markDirty();
+ this.markDirty();
}
else
{
// this method also calls markDirty, so we don't need to call it again
- setInventorySlotContents(slot, null);
+ this.setInventorySlotContents(slot, null);
}
}
return stack;
}
@Override
- public ItemStack getStackInSlotOnClosing(int slot)
+ public ItemStack getStackInSlotOnClosing(final int slot)
{
- ItemStack stack = getStackInSlot(slot);
- setInventorySlotContents(slot, null);
+ final ItemStack stack = this.getStackInSlot(slot);
+ this.setInventorySlotContents(slot, null);
return stack;
}
@Override
- public void setInventorySlotContents(int slot, ItemStack stack)
+ public void setInventorySlotContents(final int slot, final ItemStack stack)
{
- inventory[slot] = stack;
+ this.inventory[slot] = stack;
- if (stack != null && stack.stackSize > getInventoryStackLimit())
+ if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit()))
{
- stack.stackSize = getInventoryStackLimit();
+ stack.stackSize = this.getInventoryStackLimit();
}
// Don't forget this line or your inventory will not be saved!
- markDirty();
+ this.markDirty();
}
// 1.7.2+ renamed to getInventoryName
@Override
public String getInventoryName()
{
- return name;
+ return this.name;
}
// 1.7.2+ renamed to hasCustomInventoryName
@Override
public boolean hasCustomInventoryName()
{
- return name.length() > 0;
+ return this.name.length() > 0;
}
@Override
@@ -133,21 +132,21 @@ public class InventoryFishTrap implements IInventory{
@Override
public void markDirty()
{
- for (int i = 0; i < getSizeInventory(); ++i)
+ for (int i = 0; i < this.getSizeInventory(); ++i)
{
- ItemStack temp = getStackInSlot(i);
+ final ItemStack temp = this.getStackInSlot(i);
if (temp != null){
//Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize);
}
-
- if (temp != null && temp.stackSize == 0) {
- inventory[i] = null;
+
+ if ((temp != null) && (temp.stackSize == 0)) {
+ this.inventory[i] = null;
}
}
}
@Override
- public boolean isUseableByPlayer(EntityPlayer entityplayer)
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer)
{
return true;
}
@@ -166,7 +165,7 @@ public class InventoryFishTrap implements IInventory{
* even when this returns false
*/
@Override
- public boolean isItemValidForSlot(int slot, ItemStack itemstack)
+ public boolean isItemValidForSlot(final int slot, final ItemStack itemstack)
{
// Don't want to be able to store the inventory item within itself
// Bad things will happen, like losing your inventory
diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java
index 8d147ad21c..3ea5675ba2 100644
--- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java
+++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java
@@ -8,7 +8,7 @@ import net.minecraft.nbt.NBTTagList;
public class InventoryWorkbenchChest implements IInventory{
- private String name = "Inventory Chest";
+ private final String name = "Inventory Chest";
/** Defining your inventory size this way is handy */
public static final int INV_SIZE = 16;
@@ -20,113 +20,113 @@ public class InventoryWorkbenchChest implements IInventory{
* @param itemstack - the ItemStack to which this inventory belongs
*/
public InventoryWorkbenchChest()
- {
-
+ {
+
+ }
+
+ public void readFromNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = nbt.getTagList("Items", 10);
+ this.inventory = new ItemStack[INV_SIZE];
+ for(int i = 0;i<list.tagCount();i++)
+ {
+ final NBTTagCompound data = list.getCompoundTagAt(i);
+ final int slot = data.getInteger("Slot");
+ if((slot >= 0) && (slot < INV_SIZE))
+ {
+ this.inventory[slot] = ItemStack.loadItemStackFromNBT(data);
+ }
+ }
}
-
- public void readFromNBT(NBTTagCompound nbt)
- {
- NBTTagList list = nbt.getTagList("Items", 10);
- inventory = 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)
- {
- inventory[slot] = ItemStack.loadItemStackFromNBT(data);
- }
- }
- }
-
- public void writeToNBT(NBTTagCompound nbt)
- {
- NBTTagList list = new NBTTagList();
- for(int i = 0;i<INV_SIZE;i++)
- {
- ItemStack stack = inventory[i];
- if(stack != null)
- {
- NBTTagCompound data = new NBTTagCompound();
- stack.writeToNBT(data);
- data.setInteger("Slot", i);
- list.appendTag(data);
- }
- }
- nbt.setTag("Items", list);
- }
-
+
+ public void writeToNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = new NBTTagList();
+ for(int i = 0;i<INV_SIZE;i++)
+ {
+ final ItemStack stack = this.inventory[i];
+ if(stack != null)
+ {
+ final NBTTagCompound data = new NBTTagCompound();
+ stack.writeToNBT(data);
+ data.setInteger("Slot", i);
+ list.appendTag(data);
+ }
+ }
+ nbt.setTag("Items", list);
+ }
+
@Override
public int getSizeInventory()
{
- return inventory.length;
+ return this.inventory.length;
}
-
+
public ItemStack[] getInventory(){
- return inventory;
+ return this.inventory;
}
@Override
- public ItemStack getStackInSlot(int slot)
+ public ItemStack getStackInSlot(final int slot)
{
- return inventory[slot];
+ return this.inventory[slot];
}
@Override
- public ItemStack decrStackSize(int slot, int amount)
+ public ItemStack decrStackSize(final int slot, final int amount)
{
- ItemStack stack = getStackInSlot(slot);
+ ItemStack stack = this.getStackInSlot(slot);
if(stack != null)
{
if(stack.stackSize > amount)
{
stack = stack.splitStack(amount);
// Don't forget this line or your inventory will not be saved!
- markDirty();
+ this.markDirty();
}
else
{
// this method also calls markDirty, so we don't need to call it again
- setInventorySlotContents(slot, null);
+ this.setInventorySlotContents(slot, null);
}
}
return stack;
}
@Override
- public ItemStack getStackInSlotOnClosing(int slot)
+ public ItemStack getStackInSlotOnClosing(final int slot)
{
- ItemStack stack = getStackInSlot(slot);
- setInventorySlotContents(slot, null);
+ final ItemStack stack = this.getStackInSlot(slot);
+ this.setInventorySlotContents(slot, null);
return stack;
}
@Override
- public void setInventorySlotContents(int slot, ItemStack stack)
+ public void setInventorySlotContents(final int slot, final ItemStack stack)
{
- inventory[slot] = stack;
+ this.inventory[slot] = stack;
- if (stack != null && stack.stackSize > getInventoryStackLimit())
+ if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit()))
{
- stack.stackSize = getInventoryStackLimit();
+ stack.stackSize = this.getInventoryStackLimit();
}
// Don't forget this line or your inventory will not be saved!
- markDirty();
+ this.markDirty();
}
// 1.7.2+ renamed to getInventoryName
@Override
public String getInventoryName()
{
- return name;
+ return this.name;
}
// 1.7.2+ renamed to hasCustomInventoryName
@Override
public boolean hasCustomInventoryName()
{
- return name.length() > 0;
+ return this.name.length() > 0;
}
@Override
@@ -144,21 +144,21 @@ public class InventoryWorkbenchChest implements IInventory{
@Override
public void markDirty()
{
- for (int i = 0; i < getSizeInventory(); ++i)
+ for (int i = 0; i < this.getSizeInventory(); ++i)
{
- ItemStack temp = getStackInSlot(i);
+ final ItemStack temp = this.getStackInSlot(i);
if (temp != null){
//Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize);
}
-
- if (temp != null && temp.stackSize == 0) {
- inventory[i] = null;
+
+ if ((temp != null) && (temp.stackSize == 0)) {
+ this.inventory[i] = null;
}
}
}
@Override
- public boolean isUseableByPlayer(EntityPlayer entityplayer)
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer)
{
return true;
}
@@ -177,7 +177,7 @@ public class InventoryWorkbenchChest implements IInventory{
* even when this returns false
*/
@Override
- public boolean isItemValidForSlot(int slot, ItemStack itemstack)
+ public boolean isItemValidForSlot(final int slot, final ItemStack itemstack)
{
// Don't want to be able to store the inventory item within itself
// Bad things will happen, like losing your inventory
diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java
index 8c0738cab9..e86f21c559 100644
--- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java
+++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java
@@ -8,7 +8,7 @@ import net.minecraft.nbt.NBTTagList;
public class InventoryWorkbenchCrafting implements IInventory{
- private String name = "Inventory Crafting";
+ private final String name = "Inventory Crafting";
/** Defining your inventory size this way is handy */
public static final int INV_SIZE = 9;
@@ -17,133 +17,133 @@ public class InventoryWorkbenchCrafting implements IInventory{
private ItemStack[] inventory = new ItemStack[INV_SIZE];
public final InventoryCrafting craftMatrix;
public final Container parentContainer;
-
+
public InventoryCrafting getCrafting(){
- return craftMatrix;
+ return this.craftMatrix;
}
/**
* @param itemstack - the ItemStack to which this inventory belongs
*/
- public InventoryWorkbenchCrafting(Container containerR)
+ public InventoryWorkbenchCrafting(final Container containerR)
{
this.parentContainer = containerR;
- this.craftMatrix = new InventoryCrafting(parentContainer, 3, 3);
+ this.craftMatrix = new InventoryCrafting(this.parentContainer, 3, 3);
}
-
+
private ItemStack[] getArrayOfCraftingItems(){
- ItemStack[] array = new ItemStack[9];
- for (int i=0; i<craftMatrix.getSizeInventory();i++){
- if(craftMatrix.getStackInSlot(i) != null){
- array[i] = craftMatrix.getStackInSlot(i);
- }
- }
+ final ItemStack[] array = new ItemStack[9];
+ for (int i=0; i<this.craftMatrix.getSizeInventory();i++){
+ if(this.craftMatrix.getStackInSlot(i) != null){
+ array[i] = this.craftMatrix.getStackInSlot(i);
+ }
+ }
return array;
}
-
- public void readFromNBT(NBTTagCompound nbt)
- {
- NBTTagList list = nbt.getTagList("Items", 10);
- inventory = 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)
- {
- getInventory()[slot] = ItemStack.loadItemStackFromNBT(data);
- }
- }
- }
-
- public void writeToNBT(NBTTagCompound nbt)
- {
- NBTTagList list = new NBTTagList();
- for(int i = 0;i<INV_SIZE;i++)
- {
- ItemStack stack = getInventory()[i];
- if(stack != null)
- {
- NBTTagCompound data = new NBTTagCompound();
- stack.writeToNBT(data);
- data.setInteger("Slot", i);
- list.appendTag(data);
- }
- }
- nbt.setTag("Items", list);
- }
-
+
+ public void readFromNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = nbt.getTagList("Items", 10);
+ this.inventory = new ItemStack[INV_SIZE];
+ for(int i = 0;i<list.tagCount();i++)
+ {
+ final NBTTagCompound data = list.getCompoundTagAt(i);
+ final int slot = data.getInteger("Slot");
+ if((slot >= 0) && (slot < INV_SIZE))
+ {
+ this.getInventory()[slot] = ItemStack.loadItemStackFromNBT(data);
+ }
+ }
+ }
+
+ public void writeToNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = new NBTTagList();
+ for(int i = 0;i<INV_SIZE;i++)
+ {
+ final ItemStack stack = this.getInventory()[i];
+ if(stack != null)
+ {
+ final NBTTagCompound data = new NBTTagCompound();
+ stack.writeToNBT(data);
+ data.setInteger("Slot", i);
+ list.appendTag(data);
+ }
+ }
+ nbt.setTag("Items", list);
+ }
+
@Override
public int getSizeInventory()
{
- return getInventory().length;
+ return this.getInventory().length;
}
-
+
public ItemStack[] getInventory(){
- return getArrayOfCraftingItems();
+ return this.getArrayOfCraftingItems();
}
@Override
- public ItemStack getStackInSlot(int slot)
+ public ItemStack getStackInSlot(final int slot)
{
- return getInventory()[slot];
+ return this.getInventory()[slot];
}
@Override
- public ItemStack decrStackSize(int slot, int amount)
+ public ItemStack decrStackSize(final int slot, final int amount)
{
- ItemStack stack = getStackInSlot(slot);
+ ItemStack stack = this.getStackInSlot(slot);
if(stack != null)
{
if(stack.stackSize > amount)
{
stack = stack.splitStack(amount);
// Don't forget this line or your inventory will not be saved!
- markDirty();
+ this.markDirty();
}
else
{
// this method also calls markDirty, so we don't need to call it again
- setInventorySlotContents(slot, null);
+ this.setInventorySlotContents(slot, null);
}
}
return stack;
}
@Override
- public ItemStack getStackInSlotOnClosing(int slot)
+ public ItemStack getStackInSlotOnClosing(final int slot)
{
- ItemStack stack = getStackInSlot(slot);
- setInventorySlotContents(slot, null);
+ final ItemStack stack = this.getStackInSlot(slot);
+ this.setInventorySlotContents(slot, null);
return stack;
}
@Override
- public void setInventorySlotContents(int slot, ItemStack stack)
+ public void setInventorySlotContents(final int slot, final ItemStack stack)
{
- getInventory()[slot] = stack;
+ this.getInventory()[slot] = stack;
- if (stack != null && stack.stackSize > getInventoryStackLimit())
+ if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit()))
{
- stack.stackSize = getInventoryStackLimit();
+ stack.stackSize = this.getInventoryStackLimit();
}
// Don't forget this line or your inventory will not be saved!
- markDirty();
+ this.markDirty();
}
// 1.7.2+ renamed to getInventoryName
@Override
public String getInventoryName()
{
- return name;
+ return this.name;
}
// 1.7.2+ renamed to hasCustomInventoryName
@Override
public boolean hasCustomInventoryName()
{
- return name.length() > 0;
+ return this.name.length() > 0;
}
@Override
@@ -161,16 +161,16 @@ public class InventoryWorkbenchCrafting implements IInventory{
@Override
public void markDirty()
{
- for (int i = 0; i < getSizeInventory(); ++i)
+ for (int i = 0; i < this.getSizeInventory(); ++i)
{
- if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) {
- getInventory()[i] = null;
+ if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) {
+ this.getInventory()[i] = null;
}
}
}
@Override
- public boolean isUseableByPlayer(EntityPlayer entityplayer)
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer)
{
return true;
}
@@ -189,7 +189,7 @@ public class InventoryWorkbenchCrafting implements IInventory{
* even when this returns false
*/
@Override
- public boolean isItemValidForSlot(int slot, ItemStack itemstack)
+ public boolean isItemValidForSlot(final int slot, final ItemStack itemstack)
{
// Don't want to be able to store the inventory item within itself
// Bad things will happen, like losing your inventory
diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java
index f4fe78d458..432a425a9b 100644
--- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java
+++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java
@@ -6,19 +6,19 @@ import net.minecraft.item.ItemStack;
public class InventoryWorkbenchHoloCrafting implements IInventory{
- private String name = "Inventory Crafting";
+ private final String name = "Inventory Crafting";
/** Defining your inventory size this way is handy */
public static final int INV_SIZE = 9;
/** Inventory's size must be same as number of slots you add to the Container class */
- private ItemStack[] inventory = new ItemStack[INV_SIZE];
+ private final ItemStack[] inventory = new ItemStack[INV_SIZE];
/**
* @param itemstack - the ItemStack to which this inventory belongs
*/
public InventoryWorkbenchHoloCrafting()
- {
+ {
}
@@ -57,67 +57,67 @@ public class InventoryWorkbenchHoloCrafting implements IInventory{
@Override
public int getSizeInventory()
{
- return inventory.length;
+ return this.inventory.length;
}
public ItemStack[] getInventory(){
- return inventory;
+ return this.inventory;
}
@Override
- public ItemStack getStackInSlot(int slot)
+ public ItemStack getStackInSlot(final int slot)
{
- return inventory[slot];
+ return this.inventory[slot];
}
@Override
- public ItemStack decrStackSize(int slot, int amount)
+ public ItemStack decrStackSize(final int slot, final int amount)
{
- ItemStack stack = getStackInSlot(slot);
+ ItemStack stack = this.getStackInSlot(slot);
if(stack != null)
{
if(stack.stackSize > amount)
{
stack = stack.splitStack(amount);
- markDirty();
+ this.markDirty();
}
else
{
- setInventorySlotContents(slot, null);
+ this.setInventorySlotContents(slot, null);
}
}
return stack;
}
@Override
- public ItemStack getStackInSlotOnClosing(int slot)
+ public ItemStack getStackInSlotOnClosing(final int slot)
{
- ItemStack stack = getStackInSlot(slot);
- setInventorySlotContents(slot, null);
+ final ItemStack stack = this.getStackInSlot(slot);
+ this.setInventorySlotContents(slot, null);
return stack;
}
@Override
- public void setInventorySlotContents(int slot, ItemStack stack)
+ public void setInventorySlotContents(final int slot, final ItemStack stack)
{
- inventory[slot] = stack;
- if (stack != null && stack.stackSize > getInventoryStackLimit())
+ this.inventory[slot] = stack;
+ if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit()))
{
- stack.stackSize = getInventoryStackLimit();
+ stack.stackSize = this.getInventoryStackLimit();
}
- markDirty();
+ this.markDirty();
}
@Override
public String getInventoryName()
{
- return name;
+ return this.name;
}
@Override
public boolean hasCustomInventoryName()
{
- return name.length() > 0;
+ return this.name.length() > 0;
}
@Override
@@ -129,21 +129,21 @@ public class InventoryWorkbenchHoloCrafting implements IInventory{
@Override
public void markDirty()
{
- for (int i = 0; i < getSizeInventory(); ++i)
+ for (int i = 0; i < this.getSizeInventory(); ++i)
{
- ItemStack temp = getStackInSlot(i);
+ final ItemStack temp = this.getStackInSlot(i);
if (temp != null){
//Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize);
}
- if (temp != null && temp.stackSize == 0) {
- inventory[i] = null;
+ if ((temp != null) && (temp.stackSize == 0)) {
+ this.inventory[i] = null;
}
}
}
@Override
- public boolean isUseableByPlayer(EntityPlayer entityplayer)
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer)
{
return true;
}
@@ -156,7 +156,7 @@ public class InventoryWorkbenchHoloCrafting implements IInventory{
@Override
- public boolean isItemValidForSlot(int slot, ItemStack itemstack)
+ public boolean isItemValidForSlot(final int slot, final ItemStack itemstack)
{
return true;
}
diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java
index c5da273a11..acec3f35ea 100644
--- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java
+++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java
@@ -10,11 +10,11 @@ import net.minecraft.nbt.NBTTagList;
public class InventoryWorkbenchHoloSlots implements IInventory{
- private String name = "Inventory Holo";
+ private final String name = "Inventory Holo";
//Output Slot
public IInventory craftResult = new InventoryCraftResult();
-
+
/** Defining your inventory size this way is handy */
public static final int INV_SIZE = 6;
@@ -29,30 +29,30 @@ public class InventoryWorkbenchHoloSlots implements IInventory{
}
- public void readFromNBT(NBTTagCompound nbt)
+ public void readFromNBT(final NBTTagCompound nbt)
{
- NBTTagList list = nbt.getTagList("Items", 10);
- inventory = new ItemStack[INV_SIZE];
+ final NBTTagList list = nbt.getTagList("Items", 10);
+ this.inventory = new ItemStack[INV_SIZE];
for(int i = 0;i<list.tagCount();i++)
{
- NBTTagCompound data = list.getCompoundTagAt(i);
- int slot = data.getInteger("Slot");
- if(slot >= 1 && slot < INV_SIZE)
+ final NBTTagCompound data = list.getCompoundTagAt(i);
+ final int slot = data.getInteger("Slot");
+ if((slot >= 1) && (slot < INV_SIZE))
{
- inventory[slot] = ItemStack.loadItemStackFromNBT(data);
+ this.inventory[slot] = ItemStack.loadItemStackFromNBT(data);
}
}
}
- public void writeToNBT(NBTTagCompound nbt)
+ public void writeToNBT(final NBTTagCompound nbt)
{
- NBTTagList list = new NBTTagList();
+ final NBTTagList list = new NBTTagList();
for(int i = 0;i<INV_SIZE;i++)
{
- ItemStack stack = inventory[i];
- if(stack != null && i != 0)
+ final ItemStack stack = this.inventory[i];
+ if((stack != null) && (i != 0))
{
- NBTTagCompound data = new NBTTagCompound();
+ final NBTTagCompound data = new NBTTagCompound();
stack.writeToNBT(data);
data.setInteger("Slot", i);
list.appendTag(data);
@@ -64,45 +64,45 @@ public class InventoryWorkbenchHoloSlots implements IInventory{
@Override
public int getSizeInventory()
{
- return inventory.length;
+ return this.inventory.length;
}
public ItemStack[] getInventory(){
- return inventory;
+ return this.inventory;
}
@Override
- public ItemStack getStackInSlot(int slot)
+ public ItemStack getStackInSlot(final int slot)
{
- return inventory[slot];
+ return this.inventory[slot];
}
@Override
- public void setInventorySlotContents(int slot, ItemStack stack)
+ public void setInventorySlotContents(final int slot, final ItemStack stack)
{
- inventory[slot] = stack;
+ this.inventory[slot] = stack;
- if (stack != null && stack.stackSize > getInventoryStackLimit())
+ if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit()))
{
- stack.stackSize = getInventoryStackLimit();
+ stack.stackSize = this.getInventoryStackLimit();
}
// Don't forget this line or your inventory will not be saved!
- markDirty();
+ this.markDirty();
}
// 1.7.2+ renamed to getInventoryName
@Override
public String getInventoryName()
{
- return name;
+ return this.name;
}
// 1.7.2+ renamed to hasCustomInventoryName
@Override
public boolean hasCustomInventoryName()
{
- return name.length() > 0;
+ return this.name.length() > 0;
}
@Override
@@ -120,16 +120,16 @@ public class InventoryWorkbenchHoloSlots implements IInventory{
@Override
public void markDirty()
{
- for (int i = 0; i < getSizeInventory(); ++i)
+ for (int i = 0; i < this.getSizeInventory(); ++i)
{
- if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) {
- inventory[i] = null;
+ if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) {
+ this.inventory[i] = null;
}
}
}
@Override
- public boolean isUseableByPlayer(EntityPlayer entityplayer)
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer)
{
return true;
}
@@ -148,13 +148,13 @@ public class InventoryWorkbenchHoloSlots implements IInventory{
* even when this returns false
*/
@Override
- public boolean isItemValidForSlot(int slot, ItemStack itemstack)
- {
+ public boolean isItemValidForSlot(final int slot, final ItemStack itemstack)
+ {
return false;
}
/** A list of one item containing the result of the crafting formula */
- private ItemStack[] stackResult = new ItemStack[1];
+ private final ItemStack[] stackResult = new ItemStack[1];
/**
* Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a
@@ -187,17 +187,17 @@ public class InventoryWorkbenchHoloSlots implements IInventory{
return stack;
}*/
@Override
- public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_)
- {
- if (getStackInSlot(0) != null){
- Utils.LOG_INFO("getStackInSlot(0) contains "+getStackInSlot(0).getDisplayName());
+ public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_)
+ {
+ if (this.getStackInSlot(0) != null){
+ Utils.LOG_INFO("getStackInSlot(0) contains "+this.getStackInSlot(0).getDisplayName());
if (this.stackResult[0] == null){
Utils.LOG_INFO("this.stackResult[0] == null");
- this.stackResult[0] = getStackInSlot(0);
+ this.stackResult[0] = this.getStackInSlot(0);
}
else if (this.stackResult[0] != null){
Utils.LOG_INFO("this.stackResult[0] != null");
- if (this.stackResult[0].getDisplayName().toLowerCase().equals(getStackInSlot(0).getDisplayName().toLowerCase())){
+ if (this.stackResult[0].getDisplayName().toLowerCase().equals(this.getStackInSlot(0).getDisplayName().toLowerCase())){
Utils.LOG_INFO("Items are the same?");
}
else {
@@ -205,27 +205,27 @@ public class InventoryWorkbenchHoloSlots implements IInventory{
}
}
}
-
- if (this.stackResult[0] != null)
- {
+
+ if (this.stackResult[0] != null)
+ {
Utils.LOG_INFO("this.stackResult[0] != null - Really never should be though. - Returning "+this.stackResult[0].getDisplayName());
- ItemStack itemstack = this.stackResult[0];
- this.stackResult[0] = null;
- return itemstack;
- }
+ final ItemStack itemstack = this.stackResult[0];
+ this.stackResult[0] = null;
+ return itemstack;
+ }
return null;
- }
+ }
/**
* When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem -
* like when you close a workbench GUI.
*/
@Override
- public ItemStack getStackInSlotOnClosing(int p_70304_1_)
+ public ItemStack getStackInSlotOnClosing(final int p_70304_1_)
{
if (this.stackResult[0] != null)
{
- ItemStack itemstack = this.stackResult[0];
+ final ItemStack itemstack = this.stackResult[0];
this.stackResult[0] = null;
return itemstack;
}
diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java
index 7e3e7c3aef..c7ff680cbc 100644
--- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java
+++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java
@@ -9,7 +9,7 @@ import net.minecraft.nbt.NBTTagList;
public class InventoryWorkbenchTools implements IInventory{
- private String name = "Inventory Tools";
+ private final String name = "Inventory Tools";
/** Defining your inventory size this way is handy */
public static final int INV_SIZE = 5;
@@ -22,112 +22,112 @@ public class InventoryWorkbenchTools implements IInventory{
*/
public InventoryWorkbenchTools()
{
-
+
+ }
+
+ public void readFromNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = nbt.getTagList("Items", 10);
+ this.inventory = new ItemStack[INV_SIZE];
+ for(int i = 0;i<list.tagCount();i++)
+ {
+ final NBTTagCompound data = list.getCompoundTagAt(i);
+ final int slot = data.getInteger("Slot");
+ if((slot >= 0) && (slot < INV_SIZE))
+ {
+ this.inventory[slot] = ItemStack.loadItemStackFromNBT(data);
+ }
+ }
}
-
- public void readFromNBT(NBTTagCompound nbt)
- {
- NBTTagList list = nbt.getTagList("Items", 10);
- inventory = 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)
- {
- inventory[slot] = ItemStack.loadItemStackFromNBT(data);
- }
- }
- }
-
- public void writeToNBT(NBTTagCompound nbt)
- {
- NBTTagList list = new NBTTagList();
- for(int i = 0;i<INV_SIZE;i++)
- {
- ItemStack stack = inventory[i];
- if(stack != null)
- {
- NBTTagCompound data = new NBTTagCompound();
- stack.writeToNBT(data);
- data.setInteger("Slot", i);
- list.appendTag(data);
- }
- }
- nbt.setTag("Items", list);
- }
-
+
+ public void writeToNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = new NBTTagList();
+ for(int i = 0;i<INV_SIZE;i++)
+ {
+ final ItemStack stack = this.inventory[i];
+ if(stack != null)
+ {
+ final NBTTagCompound data = new NBTTagCompound();
+ stack.writeToNBT(data);
+ data.setInteger("Slot", i);
+ list.appendTag(data);
+ }
+ }
+ nbt.setTag("Items", list);
+ }
+
@Override
public int getSizeInventory()
{
- return inventory.length;
+ return this.inventory.length;
}
-
+
public ItemStack[] getInventory(){
- return inventory;
+ return this.inventory;
}
@Override
- public ItemStack getStackInSlot(int slot)
+ public ItemStack getStackInSlot(final int slot)
{
- return inventory[slot];
+ return this.inventory[slot];
}
@Override
- public ItemStack decrStackSize(int slot, int amount)
+ public ItemStack decrStackSize(final int slot, final int amount)
{
- ItemStack stack = getStackInSlot(slot);
+ ItemStack stack = this.getStackInSlot(slot);
if(stack != null)
{
if(stack.stackSize > amount)
{
stack = stack.splitStack(amount);
// Don't forget this line or your inventory will not be saved!
- markDirty();
+ this.markDirty();
}
else
{
// this method also calls markDirty, so we don't need to call it again
- setInventorySlotContents(slot, null);
+ this.setInventorySlotContents(slot, null);
}
}
return stack;
}
@Override
- public ItemStack getStackInSlotOnClosing(int slot)
+ public ItemStack getStackInSlotOnClosing(final int slot)
{
- ItemStack stack = getStackInSlot(slot);
- setInventorySlotContents(slot, null);
+ final ItemStack stack = this.getStackInSlot(slot);
+ this.setInventorySlotContents(slot, null);
return stack;
}
@Override
- public void setInventorySlotContents(int slot, ItemStack stack)
+ public void setInventorySlotContents(final int slot, final ItemStack stack)
{
- inventory[slot] = stack;
+ this.inventory[slot] = stack;
- if (stack != null && stack.stackSize > getInventoryStackLimit())
+ if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit()))
{
- stack.stackSize = getInventoryStackLimit();
+ stack.stackSize = this.getInventoryStackLimit();
}
// Don't forget this line or your inventory will not be saved!
- markDirty();
+ this.markDirty();
}
// 1.7.2+ renamed to getInventoryName
@Override
public String getInventoryName()
{
- return name;
+ return this.name;
}
// 1.7.2+ renamed to hasCustomInventoryName
@Override
public boolean hasCustomInventoryName()
{
- return name.length() > 0;
+ return this.name.length() > 0;
}
@Override
@@ -145,16 +145,16 @@ public class InventoryWorkbenchTools implements IInventory{
@Override
public void markDirty()
{
- for (int i = 0; i < getSizeInventory(); ++i)
+ for (int i = 0; i < this.getSizeInventory(); ++i)
{
- if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) {
- inventory[i] = null;
+ if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) {
+ this.inventory[i] = null;
}
}
}
@Override
- public boolean isUseableByPlayer(EntityPlayer entityplayer)
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer)
{
return true;
}
@@ -173,15 +173,15 @@ public class InventoryWorkbenchTools implements IInventory{
* even when this returns false
*/
@Override
- public boolean isItemValidForSlot(int slot, ItemStack itemstack)
+ public boolean isItemValidForSlot(final int slot, final ItemStack itemstack)
{
// Don't want to be able to store the inventory item within itself
// Bad things will happen, like losing your inventory
// Actually, this needs a custom Slot to work
if (itemstack.getItem() instanceof GT_MetaGenerated_Tool){
return true;
- }
+ }
return false;
}
-
+
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java
index 77f3351e59..1cc3f45844 100644
--- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java
+++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java
@@ -12,126 +12,126 @@ import net.minecraft.nbt.NBTTagList;
public class InventoryWorkbenchToolsElectric implements IInventory{
- private String name = "Inventory Tools";
+ private final String name = "Inventory Tools";
/** Defining your inventory size this way is handy */
public static final int INV_SIZE = 5;
/** Inventory's size must be same as number of slots you add to the Container class */
private ItemStack[] inventory = new ItemStack[INV_SIZE];
- private Slot[] toolSlots = new SlotGtToolElectric[INV_SIZE]; //TODO
+ private final Slot[] toolSlots = new SlotGtToolElectric[INV_SIZE]; //TODO
/**
* @param itemstack - the ItemStack to which this inventory belongs
*/
public InventoryWorkbenchToolsElectric()
{
-
+
+ }
+
+ public void readFromNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = nbt.getTagList("Items", 10);
+ this.inventory = new ItemStack[INV_SIZE];
+ for(int i = 0;i<list.tagCount();i++)
+ {
+ final NBTTagCompound data = list.getCompoundTagAt(i);
+ final int slot = data.getInteger("Slot");
+ if((slot >= 0) && (slot < INV_SIZE))
+ {
+ this.inventory[slot] = ItemStack.loadItemStackFromNBT(data);
+ }
+ }
}
-
- public void readFromNBT(NBTTagCompound nbt)
- {
- NBTTagList list = nbt.getTagList("Items", 10);
- inventory = 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)
- {
- inventory[slot] = ItemStack.loadItemStackFromNBT(data);
- }
- }
- }
-
- public void writeToNBT(NBTTagCompound nbt)
- {
- NBTTagList list = new NBTTagList();
- for(int i = 0;i<INV_SIZE;i++)
- {
- ItemStack stack = inventory[i];
- if(stack != null)
- {
- NBTTagCompound data = new NBTTagCompound();
- stack.writeToNBT(data);
- data.setInteger("Slot", i);
- list.appendTag(data);
- }
- }
- nbt.setTag("Items", list);
- }
-
+
+ public void writeToNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = new NBTTagList();
+ for(int i = 0;i<INV_SIZE;i++)
+ {
+ final ItemStack stack = this.inventory[i];
+ if(stack != null)
+ {
+ final NBTTagCompound data = new NBTTagCompound();
+ stack.writeToNBT(data);
+ data.setInteger("Slot", i);
+ list.appendTag(data);
+ }
+ }
+ nbt.setTag("Items", list);
+ }
+
@Override
public int getSizeInventory()
{
- return inventory.length;
+ return this.inventory.length;
}
-
+
public ItemStack[] getInventory(){
- return inventory;
+ return this.inventory;
}
@Override
- public ItemStack getStackInSlot(int slot)
+ public ItemStack getStackInSlot(final int slot)
{
- return inventory[slot];
+ return this.inventory[slot];
}
@Override
- public ItemStack decrStackSize(int slot, int amount)
+ public ItemStack decrStackSize(final int slot, final int amount)
{
- ItemStack stack = getStackInSlot(slot);
+ ItemStack stack = this.getStackInSlot(slot);
if(stack != null)
{
if(stack.stackSize > amount)
{
stack = stack.splitStack(amount);
// Don't forget this line or your inventory will not be saved!
- markDirty();
+ this.markDirty();
}
else
{
// this method also calls markDirty, so we don't need to call it again
- setInventorySlotContents(slot, null);
+ this.setInventorySlotContents(slot, null);
}
}
return stack;
}
@Override
- public ItemStack getStackInSlotOnClosing(int slot)
+ public ItemStack getStackInSlotOnClosing(final int slot)
{
- ItemStack stack = getStackInSlot(slot);
- setInventorySlotContents(slot, null);
+ final ItemStack stack = this.getStackInSlot(slot);
+ this.setInventorySlotContents(slot, null);
return stack;
}
@Override
- public void setInventorySlotContents(int slot, ItemStack stack)
+ public void setInventorySlotContents(final int slot, final ItemStack stack)
{
- inventory[slot] = stack;
+ this.inventory[slot] = stack;
- if (stack != null && stack.stackSize > getInventoryStackLimit())
+ if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit()))
{
- stack.stackSize = getInventoryStackLimit();
+ stack.stackSize = this.getInventoryStackLimit();
}
// Don't forget this line or your inventory will not be saved!
- markDirty();
+ this.markDirty();
}
// 1.7.2+ renamed to getInventoryName
@Override
public String getInventoryName()
{
- return name;
+ return this.name;
}
// 1.7.2+ renamed to hasCustomInventoryName
@Override
public boolean hasCustomInventoryName()
{
- return name.length() > 0;
+ return this.name.length() > 0;
}
@Override
@@ -149,16 +149,16 @@ public class InventoryWorkbenchToolsElectric implements IInventory{
@Override
public void markDirty()
{
- for (int i = 0; i < getSizeInventory(); ++i)
+ for (int i = 0; i < this.getSizeInventory(); ++i)
{
- if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) {
- inventory[i] = null;
+ if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) {
+ this.inventory[i] = null;
}
}
}
@Override
- public boolean isUseableByPlayer(EntityPlayer entityplayer)
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer)
{
return true;
}
@@ -177,15 +177,15 @@ public class InventoryWorkbenchToolsElectric implements IInventory{
* even when this returns false
*/
@Override
- public boolean isItemValidForSlot(int slot, ItemStack itemstack)
+ public boolean isItemValidForSlot(final int slot, final ItemStack itemstack)
{
// Don't want to be able to store the inventory item within itself
// Bad things will happen, like losing your inventory
// Actually, this needs a custom Slot to work
- if (itemstack.getItem() instanceof GT_MetaGenerated_Tool || itemstack.getItem() instanceof IElectricItem){
+ if ((itemstack.getItem() instanceof GT_MetaGenerated_Tool) || (itemstack.getItem() instanceof IElectricItem)){
return true;
- }
+ }
return false;
}
-
+
} \ No newline at end of file