aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/slots
diff options
context:
space:
mode:
authordraknyte1 <draknyte1@hotmail.com>2016-11-04 15:23:26 +1000
committerdraknyte1 <draknyte1@hotmail.com>2016-11-04 15:23:26 +1000
commit0669f5eb9d5029a8b94ec552171b0837605f7747 (patch)
tree6b40e64c04d51b7a33cf2f0b35f7232cf37c4247 /src/Java/gtPlusPlus/core/slots
parent3654052fb63a571c5eaca7f20714b87c17f7e966 (diff)
downloadGT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.gz
GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.bz2
GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.zip
$ Cleaned up the entire project.
> Much neat, very nices.
Diffstat (limited to 'src/Java/gtPlusPlus/core/slots')
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotBlueprint.java22
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotCrafting.java282
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotFrame.java12
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotGeneric.java12
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotGtTool.java22
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java74
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java9
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotNoInput.java12
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotOutput.java92
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotRTG.java12
10 files changed, 262 insertions, 287 deletions
diff --git a/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java b/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java
index 3c5c30966e..2a97b82d4a 100644
--- a/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java
+++ b/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java
@@ -6,25 +6,25 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-public class SlotBlueprint extends Slot{
+public class SlotBlueprint extends Slot {
- public SlotBlueprint(IInventory inventory, int x, int y, int z) {
+ public SlotBlueprint(final IInventory inventory, final int x, final int y, final int z) {
super(inventory, x, y, z);
}
@Override
- public boolean isItemValid(ItemStack itemstack) {
- if (itemstack.getItem() instanceof IItemBlueprint){
- Utils.LOG_WARNING(itemstack.getDisplayName()+" is a valid Blueprint.");
- return true;
- }
- Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Blueprint.");
- return false;
+ public int getSlotStackLimit() {
+ return 1;
}
@Override
- public int getSlotStackLimit() {
- return 1;
+ public boolean isItemValid(final ItemStack itemstack) {
+ if (itemstack.getItem() instanceof IItemBlueprint) {
+ Utils.LOG_WARNING(itemstack.getDisplayName() + " is a valid Blueprint.");
+ return true;
+ }
+ Utils.LOG_WARNING(itemstack.getDisplayName() + " is not a valid Blueprint.");
+ return false;
}
}
diff --git a/src/Java/gtPlusPlus/core/slots/SlotCrafting.java b/src/Java/gtPlusPlus/core/slots/SlotCrafting.java
index 78e8157459..498748cf94 100644
--- a/src/Java/gtPlusPlus/core/slots/SlotCrafting.java
+++ b/src/Java/gtPlusPlus/core/slots/SlotCrafting.java
@@ -11,150 +11,140 @@ import net.minecraft.stats.AchievementList;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
-public class SlotCrafting extends Slot
-{
- /** The craft matrix inventory linked to this result slot. */
- private final IInventory craftMatrix;
- /** The player that is using the GUI where this slot resides. */
- private EntityPlayer thePlayer;
- /** The number of items that have been crafted so far. Gets passed to ItemStack.onCrafting before being reset. */
- private int amountCrafted;
- private static final String __OBFID = "CL_00001761";
-
- public SlotCrafting(EntityPlayer p_i1823_1_, IInventory p_i1823_2_, IInventory p_i1823_3_, int p_i1823_4_, int p_i1823_5_, int p_i1823_6_)
- {
- super(p_i1823_3_, p_i1823_4_, p_i1823_5_, p_i1823_6_);
- this.thePlayer = p_i1823_1_;
- this.craftMatrix = p_i1823_2_;
- }
-
- /**
- * Check if the stack is a valid item for this slot. Always true beside for the armor slots.
- */
- public boolean isItemValid(ItemStack p_75214_1_)
- {
- return false;
- }
-
- /**
- * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new
- * stack.
- */
- public ItemStack decrStackSize(int p_75209_1_)
- {
- if (this.getHasStack())
- {
- this.amountCrafted += Math.min(p_75209_1_, this.getStack().stackSize);
- }
-
- return super.decrStackSize(p_75209_1_);
- }
-
- /**
- * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an
- * internal count then calls onCrafting(item).
- */
- protected void onCrafting(ItemStack p_75210_1_, int p_75210_2_)
- {
- this.amountCrafted += p_75210_2_;
- this.onCrafting(p_75210_1_);
- }
-
- /**
- * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
- */
- protected void onCrafting(ItemStack p_75208_1_)
- {
- p_75208_1_.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted);
- this.amountCrafted = 0;
-
- if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.crafting_table))
- {
- this.thePlayer.addStat(AchievementList.buildWorkBench, 1);
- }
-
- if (p_75208_1_.getItem() instanceof ItemPickaxe)
- {
- this.thePlayer.addStat(AchievementList.buildPickaxe, 1);
- }
-
- if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.furnace))
- {
- this.thePlayer.addStat(AchievementList.buildFurnace, 1);
- }
-
- if (p_75208_1_.getItem() instanceof ItemHoe)
- {
- this.thePlayer.addStat(AchievementList.buildHoe, 1);
- }
-
- if (p_75208_1_.getItem() == Items.bread)
- {
- this.thePlayer.addStat(AchievementList.makeBread, 1);
- }
-
- if (p_75208_1_.getItem() == Items.cake)
- {
- this.thePlayer.addStat(AchievementList.bakeCake, 1);
- }
-
- if (p_75208_1_.getItem() instanceof ItemPickaxe && ((ItemPickaxe)p_75208_1_.getItem()).func_150913_i() != Item.ToolMaterial.WOOD)
- {
- this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1);
- }
-
- if (p_75208_1_.getItem() instanceof ItemSword)
- {
- this.thePlayer.addStat(AchievementList.buildSword, 1);
- }
-
- if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.enchanting_table))
- {
- this.thePlayer.addStat(AchievementList.enchantments, 1);
- }
-
- if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.bookshelf))
- {
- this.thePlayer.addStat(AchievementList.bookcase, 1);
- }
- }
-
- public void onPickupFromSlot(EntityPlayer p_82870_1_, ItemStack p_82870_2_)
- {
- FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, craftMatrix);
- this.onCrafting(p_82870_2_);
-
- for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i)
- {
- ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i);
-
- if (itemstack1 != null)
- {
- this.craftMatrix.decrStackSize(i, 1);
-
- if (itemstack1.getItem().hasContainerItem(itemstack1))
- {
- ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1);
-
- if (itemstack2 != null && itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage())
- {
- MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2));
- continue;
- }
-
- if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2))
- {
- if (this.craftMatrix.getStackInSlot(i) == null)
- {
- this.craftMatrix.setInventorySlotContents(i, itemstack2);
- }
- else
- {
- this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false);
- }
- }
- }
- }
- }
- }
+public class SlotCrafting extends Slot {
+ private static final String __OBFID = "CL_00001761";
+ /** The craft matrix inventory linked to this result slot. */
+ private final IInventory craftMatrix;
+ /** The player that is using the GUI where this slot resides. */
+ private final EntityPlayer thePlayer;
+ /**
+ * The number of items that have been crafted so far. Gets passed to
+ * ItemStack.onCrafting before being reset.
+ */
+ private int amountCrafted;
+
+ public SlotCrafting(final EntityPlayer p_i1823_1_, final IInventory p_i1823_2_, final IInventory p_i1823_3_,
+ final int p_i1823_4_, final int p_i1823_5_, final int p_i1823_6_) {
+ super(p_i1823_3_, p_i1823_4_, p_i1823_5_, p_i1823_6_);
+ this.thePlayer = p_i1823_1_;
+ this.craftMatrix = p_i1823_2_;
+ }
+
+ /**
+ * Decrease the size of the stack in slot (first int arg) by the amount of
+ * the second int arg. Returns the new stack.
+ */
+ @Override
+ public ItemStack decrStackSize(final int p_75209_1_) {
+ if (this.getHasStack()) {
+ this.amountCrafted += Math.min(p_75209_1_, this.getStack().stackSize);
+ }
+
+ return super.decrStackSize(p_75209_1_);
+ }
+
+ /**
+ * Check if the stack is a valid item for this slot. Always true beside for
+ * the armor slots.
+ */
+ @Override
+ public boolean isItemValid(final ItemStack p_75214_1_) {
+ return false;
+ }
+
+ /**
+ * the itemStack passed in is the output - ie, iron ingots, and pickaxes,
+ * not ore and wood.
+ */
+ @Override
+ protected void onCrafting(final ItemStack p_75208_1_) {
+ p_75208_1_.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted);
+ this.amountCrafted = 0;
+
+ if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.crafting_table)) {
+ this.thePlayer.addStat(AchievementList.buildWorkBench, 1);
+ }
+
+ if (p_75208_1_.getItem() instanceof ItemPickaxe) {
+ this.thePlayer.addStat(AchievementList.buildPickaxe, 1);
+ }
+
+ if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.furnace)) {
+ this.thePlayer.addStat(AchievementList.buildFurnace, 1);
+ }
+
+ if (p_75208_1_.getItem() instanceof ItemHoe) {
+ this.thePlayer.addStat(AchievementList.buildHoe, 1);
+ }
+
+ if (p_75208_1_.getItem() == Items.bread) {
+ this.thePlayer.addStat(AchievementList.makeBread, 1);
+ }
+
+ if (p_75208_1_.getItem() == Items.cake) {
+ this.thePlayer.addStat(AchievementList.bakeCake, 1);
+ }
+
+ if (p_75208_1_.getItem() instanceof ItemPickaxe
+ && ((ItemPickaxe) p_75208_1_.getItem()).func_150913_i() != Item.ToolMaterial.WOOD) {
+ this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1);
+ }
+
+ if (p_75208_1_.getItem() instanceof ItemSword) {
+ this.thePlayer.addStat(AchievementList.buildSword, 1);
+ }
+
+ if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.enchanting_table)) {
+ this.thePlayer.addStat(AchievementList.enchantments, 1);
+ }
+
+ if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.bookshelf)) {
+ this.thePlayer.addStat(AchievementList.bookcase, 1);
+ }
+ }
+
+ /**
+ * the itemStack passed in is the output - ie, iron ingots, and pickaxes,
+ * not ore and wood. Typically increases an internal count then calls
+ * onCrafting(item).
+ */
+ @Override
+ protected void onCrafting(final ItemStack p_75210_1_, final int p_75210_2_) {
+ this.amountCrafted += p_75210_2_;
+ this.onCrafting(p_75210_1_);
+ }
+
+ @Override
+ public void onPickupFromSlot(final EntityPlayer p_82870_1_, final ItemStack p_82870_2_) {
+ FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, this.craftMatrix);
+ this.onCrafting(p_82870_2_);
+
+ for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) {
+ final ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i);
+
+ if (itemstack1 != null) {
+ this.craftMatrix.decrStackSize(i, 1);
+
+ if (itemstack1.getItem().hasContainerItem(itemstack1)) {
+ final ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1);
+
+ if (itemstack2 != null && itemstack2.isItemStackDamageable()
+ && itemstack2.getItemDamage() > itemstack2.getMaxDamage()) {
+ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this.thePlayer, itemstack2));
+ continue;
+ }
+
+ if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1)
+ || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)) {
+ if (this.craftMatrix.getStackInSlot(i) == null) {
+ this.craftMatrix.setInventorySlotContents(i, itemstack2);
+ }
+ else {
+ this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false);
+ }
+ }
+ }
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/slots/SlotFrame.java b/src/Java/gtPlusPlus/core/slots/SlotFrame.java
index a9d2b94b32..cd38611847 100644
--- a/src/Java/gtPlusPlus/core/slots/SlotFrame.java
+++ b/src/Java/gtPlusPlus/core/slots/SlotFrame.java
@@ -5,21 +5,21 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-public class SlotFrame extends Slot{
+public class SlotFrame extends Slot {
- public SlotFrame(IInventory inventory, int x, int y, int z) {
+ public SlotFrame(final IInventory inventory, final int x, final int y, final int z) {
super(inventory, x, y, z);
}
@Override
- public boolean isItemValid(ItemStack itemstack) {
- return itemstack.getItem() instanceof IHiveFrame;
+ public int getSlotStackLimit() {
+ return 1;
}
@Override
- public int getSlotStackLimit() {
- return 1;
+ public boolean isItemValid(final ItemStack itemstack) {
+ return itemstack.getItem() instanceof IHiveFrame;
}
}
diff --git a/src/Java/gtPlusPlus/core/slots/SlotGeneric.java b/src/Java/gtPlusPlus/core/slots/SlotGeneric.java
index bf7dc1fff5..4cfd6ced49 100644
--- a/src/Java/gtPlusPlus/core/slots/SlotGeneric.java
+++ b/src/Java/gtPlusPlus/core/slots/SlotGeneric.java
@@ -4,21 +4,21 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-public class SlotGeneric extends Slot{
+public class SlotGeneric extends Slot {
- public SlotGeneric(IInventory inventory, int x, int y, int z) {
+ public SlotGeneric(final IInventory inventory, final int x, final int y, final int z) {
super(inventory, x, y, z);
}
@Override
- public boolean isItemValid(ItemStack itemstack) {
- return true;
+ public int getSlotStackLimit() {
+ return 64;
}
@Override
- public int getSlotStackLimit() {
- return 64;
+ public boolean isItemValid(final ItemStack itemstack) {
+ return true;
}
}
diff --git a/src/Java/gtPlusPlus/core/slots/SlotGtTool.java b/src/Java/gtPlusPlus/core/slots/SlotGtTool.java
index cdea2fa43f..011fcee9a4 100644
--- a/src/Java/gtPlusPlus/core/slots/SlotGtTool.java
+++ b/src/Java/gtPlusPlus/core/slots/SlotGtTool.java
@@ -6,26 +6,26 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-public class SlotGtTool extends Slot{
+public class SlotGtTool extends Slot {
- public SlotGtTool(IInventory inventory, int x, int y, int z) {
+ public SlotGtTool(final IInventory inventory, final int x, final int y, final int z) {
super(inventory, x, y, z);
}
@Override
- public boolean isItemValid(ItemStack itemstack) {
- if (itemstack.getItem() instanceof GT_MetaGenerated_Tool){
- Utils.LOG_WARNING(itemstack.getDisplayName()+" is a valid Tool.");
- return true;
- }
- Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Tool.");
- return false;
+ public int getSlotStackLimit() {
+ return 1;
}
@Override
- public int getSlotStackLimit() {
- return 1;
+ public boolean isItemValid(final ItemStack itemstack) {
+ if (itemstack.getItem() instanceof GT_MetaGenerated_Tool) {
+ Utils.LOG_WARNING(itemstack.getDisplayName() + " is a valid Tool.");
+ return true;
+ }
+ Utils.LOG_WARNING(itemstack.getDisplayName() + " is not a valid Tool.");
+ return false;
}
}
diff --git a/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java b/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java
index 461fa6ff04..c4efbb4995 100644
--- a/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java
+++ b/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java
@@ -10,89 +10,83 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class SlotGtToolElectric extends SlotGtTool {
- public int tier;
- private ItemStack content;
+ public int tier;
+ private ItemStack content;
- public SlotGtToolElectric(IInventory base, int x, int y, int z, int tier, boolean allowRedstoneDust)
- {
+ public boolean allowRedstoneDust = true;
+
+ public SlotGtToolElectric(final IInventory base, final int x, final int y, final int z, final int tier,
+ final boolean allowRedstoneDust) {
super(base, x, y, z);
this.tier = tier;
this.allowRedstoneDust = allowRedstoneDust;
}
- public boolean accepts(ItemStack stack)
- {
+ public boolean accepts(final ItemStack stack) {
if (stack == null) {
return false;
}
- if ((stack.getItem() == Items.redstone) && (!this.allowRedstoneDust)) {
+ if (stack.getItem() == Items.redstone && !this.allowRedstoneDust) {
return false;
}
- return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), this.tier, true, true, true) > 0.0D);
+ return Info.itemEnergy.getEnergyValue(stack) > 0.0D
+ || ElectricItem.manager.discharge(stack, 1.0D / 0.0D, this.tier, true, true, true) > 0.0D;
}
- public double discharge(double amount, boolean ignoreLimit)
- {
+ public double discharge(final double amount, final boolean ignoreLimit) {
if (amount <= 0.0D) {
throw new IllegalArgumentException("Amount must be > 0.");
}
- ItemStack stack = get(0);
+ final ItemStack stack = this.get(0);
if (stack == null) {
return 0.0D;
}
double realAmount = ElectricItem.manager.discharge(stack, amount, this.tier, ignoreLimit, true, false);
- if (realAmount <= 0.0D)
- {
+ if (realAmount <= 0.0D) {
realAmount = Info.itemEnergy.getEnergyValue(stack);
if (realAmount <= 0.0D) {
return 0.0D;
}
stack.stackSize -= 1;
if (stack.stackSize <= 0) {
- put(0, null);
+ this.put(0, null);
}
}
return realAmount;
}
- public void setTier(int tier1)
- {
- this.tier = tier1;
+ public ItemStack get() {
+ return this.get(0);
}
- public boolean allowRedstoneDust = true;
-
- public ItemStack get()
- {
- return get(0);
+ public ItemStack get(final int index) {
+ return this.content;
}
- public ItemStack get(int index)
- {
- return this.content;
+ @Override
+ public boolean isItemValid(final ItemStack itemstack) {
+ if (itemstack.getItem() instanceof GT_MetaGenerated_Tool || itemstack.getItem() instanceof IElectricItem) {
+ Utils.LOG_WARNING(itemstack.getDisplayName() + " is a valid Tool.");
+ return true;
+ }
+ Utils.LOG_WARNING(itemstack.getDisplayName() + " is not a valid Tool.");
+ return false;
}
- public void put(ItemStack content)
- {
- put(0, content);
+ public void onChanged() {
}
- public void put(int index, ItemStack content)
- {
+ public void put(final int index, final ItemStack content) {
this.content = content;
- onChanged();
+ this.onChanged();
}
- public void onChanged() {}
+ public void put(final ItemStack content) {
+ this.put(0, content);
+ }
- @Override
- public boolean isItemValid(ItemStack itemstack) {
- if (itemstack.getItem() instanceof GT_MetaGenerated_Tool || itemstack.getItem() instanceof IElectricItem){
- Utils.LOG_WARNING(itemstack.getDisplayName()+" is a valid Tool.");
- return true;
- }
- Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Tool.");
- return false;
+ public void setTier(final int tier1) {
+ this.tier = tier1;
}
}
diff --git a/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java b/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java
index 7a22086949..bc74e65844 100644
--- a/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java
+++ b/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java
@@ -5,10 +5,8 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-public class SlotItemBackpackInv extends Slot
-{
- public SlotItemBackpackInv(IInventory inv, int index, int xPos, int yPos)
- {
+public class SlotItemBackpackInv extends Slot {
+ public SlotItemBackpackInv(final IInventory inv, final int index, final int xPos, final int yPos) {
super(inv, index, xPos, yPos);
}
@@ -20,8 +18,7 @@ public class SlotItemBackpackInv extends Slot
* Check if the stack is a valid item for this slot.
*/
@Override
- public boolean isItemValid(ItemStack itemstack)
- {
+ public boolean isItemValid(final ItemStack itemstack) {
// Everything returns true except an instance of our Item
return !(itemstack.getItem() instanceof BaseItemBackpack);
}
diff --git a/src/Java/gtPlusPlus/core/slots/SlotNoInput.java b/src/Java/gtPlusPlus/core/slots/SlotNoInput.java
index fe51631a5d..7af4570eff 100644
--- a/src/Java/gtPlusPlus/core/slots/SlotNoInput.java
+++ b/src/Java/gtPlusPlus/core/slots/SlotNoInput.java
@@ -4,20 +4,20 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-public class SlotNoInput extends Slot{
+public class SlotNoInput extends Slot {
- public SlotNoInput(IInventory inventory, int x, int y, int z) {
+ public SlotNoInput(final IInventory inventory, final int x, final int y, final int z) {
super(inventory, x, y, z);
}
@Override
- public boolean isItemValid(ItemStack itemstack) {
- return false;
+ public int getSlotStackLimit() {
+ return 0;
}
@Override
- public int getSlotStackLimit() {
- return 0;
+ public boolean isItemValid(final ItemStack itemstack) {
+ return false;
}
}
diff --git a/src/Java/gtPlusPlus/core/slots/SlotOutput.java b/src/Java/gtPlusPlus/core/slots/SlotOutput.java
index 33d03a1a7c..e5eb310068 100644
--- a/src/Java/gtPlusPlus/core/slots/SlotOutput.java
+++ b/src/Java/gtPlusPlus/core/slots/SlotOutput.java
@@ -8,88 +8,82 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
-public class SlotOutput extends SlotCrafting{
+public class SlotOutput extends SlotCrafting {
- private final IInventory craftMatrix;
- private final EntityPlayer thePlayer;
- private int amountCrafted;
+ private final IInventory craftMatrix;
+ private final EntityPlayer thePlayer;
+ private int amountCrafted;
-
- public SlotOutput(EntityPlayer player, InventoryCrafting craftingInventory, IInventory p_i45790_3_, int slotIndex, int xPosition, int yPosition)
- {
+ public SlotOutput(final EntityPlayer player, final InventoryCrafting craftingInventory,
+ final IInventory p_i45790_3_, final int slotIndex, final int xPosition, final int yPosition) {
super(player, craftingInventory, p_i45790_3_, slotIndex, xPosition, yPosition);
this.thePlayer = player;
this.craftMatrix = craftingInventory;
}
+
/**
- * Check if the stack is a valid item for this slot. Always true beside for the armor slots.
- */
- @Override
- public boolean isItemValid(ItemStack par1ItemStack)
- {
- return false;
- }
- /**
- * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new
- * stack.
+ * Decrease the size of the stack in slot (first int arg) by the amount of
+ * the second int arg. Returns the new stack.
*/
@Override
- public ItemStack decrStackSize(int par1)
- {
- if (this.getHasStack())
- {
+ public ItemStack decrStackSize(final int par1) {
+ if (this.getHasStack()) {
this.amountCrafted += Math.min(par1, this.getStack().stackSize);
}
return super.decrStackSize(par1);
}
+
/**
- * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an
- * internal count then calls onCrafting(item).
+ * Check if the stack is a valid item for this slot. Always true beside for
+ * the armor slots.
*/
@Override
- protected void onCrafting(ItemStack par1ItemStack, int par2)
- {
- this.amountCrafted += par2;
- this.onCrafting(par1ItemStack);
+ public boolean isItemValid(final ItemStack par1ItemStack) {
+ return false;
}
+
/**
- * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
+ * the itemStack passed in is the output - ie, iron ingots, and pickaxes,
+ * not ore and wood.
*/
@Override
- protected void onCrafting(ItemStack stack)
- {
+ protected void onCrafting(final ItemStack stack) {
stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted);
this.amountCrafted = 0;
}
+ /**
+ * the itemStack passed in is the output - ie, iron ingots, and pickaxes,
+ * not ore and wood. Typically increases an internal count then calls
+ * onCrafting(item).
+ */
+ @Override
+ protected void onCrafting(final ItemStack par1ItemStack, final int par2) {
+ this.amountCrafted += par2;
+ this.onCrafting(par1ItemStack);
+ }
+
@Override
- public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack)
- {
+ public void onPickupFromSlot(final EntityPlayer playerIn, final ItemStack stack) {
{
- FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix);
+ FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, this.craftMatrix);
this.onCrafting(stack);
- for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i)
- {
- ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i);
- if (itemstack1 != null)
- {
+ for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) {
+ final ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i);
+ if (itemstack1 != null) {
this.craftMatrix.decrStackSize(i, 1);
- if (itemstack1.getItem().hasContainerItem(itemstack1))
- {
+ if (itemstack1.getItem().hasContainerItem(itemstack1)) {
ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1);
- if (itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage())
- {
- MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2));
+ if (itemstack2.isItemStackDamageable()
+ && itemstack2.getItemDamage() > itemstack2.getMaxDamage()) {
+ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this.thePlayer, itemstack2));
itemstack2 = null;
}
- if (!this.thePlayer.inventory.addItemStackToInventory(itemstack2))
- {
- if (this.craftMatrix.getStackInSlot(i) == null)
- {
+ if (!this.thePlayer.inventory.addItemStackToInventory(itemstack2)) {
+ if (this.craftMatrix.getStackInSlot(i) == null) {
this.craftMatrix.setInventorySlotContents(i, itemstack2);
}
- else
- {
+ else {
this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false);
}
}
diff --git a/src/Java/gtPlusPlus/core/slots/SlotRTG.java b/src/Java/gtPlusPlus/core/slots/SlotRTG.java
index 1f16463de2..31c176d4f9 100644
--- a/src/Java/gtPlusPlus/core/slots/SlotRTG.java
+++ b/src/Java/gtPlusPlus/core/slots/SlotRTG.java
@@ -5,21 +5,21 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-public class SlotRTG extends Slot{
+public class SlotRTG extends Slot {
- public SlotRTG(IInventory inventory, int x, int y, int z) {
+ public SlotRTG(final IInventory inventory, final int x, final int y, final int z) {
super(inventory, x, y, z);
}
@Override
- public boolean isItemValid(ItemStack itemstack) {
- return itemstack.getItem().getClass() == Ic2Items.RTGPellets.getItem().getClass();
+ public int getSlotStackLimit() {
+ return 1;
}
@Override
- public int getSlotStackLimit() {
- return 1;
+ public boolean isItemValid(final ItemStack itemstack) {
+ return itemstack.getItem().getClass() == Ic2Items.RTGPellets.getItem().getClass();
}
}