diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-11-06 19:32:27 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-11-06 19:32:27 +1000 |
commit | cbe0e497be8e466c380a5b4fa781b314ede9ada3 (patch) | |
tree | b85848b432adf458e3abda466ee46d9dfc3e454b /src/Java/gtPlusPlus/core/slots/SlotOutput.java | |
parent | c40416b036c0e89451e1558253ccf07bbee028d0 (diff) | |
download | GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.tar.gz GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.tar.bz2 GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.zip |
Revert "$ Cleaned up the entire project."
This reverts commit 0669f5eb9d5029a8b94ec552171b0837605f7747.
# Conflicts:
# src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java
# src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java
Revert "% Cleaned up Imports."
This reverts commit 3654052fb63a571c5eaca7f20714b87c17f7e966.
Diffstat (limited to 'src/Java/gtPlusPlus/core/slots/SlotOutput.java')
-rw-r--r-- | src/Java/gtPlusPlus/core/slots/SlotOutput.java | 94 |
1 files changed, 50 insertions, 44 deletions
diff --git a/src/Java/gtPlusPlus/core/slots/SlotOutput.java b/src/Java/gtPlusPlus/core/slots/SlotOutput.java index e5eb310068..a0f895d554 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotOutput.java +++ b/src/Java/gtPlusPlus/core/slots/SlotOutput.java @@ -1,89 +1,95 @@ package gtPlusPlus.core.slots; -import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; +import cpw.mods.fml.common.FMLCommonHandler; + +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(final EntityPlayer player, final InventoryCrafting craftingInventory, - final IInventory p_i45790_3_, final int slotIndex, final int xPosition, final int yPosition) { + public SlotOutput(EntityPlayer player, InventoryCrafting craftingInventory, IInventory p_i45790_3_, int slotIndex, int xPosition, int yPosition) + { super(player, craftingInventory, p_i45790_3_, slotIndex, xPosition, yPosition); this.thePlayer = player; this.craftMatrix = craftingInventory; } - /** - * Decrease the size of the stack in slot (first int arg) by the amount of - * the second int arg. Returns the new stack. + * Check if the stack is a valid item for this slot. Always true beside for the armor slots. */ @Override - public ItemStack decrStackSize(final int par1) { - if (this.getHasStack()) { + 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. + */ + @Override + public ItemStack decrStackSize(int par1) + { + if (this.getHasStack()) + { this.amountCrafted += Math.min(par1, this.getStack().stackSize); } return super.decrStackSize(par1); } - /** - * Check if the stack is a valid item for this slot. Always true beside for - * the armor slots. + * 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 - public boolean isItemValid(final ItemStack par1ItemStack) { - return false; + protected void onCrafting(ItemStack par1ItemStack, int par2) + { + this.amountCrafted += par2; + this.onCrafting(par1ItemStack); } - /** - * 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(final ItemStack stack) { + protected void onCrafting(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(final EntityPlayer playerIn, final ItemStack stack) { + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { { - FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, this.craftMatrix); + FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix); this.onCrafting(stack); - for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) { - final ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); - if (itemstack1 != null) { + 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)) { + if (itemstack1.getItem().hasContainerItem(itemstack1)) + { ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); - if (itemstack2.isItemStackDamageable() - && itemstack2.getItemDamage() > itemstack2.getMaxDamage()) { - MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this.thePlayer, itemstack2)); + if (itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage()) + { + MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(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); } } |