Added ability to mass craft with Engineering Table

This commit is contained in:
Calclavia 2014-01-12 12:37:58 +08:00
parent 8c7e8d7601
commit 05241e740e
2 changed files with 27 additions and 20 deletions

View file

@ -68,30 +68,36 @@ public class BlockEngineeringTable extends BlockRI
if (check.distance(hitVector) < regionLength)
{
int slotID = j * 3 + k;
boolean didInsert = false;
ItemStack checkStack = tile.craftingMatrix[slotID];
if (checkStack != null)
if (current != null)
{
if (checkStack == null || checkStack.isItemEqual(current))
{
if (ControlKeyModifer.isControlDown(player))
{
tile.craftingMatrix[slotID] = current;
current = null;
}
else
{
tile.craftingMatrix[slotID] = current.splitStack(1);
}
if (current == null || current.stackSize <= 0)
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
}
if (!didInsert && checkStack != null)
{
InventoryUtility.dropItemStack(world, new Vector3(player), checkStack, 0);
tile.craftingMatrix[slotID] = null;
}
else if (current != null)
{
if (ControlKeyModifer.isControlDown(player))
{
tile.craftingMatrix[slotID] = current.splitStack(1);
}
else
{
tile.craftingMatrix[slotID] = current;
current = null;
}
if (current == null || current.stackSize <= 0)
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
break matrix;
}
@ -108,11 +114,12 @@ public class BlockEngineeringTable extends BlockRI
{
ItemStack output = tile.getStackInSlot(9);
if (output != null)
while (output != null && ControlKeyModifer.isControlDown(player))
{
InventoryUtility.dropItemStack(world, new Vector3(player), output, 0);
tile.onPickUpFromSlot(player, 9, output);
tile.setInventorySlotContents(9, null);
output = tile.getStackInSlot(9);
}
}
}

View file

@ -65,7 +65,7 @@ public class RenderEngineeringTable extends TileEntitySpecialRenderer
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
this.renderItem(tileEntity.worldObj, ForgeDirection.UP, tile.craftingMatrix[i], new Vector3(), 0, 0);
GL11.glPopMatrix();
System.out.println(tile.craftingMatrix[i].stackSize);
if (isLooking)
RenderUtility.renderFloatingText("" + tile.craftingMatrix[i].stackSize, (float) translation.x, (float) translation.y - 2f, (float) translation.z);
}