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)<