mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-26 15:03:01 +00:00
Upload my Code Changes/Format/imports
This commit is contained in:
1 parent
5bcdb7ca46
commit
5d4e38c0cb
264 files changed
+4014
-3972
No files matched your search
@@ -55,7 +55,7 @@ public class AdaptiveSmelteryContainer extends ActiveContainer
|
||||
if (invRow != slotRow)
|
||||
{
|
||||
slotRow = invRow;
|
||||
//TConstruct.logger.info(invRow);
|
||||
// TConstruct.logger.info(invRow);
|
||||
int basePos = invRow * 3;
|
||||
for (int iter = 0; iter < activeInventorySlots.size(); iter++)
|
||||
{
|
||||
@@ -135,7 +135,7 @@ public class AdaptiveSmelteryContainer extends ActiveContainer
|
||||
@Override
|
||||
protected boolean mergeItemStack (ItemStack inputStack, int startSlot, int endSlot, boolean flag)
|
||||
{
|
||||
//TConstruct.logger.info("Merge");
|
||||
// TConstruct.logger.info("Merge");
|
||||
boolean merged = false;
|
||||
int slotPos = startSlot;
|
||||
|
||||
@@ -147,44 +147,27 @@ public class AdaptiveSmelteryContainer extends ActiveContainer
|
||||
Slot slot;
|
||||
ItemStack slotStack;
|
||||
|
||||
/*if (inputStack.isStackable() && startSlot >= logic.getSizeInventory())
|
||||
{
|
||||
TConstruct.logger.info("Rawr!");
|
||||
while (inputStack.stackSize > 0 && (!flag && slotPos < endSlot || flag && slotPos >= startSlot))
|
||||
{
|
||||
slot = (Slot) this.inventorySlots.get(slotPos);
|
||||
slotStack = slot.getStack();
|
||||
|
||||
if (slotStack != null && ItemStack.areItemStacksEqual(inputStack, slotStack) && !inputStack.getHasSubtypes())
|
||||
{
|
||||
int totalSize = slotStack.stackSize + inputStack.stackSize;
|
||||
|
||||
if (totalSize <= inputStack.getMaxStackSize())
|
||||
{
|
||||
inputStack.stackSize = 0;
|
||||
slotStack.stackSize = totalSize;
|
||||
slot.onSlotChanged();
|
||||
merged = true;
|
||||
}
|
||||
else if (slotStack.stackSize < inputStack.getMaxStackSize())
|
||||
{
|
||||
inputStack.stackSize -= inputStack.getMaxStackSize() - slotStack.stackSize;
|
||||
slotStack.stackSize = inputStack.getMaxStackSize();
|
||||
slot.onSlotChanged();
|
||||
merged = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
--slotPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
++slotPos;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
/*
|
||||
* if (inputStack.isStackable() && startSlot >=
|
||||
* logic.getSizeInventory()) { TConstruct.logger.info("Rawr!"); while
|
||||
* (inputStack.stackSize > 0 && (!flag && slotPos < endSlot || flag &&
|
||||
* slotPos >= startSlot)) { slot = (Slot)
|
||||
* this.inventorySlots.get(slotPos); slotStack = slot.getStack();
|
||||
*
|
||||
* if (slotStack != null && ItemStack.areItemStacksEqual(inputStack,
|
||||
* slotStack) && !inputStack.getHasSubtypes()) { int totalSize =
|
||||
* slotStack.stackSize + inputStack.stackSize;
|
||||
*
|
||||
* if (totalSize <= inputStack.getMaxStackSize()) { inputStack.stackSize
|
||||
* = 0; slotStack.stackSize = totalSize; slot.onSlotChanged(); merged =
|
||||
* true; } else if (slotStack.stackSize < inputStack.getMaxStackSize())
|
||||
* { inputStack.stackSize -= inputStack.getMaxStackSize() -
|
||||
* slotStack.stackSize; slotStack.stackSize =
|
||||
* inputStack.getMaxStackSize(); slot.onSlotChanged(); merged = true; }
|
||||
* }
|
||||
*
|
||||
* if (flag) { --slotPos; } else { ++slotPos; } } }
|
||||
*/
|
||||
|
||||
if (inputStack.isStackable() && startSlot >= logic.getSizeInventory())
|
||||
{
|
||||
@@ -193,7 +176,8 @@ public class AdaptiveSmelteryContainer extends ActiveContainer
|
||||
slot = (Slot) this.inventorySlots.get(slotPos);
|
||||
slotStack = slot.getStack();
|
||||
|
||||
if (slotStack != null && (!inputStack.getHasSubtypes() || inputStack.getItemDamage() == slotStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(inputStack, slotStack))
|
||||
if (slotStack != null && slotStack.getItem() == inputStack.getItem() && (!inputStack.getHasSubtypes() || inputStack.getItemDamage() == slotStack.getItemDamage())
|
||||
&& ItemStack.areItemStackTagsEqual(inputStack, slotStack))
|
||||
{
|
||||
int l = slotStack.stackSize + inputStack.stackSize;
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class CraftingStationContainer extends Container
|
||||
}
|
||||
}
|
||||
|
||||
//Player Inventory
|
||||
// Player Inventory
|
||||
for (row = 0; row < 3; ++row)
|
||||
{
|
||||
for (column = 0; column < 9; ++column)
|
||||
@@ -64,7 +64,7 @@ public class CraftingStationContainer extends Container
|
||||
this.addSlotToContainer(new Slot(inventorplayer, column, 8 + column * 18, 142));
|
||||
}
|
||||
|
||||
//Side inventory
|
||||
// Side inventory
|
||||
if (logic.chest != null)
|
||||
{
|
||||
IInventory chest = logic.chest.get();
|
||||
|
||||
@@ -107,7 +107,8 @@ public class FurnaceContainer extends Container
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
|
||||
* Called when a player shift-clicks on a slot. You must override this or
|
||||
* you will crash when someone does that.
|
||||
*/
|
||||
public ItemStack transferStackInSlot (EntityPlayer par1EntityPlayer, int par2)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,8 @@ public class InventoryCraftingStation extends InventoryCrafting
|
||||
private int inventoryWidth;
|
||||
|
||||
/**
|
||||
* Class containing the callbacks for the events on_GUIClosed and on_CraftMaxtrixChanged.
|
||||
* Class containing the callbacks for the events on_GUIClosed and
|
||||
* on_CraftMaxtrixChanged.
|
||||
*/
|
||||
private Container eventHandler;
|
||||
private InventoryLogic logic;
|
||||
@@ -67,8 +68,8 @@ public class InventoryCraftingStation extends InventoryCrafting
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a
|
||||
* new stack.
|
||||
* Removes from an inventory slot (first arg) up to a specified number
|
||||
* (second arg) of items and returns them in a new stack.
|
||||
*/
|
||||
@Override
|
||||
public ItemStack decrStackSize (int slotID, int par2)
|
||||
@@ -106,7 +107,8 @@ public class InventoryCraftingStation extends InventoryCrafting
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
|
||||
* Sets the given item stack to the specified slot in the inventory (can be
|
||||
* crafting or armor sections).
|
||||
*/
|
||||
public void setInventorySlotContents (int slot, ItemStack itemstack)
|
||||
{
|
||||
@@ -115,8 +117,8 @@ public class InventoryCraftingStation extends InventoryCrafting
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't
|
||||
* this more of a set than a get?*
|
||||
* Returns the maximum stack size for a inventory slot. Seems to always be
|
||||
* 64, possibly will be extended. *Isn't this more of a set than a get?*
|
||||
*/
|
||||
public int getInventoryStackLimit ()
|
||||
{
|
||||
@@ -131,7 +133,8 @@ public class InventoryCraftingStation extends InventoryCrafting
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not make give this method the name canInteractWith because it clashes with Container
|
||||
* Do not make give this method the name canInteractWith because it clashes
|
||||
* with Container
|
||||
*/
|
||||
public boolean isUseableByPlayer (EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
@@ -147,7 +150,8 @@ public class InventoryCraftingStation extends InventoryCrafting
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
|
||||
* Returns true if automation is allowed to insert the given stack (ignoring
|
||||
* stack size) into the given slot.
|
||||
*/
|
||||
public boolean isStackValidForSlot (int par1, ItemStack par2ItemStack)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ public class InventoryCraftingStationResult extends InventoryCraftResult
|
||||
*/
|
||||
public ItemStack getStackInSlot (int par1)
|
||||
{
|
||||
return logic.getStackInSlot(0);//this.stackResult[0];
|
||||
return logic.getStackInSlot(0);// this.stackResult[0];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,8 +39,9 @@ public class InventoryCraftingStationResult extends InventoryCraftResult
|
||||
}
|
||||
|
||||
/**
|
||||
* If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's
|
||||
* language. Otherwise it will be used directly.
|
||||
* If this returns false, the inventory name will be used as an unlocalized
|
||||
* name, and translated into the player's language. Otherwise it will be
|
||||
* used directly.
|
||||
*/
|
||||
public boolean isInvNameLocalized ()
|
||||
{
|
||||
@@ -48,8 +49,8 @@ public class InventoryCraftingStationResult extends InventoryCraftResult
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a
|
||||
* new stack.
|
||||
* Removes from an inventory slot (first arg) up to a specified number
|
||||
* (second arg) of items and returns them in a new stack.
|
||||
*/
|
||||
public ItemStack decrStackSize (int par1, int par2)
|
||||
{
|
||||
@@ -67,8 +68,9 @@ public class InventoryCraftingStationResult extends InventoryCraftResult
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
public ItemStack getStackInSlotOnClosing (int par1)
|
||||
{
|
||||
@@ -76,7 +78,8 @@ public class InventoryCraftingStationResult extends InventoryCraftResult
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
|
||||
* Sets the given item stack to the specified slot in the inventory (can be
|
||||
* crafting or armor sections).
|
||||
*/
|
||||
@Override
|
||||
public void setInventorySlotContents (int par1, ItemStack par2ItemStack)
|
||||
@@ -85,8 +88,8 @@ public class InventoryCraftingStationResult extends InventoryCraftResult
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't
|
||||
* this more of a set than a get?*
|
||||
* Returns the maximum stack size for a inventory slot. Seems to always be
|
||||
* 64, possibly will be extended. *Isn't this more of a set than a get?*
|
||||
*/
|
||||
public int getInventoryStackLimit ()
|
||||
{
|
||||
@@ -101,7 +104,8 @@ public class InventoryCraftingStationResult extends InventoryCraftResult
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not make give this method the name canInteractWith because it clashes with Container
|
||||
* Do not make give this method the name canInteractWith because it clashes
|
||||
* with Container
|
||||
*/
|
||||
public boolean isUseableByPlayer (EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
@@ -117,7 +121,8 @@ public class InventoryCraftingStationResult extends InventoryCraftResult
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
|
||||
* Returns true if automation is allowed to insert the given stack (ignoring
|
||||
* stack size) into the given slot.
|
||||
*/
|
||||
public boolean isStackValidForSlot (int par1, ItemStack par2ItemStack)
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package tconstruct.inventory;
|
||||
|
||||
import tconstruct.blocks.logic.StencilTableLogic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.blocks.logic.StencilTableLogic;
|
||||
|
||||
public class PatternShaperContainer extends Container
|
||||
{
|
||||
@@ -16,13 +16,11 @@ public class PatternShaperContainer extends Container
|
||||
logic = shaper;
|
||||
this.addSlotToContainer(new Slot(shaper, 0, 48, 35));
|
||||
this.addSlotToContainer(new SlotOnlyTake(shaper, 1, 106, 35));
|
||||
/*for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int l = 0; l < 3; l++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(craftMatrix, l + i * 3, 30 + l * 18, 17 + i * 18));
|
||||
}
|
||||
}*/
|
||||
/*
|
||||
* for (int i = 0; i < 3; i++) { for (int l = 0; l < 3; l++) {
|
||||
* this.addSlotToContainer(new Slot(craftMatrix, l + i * 3, 30 + l * 18,
|
||||
* 17 + i * 18)); } }
|
||||
*/
|
||||
|
||||
/* Player inventory */
|
||||
for (int column = 0; column < 3; column++)
|
||||
@@ -39,25 +37,19 @@ public class PatternShaperContainer extends Container
|
||||
}
|
||||
}
|
||||
|
||||
/*public void onCraftMatrixChanged(IInventory iinventory)
|
||||
{
|
||||
craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj));
|
||||
}*/
|
||||
/*
|
||||
* public void onCraftMatrixChanged(IInventory iinventory) {
|
||||
* craftResult.setInventorySlotContents(0,
|
||||
* CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj));
|
||||
* }
|
||||
*/
|
||||
|
||||
/*@Override
|
||||
public void onContainerClosed(EntityPlayer entityplayer)
|
||||
{
|
||||
super.onContainerClosed(entityplayer);
|
||||
if (logic.worldObj.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ItemStack itemstack = logic.getStackInSlot(0);
|
||||
if (itemstack != null)
|
||||
{
|
||||
entityplayer.dropPlayerItem(itemstack);
|
||||
}
|
||||
}*/
|
||||
/*
|
||||
* @Override public void onContainerClosed(EntityPlayer entityplayer) {
|
||||
* super.onContainerClosed(entityplayer); if (logic.worldObj.isRemote) {
|
||||
* return; } ItemStack itemstack = logic.getStackInSlot(0); if (itemstack !=
|
||||
* null) { entityplayer.dropPlayerItem(itemstack); } }
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer entityplayer)
|
||||
@@ -69,37 +61,24 @@ public class PatternShaperContainer extends Container
|
||||
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
|
||||
{
|
||||
return null;
|
||||
/*ItemStack stack = null;
|
||||
Slot slot = (Slot)this.inventorySlots.get(slotID);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack slotStack = slot.getStack();
|
||||
stack = slotStack.copy();
|
||||
|
||||
if (slotID < logic.getSizeInventory())
|
||||
{
|
||||
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory()-1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (slotStack.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return stack;*/
|
||||
/*
|
||||
* ItemStack stack = null; Slot slot =
|
||||
* (Slot)this.inventorySlots.get(slotID);
|
||||
*
|
||||
* if (slot != null && slot.getHasStack()) { ItemStack slotStack =
|
||||
* slot.getStack(); stack = slotStack.copy();
|
||||
*
|
||||
* if (slotID < logic.getSizeInventory()) { if
|
||||
* (!this.mergeItemStack(slotStack, logic.getSizeInventory(),
|
||||
* this.inventorySlots.size(), true)) { return null; } } else if
|
||||
* (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory()-1,
|
||||
* false)) { return null; }
|
||||
*
|
||||
* if (slotStack.stackSize == 0) { slot.putStack((ItemStack)null); }
|
||||
* else { slot.onSlotChanged(); } }
|
||||
*
|
||||
* return stack;
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,12 +14,14 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
public class SlotArmorCopy extends Slot
|
||||
{
|
||||
/**
|
||||
* The armor type that can be placed on that slot, it uses the same values of armorType field on ItemArmor.
|
||||
* The armor type that can be placed on that slot, it uses the same values
|
||||
* of armorType field on ItemArmor.
|
||||
*/
|
||||
final int armorType;
|
||||
|
||||
/**
|
||||
* The parent class of this clot, ContainerPlayer, SlotArmor is a Anon inner class.
|
||||
* The parent class of this clot, ContainerPlayer, SlotArmor is a Anon inner
|
||||
* class.
|
||||
*/
|
||||
final Container parent;
|
||||
|
||||
@@ -31,8 +33,8 @@ public class SlotArmorCopy extends Slot
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum stack size for a given slot (usually the same as getInventoryStackLimit(), but 1 in the case
|
||||
* of armor slots)
|
||||
* Returns the maximum stack size for a given slot (usually the same as
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
@@ -40,7 +42,8 @@ public class SlotArmorCopy extends Slot
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
|
||||
* Check if the stack is a valid item for this slot. Always true beside for
|
||||
* the armor slots.
|
||||
*/
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ public class SlotBehavedOnly extends Slot
|
||||
}
|
||||
|
||||
return false;
|
||||
//return b != null;
|
||||
// return b != null;
|
||||
}
|
||||
|
||||
public int getSlotStackLimit (ItemStack par1ItemStack)
|
||||
|
||||
@@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack;
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SlotBlocksOnly extends Slot
|
||||
{
|
||||
|
||||
@@ -14,8 +14,8 @@ public class SlotCanister extends Slot
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum stack size for a given slot (usually the same as getInventoryStackLimit(), but 1 in the case
|
||||
* of armor slots)
|
||||
* Returns the maximum stack size for a given slot (usually the same as
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
@@ -23,7 +23,8 @@ public class SlotCanister extends Slot
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
|
||||
* Check if the stack is a valid item for this slot. Always true beside for
|
||||
* the armor slots.
|
||||
*/
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
|
||||
@@ -14,8 +14,8 @@ public class SlotKnapsack extends Slot
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum stack size for a given slot (usually the same as getInventoryStackLimit(), but 1 in the case
|
||||
* of armor slots)
|
||||
* Returns the maximum stack size for a given slot (usually the same as
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
@@ -23,7 +23,8 @@ public class SlotKnapsack extends Slot
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
|
||||
* Check if the stack is a valid item for this slot. Always true beside for
|
||||
* the armor slots.
|
||||
*/
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,8 @@ public class SlotOnlyTake extends Slot
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
|
||||
* Check if the stack is a valid item for this slot. Always true beside for
|
||||
* the armor slots.
|
||||
*/
|
||||
public boolean isItemValid (ItemStack stack)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,8 @@ public class SlotPattern extends Slot
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
|
||||
* Check if the stack is a valid item for this slot. Always true beside for
|
||||
* the armor slots.
|
||||
*/
|
||||
public boolean isItemValid (ItemStack stack)
|
||||
{
|
||||
|
||||
@@ -24,33 +24,36 @@ public class SlotTool extends Slot
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
|
||||
* Check if the stack is a valid item for this slot. Always true beside for
|
||||
* the armor slots.
|
||||
*/
|
||||
public boolean isItemValid (ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
//return stack.getItem() instanceof ToolCore;
|
||||
// return stack.getItem() instanceof ToolCore;
|
||||
}
|
||||
|
||||
public void onPickupFromSlot (EntityPlayer par1EntityPlayer, ItemStack stack)
|
||||
{
|
||||
this.onCrafting(stack);
|
||||
//stack.setUnlocalizedName("\u00A7f" + toolName);
|
||||
// stack.setUnlocalizedName("\u00A7f" + toolName);
|
||||
super.onPickupFromSlot(par1EntityPlayer, stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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).
|
||||
* 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 stack, int par2)
|
||||
{
|
||||
//this.field_75228_b += par2;
|
||||
// this.field_75228_b += par2;
|
||||
this.onCrafting(stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
protected void onCrafting (ItemStack stack)
|
||||
{
|
||||
@@ -65,7 +68,8 @@ public class SlotTool extends Slot
|
||||
inventory.decrStackSize(1, amount);
|
||||
if (!player.worldObj.isRemote && full)
|
||||
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "tinker:little_saw", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
|
||||
//player.worldObj.playAuxSFX(1021, (int)player.posX, (int)player.posY, (int)player.posZ, 0);
|
||||
// player.worldObj.playAuxSFX(1021, (int)player.posX,
|
||||
// (int)player.posY, (int)player.posZ, 0);
|
||||
MinecraftForge.EVENT_BUS.post(new ToolCraftedEvent(this.inventory, player, stack));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ public class SlotUnused extends Slot
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum stack size for a given slot (usually the same as getInventoryStackLimit(), but 1 in the case
|
||||
* of armor slots)
|
||||
* Returns the maximum stack size for a given slot (usually the same as
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
@@ -21,7 +21,8 @@ public class SlotUnused extends Slot
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
|
||||
* Check if the stack is a valid item for this slot. Always true beside for
|
||||
* the armor slots.
|
||||
*/
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ public class SmelteryContainer extends ActiveContainer
|
||||
if (invRow != slotRow)
|
||||
{
|
||||
slotRow = invRow;
|
||||
//TConstruct.logger.info(invRow);
|
||||
// TConstruct.logger.info(invRow);
|
||||
int basePos = invRow * 3;
|
||||
for (int iter = 0; iter < activeInventorySlots.size(); iter++)
|
||||
{
|
||||
@@ -80,29 +80,20 @@ public class SmelteryContainer extends ActiveContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges () //TODO: Sync with this
|
||||
public void detectAndSendChanges () // TODO: Sync with this
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
/*for (int i = 0; i < crafters.size(); i++)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting)crafters.get(i);
|
||||
if (progress != logic.progress)
|
||||
{
|
||||
icrafting.sendProgressBarUpdate(this, 0, logic.progress);
|
||||
}
|
||||
if (fuel != logic.fuel)
|
||||
{
|
||||
icrafting.sendProgressBarUpdate(this, 1, logic.fuel);
|
||||
}
|
||||
if (fuelGague != logic.fuelGague)
|
||||
{
|
||||
icrafting.sendProgressBarUpdate(this, 2, logic.fuelGague);
|
||||
}
|
||||
}
|
||||
|
||||
progress = logic.progress;
|
||||
fuel = logic.fuel;
|
||||
fuelGague = logic.fuelGague;*/
|
||||
/*
|
||||
* for (int i = 0; i < crafters.size(); i++) { ICrafting icrafting =
|
||||
* (ICrafting)crafters.get(i); if (progress != logic.progress) {
|
||||
* icrafting.sendProgressBarUpdate(this, 0, logic.progress); } if (fuel
|
||||
* != logic.fuel) { icrafting.sendProgressBarUpdate(this, 1,
|
||||
* logic.fuel); } if (fuelGague != logic.fuelGague) {
|
||||
* icrafting.sendProgressBarUpdate(this, 2, logic.fuelGague); } }
|
||||
*
|
||||
* progress = logic.progress; fuel = logic.fuel; fuelGague =
|
||||
* logic.fuelGague;
|
||||
*/
|
||||
}
|
||||
|
||||
public void updateProgressBar (int id, int value)
|
||||
@@ -111,14 +102,12 @@ public class SmelteryContainer extends ActiveContainer
|
||||
{
|
||||
logic.fuelGague = value;
|
||||
}
|
||||
/* if (id == 1)
|
||||
{
|
||||
logic.fuel = value;
|
||||
}*/
|
||||
/*if (id == 2)
|
||||
{
|
||||
logic.fuelGague = value;
|
||||
}*/
|
||||
/*
|
||||
* if (id == 1) { logic.fuel = value; }
|
||||
*/
|
||||
/*
|
||||
* if (id == 2) { logic.fuelGague = value; }
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -166,7 +155,7 @@ public class SmelteryContainer extends ActiveContainer
|
||||
@Override
|
||||
protected boolean mergeItemStack (ItemStack inputStack, int startSlot, int endSlot, boolean flag)
|
||||
{
|
||||
//TConstruct.logger.info("Merge");
|
||||
// TConstruct.logger.info("Merge");
|
||||
boolean merged = false;
|
||||
int slotPos = startSlot;
|
||||
|
||||
@@ -178,44 +167,27 @@ public class SmelteryContainer extends ActiveContainer
|
||||
Slot slot;
|
||||
ItemStack slotStack;
|
||||
|
||||
/*if (inputStack.isStackable() && startSlot >= logic.getSizeInventory())
|
||||
{
|
||||
TConstruct.logger.info("Rawr!");
|
||||
while (inputStack.stackSize > 0 && (!flag && slotPos < endSlot || flag && slotPos >= startSlot))
|
||||
{
|
||||
slot = (Slot) this.inventorySlots.get(slotPos);
|
||||
slotStack = slot.getStack();
|
||||
|
||||
if (slotStack != null && ItemStack.areItemStacksEqual(inputStack, slotStack) && !inputStack.getHasSubtypes())
|
||||
{
|
||||
int totalSize = slotStack.stackSize + inputStack.stackSize;
|
||||
|
||||
if (totalSize <= inputStack.getMaxStackSize())
|
||||
{
|
||||
inputStack.stackSize = 0;
|
||||
slotStack.stackSize = totalSize;
|
||||
slot.onSlotChanged();
|
||||
merged = true;
|
||||
}
|
||||
else if (slotStack.stackSize < inputStack.getMaxStackSize())
|
||||
{
|
||||
inputStack.stackSize -= inputStack.getMaxStackSize() - slotStack.stackSize;
|
||||
slotStack.stackSize = inputStack.getMaxStackSize();
|
||||
slot.onSlotChanged();
|
||||
merged = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
--slotPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
++slotPos;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
/*
|
||||
* if (inputStack.isStackable() && startSlot >=
|
||||
* logic.getSizeInventory()) { TConstruct.logger.info("Rawr!"); while
|
||||
* (inputStack.stackSize > 0 && (!flag && slotPos < endSlot || flag &&
|
||||
* slotPos >= startSlot)) { slot = (Slot)
|
||||
* this.inventorySlots.get(slotPos); slotStack = slot.getStack();
|
||||
*
|
||||
* if (slotStack != null && ItemStack.areItemStacksEqual(inputStack,
|
||||
* slotStack) && !inputStack.getHasSubtypes()) { int totalSize =
|
||||
* slotStack.stackSize + inputStack.stackSize;
|
||||
*
|
||||
* if (totalSize <= inputStack.getMaxStackSize()) { inputStack.stackSize
|
||||
* = 0; slotStack.stackSize = totalSize; slot.onSlotChanged(); merged =
|
||||
* true; } else if (slotStack.stackSize < inputStack.getMaxStackSize())
|
||||
* { inputStack.stackSize -= inputStack.getMaxStackSize() -
|
||||
* slotStack.stackSize; slotStack.stackSize =
|
||||
* inputStack.getMaxStackSize(); slot.onSlotChanged(); merged = true; }
|
||||
* }
|
||||
*
|
||||
* if (flag) { --slotPos; } else { ++slotPos; } } }
|
||||
*/
|
||||
|
||||
if (inputStack.isStackable() && startSlot >= logic.getSizeInventory())
|
||||
{
|
||||
@@ -224,7 +196,8 @@ public class SmelteryContainer extends ActiveContainer
|
||||
slot = (Slot) this.inventorySlots.get(slotPos);
|
||||
slotStack = slot.getStack();
|
||||
|
||||
if (slotStack != null && (!inputStack.getHasSubtypes() || inputStack.getItemDamage() == slotStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(inputStack, slotStack))
|
||||
if (slotStack != null && slotStack.getItem() == inputStack.getItem() && (!inputStack.getHasSubtypes() || inputStack.getItemDamage() == slotStack.getItemDamage())
|
||||
&& ItemStack.areItemStackTagsEqual(inputStack, slotStack))
|
||||
{
|
||||
int l = slotStack.stackSize + inputStack.stackSize;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ToolForgeContainer extends ToolStationContainer
|
||||
}
|
||||
}
|
||||
|
||||
//posX and posY must be the same length
|
||||
// posX and posY must be the same length
|
||||
public void resetSlots (int[] posX, int[] posY)
|
||||
{
|
||||
inventorySlots.clear();
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ToolStationContainer extends ActiveContainer
|
||||
}
|
||||
}
|
||||
|
||||
//posX and posY must be the same length
|
||||
// posX and posY must be the same length
|
||||
public void resetSlots (int[] posX, int[] posY)
|
||||
{
|
||||
/* Station inventory */
|
||||
@@ -154,43 +154,27 @@ public class ToolStationContainer extends ActiveContainer
|
||||
Slot otherInventorySlot;
|
||||
ItemStack copyStack = null;
|
||||
|
||||
/*if (stack.isStackable())
|
||||
{
|
||||
while (stack.stackSize > 0 && (!playerInventory && slotIndex < slotsTotal || playerInventory && slotIndex >= slotsStart))
|
||||
{
|
||||
otherInventorySlot = (Slot)this.inventorySlots.get(slotIndex);
|
||||
copyStack = otherInventorySlot.getStack();
|
||||
|
||||
if (copyStack != null && copyStack.itemID == stack.itemID && (!stack.getHasSubtypes() || stack.getItemDamage() == copyStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(stack, copyStack))
|
||||
{
|
||||
int totalSize = copyStack.stackSize + stack.stackSize;
|
||||
|
||||
if (totalSize <= stack.getMaxStackSize())
|
||||
{
|
||||
stack.stackSize = 0;
|
||||
copyStack.stackSize = totalSize;
|
||||
otherInventorySlot.onSlotChanged();
|
||||
failedToMerge = true;
|
||||
}
|
||||
else if (copyStack.stackSize < stack.getMaxStackSize())
|
||||
{
|
||||
stack.stackSize -= stack.getMaxStackSize() - copyStack.stackSize;
|
||||
copyStack.stackSize = stack.getMaxStackSize();
|
||||
otherInventorySlot.onSlotChanged();
|
||||
failedToMerge = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (playerInventory)
|
||||
{
|
||||
--slotIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
++slotIndex;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
/*
|
||||
* if (stack.isStackable()) { while (stack.stackSize > 0 &&
|
||||
* (!playerInventory && slotIndex < slotsTotal || playerInventory &&
|
||||
* slotIndex >= slotsStart)) { otherInventorySlot =
|
||||
* (Slot)this.inventorySlots.get(slotIndex); copyStack =
|
||||
* otherInventorySlot.getStack();
|
||||
*
|
||||
* if (copyStack != null && copyStack.itemID == stack.itemID &&
|
||||
* (!stack.getHasSubtypes() || stack.getItemDamage() ==
|
||||
* copyStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(stack,
|
||||
* copyStack)) { int totalSize = copyStack.stackSize + stack.stackSize;
|
||||
*
|
||||
* if (totalSize <= stack.getMaxStackSize()) { stack.stackSize = 0;
|
||||
* copyStack.stackSize = totalSize; otherInventorySlot.onSlotChanged();
|
||||
* failedToMerge = true; } else if (copyStack.stackSize <
|
||||
* stack.getMaxStackSize()) { stack.stackSize -= stack.getMaxStackSize()
|
||||
* - copyStack.stackSize; copyStack.stackSize = stack.getMaxStackSize();
|
||||
* otherInventorySlot.onSlotChanged(); failedToMerge = true; } }
|
||||
*
|
||||
* if (playerInventory) { --slotIndex; } else { ++slotIndex; } } }
|
||||
*/
|
||||
|
||||
if (stack.stackSize > 0)
|
||||
{
|
||||
@@ -229,10 +213,13 @@ public class ToolStationContainer extends ActiveContainer
|
||||
}
|
||||
}
|
||||
|
||||
/*boolean emptySlots = ( ((Slot) inventorySlots.get(2)).getStack() == null && ((Slot) inventorySlots.get(3)).getStack() == null );
|
||||
TConstruct.logger.info("Empty slots");
|
||||
if (!failedToMerge && emptySlots)
|
||||
player.worldObj.playAuxSFX(1021, (int)player.posX, (int)player.posY, (int)player.posZ, 0);*/
|
||||
/*
|
||||
* boolean emptySlots = ( ((Slot) inventorySlots.get(2)).getStack() ==
|
||||
* null && ((Slot) inventorySlots.get(3)).getStack() == null );
|
||||
* TConstruct.logger.info("Empty slots"); if (!failedToMerge &&
|
||||
* emptySlots) player.worldObj.playAuxSFX(1021, (int)player.posX,
|
||||
* (int)player.posY, (int)player.posZ, 0);
|
||||
*/
|
||||
|
||||
return failedToMerge;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user