This commit is contained in:
tgame14 2014-03-08 20:33:35 +02:00
commit f1da57d224

View file

@ -1,5 +1,6 @@
package resonantinduction.archaic.engineering; package resonantinduction.archaic.engineering;
import java.util.ArrayList;
import java.util.Set; import java.util.Set;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -73,9 +74,7 @@ public class TileEngineeringTable extends TileInventory implements IPacketReceiv
/** The ability for the engineering table to search nearby inventories. */ /** The ability for the engineering table to search nearby inventories. */
public boolean searchInventories = true; public boolean searchInventories = true;
/** /** Temporary player inventory stored to draw the player's items. */
* Temporary player inventory stored to draw the player's items.
*/
private InventoryPlayer invPlayer = null; private InventoryPlayer invPlayer = null;
private int[] playerSlots; private int[] playerSlots;
@ -157,9 +156,7 @@ public class TileEngineeringTable extends TileInventory implements IPacketReceiv
hitVector.rotate(WorldUtility.getAngleFromForgeDirection(getDirection()), Vector3.UP()); hitVector.rotate(WorldUtility.getAngleFromForgeDirection(getDirection()), Vector3.UP());
hitVector.translate(new Vector3(0.5, 0, 0.5)); hitVector.translate(new Vector3(0.5, 0, 0.5));
/** /** Crafting Matrix */
* Crafting Matrix
*/
matrix: matrix:
for (int j = 0; j < 3; j++) for (int j = 0; j < 3; j++)
{ {
@ -183,9 +180,7 @@ public class TileEngineeringTable extends TileInventory implements IPacketReceiv
} }
else if (hitSide != 0) else if (hitSide != 0)
{ {
/** /** Take out of engineering table. */
* Take out of engineering table.
*/
if (!world().isRemote) if (!world().isRemote)
{ {
setPlayerInventory(player.inventory); setPlayerInventory(player.inventory);
@ -241,9 +236,11 @@ public class TileEngineeringTable extends TileInventory implements IPacketReceiv
} }
@Override @Override
public void onRemove(int par5, int par6) public ArrayList<ItemStack> getDrops(int metadata, int fortune)
{ {
ItemBlockSaved.dropBlockWithNBT(getBlockType(), world(), x(), y(), z()); ArrayList<ItemStack> list = new ArrayList<ItemStack>();
list.add(ItemBlockSaved.getItemStackWithNBT(blockType, world(), x(), y(), z()));
return list;
} }
@Override @Override
@ -257,9 +254,7 @@ public class TileEngineeringTable extends TileInventory implements IPacketReceiv
{ {
} }
/** /** Creates a "fake inventory" and hook the player up to the crafter to use the player's items. */
* Creates a "fake inventory" and hook the player up to the crafter to use the player's items.
*/
public void setPlayerInventory(InventoryPlayer invPlayer) public void setPlayerInventory(InventoryPlayer invPlayer)
{ {
if (searchInventories) if (searchInventories)
@ -353,9 +348,7 @@ public class TileEngineeringTable extends TileInventory implements IPacketReceiv
} }
} }
/** /** DO NOT USE THIS INTERNALLY. FOR EXTERNAL USE ONLY! */
* DO NOT USE THIS INTERNALLY. FOR EXTERNAL USE ONLY!
*/
@Override @Override
public ItemStack getStackInSlot(int slot) public ItemStack getStackInSlot(int slot)
{ {
@ -404,9 +397,7 @@ public class TileEngineeringTable extends TileInventory implements IPacketReceiv
} }
else if (slot < CRAFTING_OUTPUT_END) else if (slot < CRAFTING_OUTPUT_END)
{ {
/** /** An external inventory is attempting to craft the item from the engineering table. */
* An external inventory is attempting to craft the item from the engineering table.
*/
if (itemStack == null) if (itemStack == null)
onPickUpFromSlot(null, slot, this.outputInventory[slot - CRAFTING_MATRIX_END]); onPickUpFromSlot(null, slot, this.outputInventory[slot - CRAFTING_MATRIX_END]);
@ -446,10 +437,8 @@ public class TileEngineeringTable extends TileInventory implements IPacketReceiv
onInventoryChanged(); onInventoryChanged();
} }
/** /** When some containers are closed they call this on each slot, then drop whatever it returns as
* 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. */
* an EntityItem - like when you close a workbench GUI.
*/
@Override @Override
public ItemStack getStackInSlotOnClosing(int slot) public ItemStack getStackInSlotOnClosing(int slot)
{ {
@ -483,11 +472,9 @@ public class TileEngineeringTable extends TileInventory implements IPacketReceiv
this.onInventoryChanged(); this.onInventoryChanged();
} }
/** /** Construct an InventoryCrafting Matrix on the fly.
* Construct an InventoryCrafting Matrix on the fly.
* *
* @return * @return */
*/
public InventoryCrafting getCraftingMatrix() public InventoryCrafting getCraftingMatrix()
{ {
InventoryCrafting inventoryCrafting = new InventoryCrafting(new ContainerDummy(this), 3, 3); InventoryCrafting inventoryCrafting = new InventoryCrafting(new ContainerDummy(this), 3, 3);
@ -524,9 +511,7 @@ public class TileEngineeringTable extends TileInventory implements IPacketReceiv
didCraft = true; didCraft = true;
} }
/** /** If output does not exist, try using the filter. */
* If output does not exist, try using the filter.
*/
if (!didCraft) if (!didCraft)
{ {
ItemStack filterStack = craftingMatrix[CENTER_SLOT]; ItemStack filterStack = craftingMatrix[CENTER_SLOT];
@ -670,9 +655,7 @@ public class TileEngineeringTable extends TileInventory implements IPacketReceiv
return new int[0]; return new int[0];
} }
/** /** Auto-crafting methods. */
* Auto-crafting methods.
*/
@Override @Override
public boolean canInsertItem(int slot, ItemStack itemstack, int side) public boolean canInsertItem(int slot, ItemStack itemstack, int side)
{ {
@ -706,9 +689,7 @@ public class TileEngineeringTable extends TileInventory implements IPacketReceiv
if (outputStack != null) if (outputStack != null)
{ {
/** /** Only allow take out crafting result when it can be crafted twice! */
* Only allow take out crafting result when it can be crafted twice!
*/
Pair<ItemStack, ItemStack[]> idealRecipeItem = this.getCraftingManager().getIdealRecipe(outputStack); Pair<ItemStack, ItemStack[]> idealRecipeItem = this.getCraftingManager().getIdealRecipe(outputStack);
ItemStack[] doubleResults = ArrayUtils.addAll(idealRecipeItem.right(), idealRecipeItem.right()); ItemStack[] doubleResults = ArrayUtils.addAll(idealRecipeItem.right(), idealRecipeItem.right());