Some container shift clicking work

This commit is contained in:
pahimar 2013-05-14 16:15:50 -04:00
parent 9e15f7aeb8
commit 59929c9c82
7 changed files with 66 additions and 7 deletions

View file

@ -87,7 +87,7 @@ public class TileEntityAludelRenderer extends TileEntitySpecialRenderer {
ghostEntityItem.hoverStart = 0.0F;
ghostEntityItem.setEntityItemStack(tileAludel.getStackInSlot(TileAludel.INPUT_INVENTORY_INDEX));
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.2F, (float) z + 0.5F);
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.25F, (float) z + 0.5F);
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);

View file

@ -51,6 +51,37 @@ public class ContainerAludel extends Container {
@Override
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) {
return null;
ItemStack itemStack = null;
Slot slot = (Slot) inventorySlots.get(slotIndex);
if (slot != null && slot.getHasStack())
{
ItemStack slotItemStack = slot.getStack();
itemStack = slotItemStack.copy();
if (slotIndex < TileAludel.INVENTORY_SIZE) {
if (!this.mergeItemStack(slotItemStack, TileAludel.INVENTORY_SIZE + 1, inventorySlots.size(), true)) {
return null;
}
}
else {
/*
* TODO: Depending on the slowItemStack, attempt to merge it into acceptable slots
*/
if (!this.mergeItemStack(slotItemStack, 0, TileAludel.INVENTORY_SIZE - 1, false)) {
return null;
}
}
if (slotItemStack.stackSize == 0) {
slot.putStack((ItemStack) null);
}
else {
slot.onSlotChanged();
}
}
return itemStack;
}
}

View file

@ -48,7 +48,35 @@ public class ContainerGlassBell extends Container {
@Override
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) {
ItemStack itemStack = null;
Slot slot = (Slot) inventorySlots.get(slotIndex);
return null;
if (slot != null && slot.getHasStack())
{
ItemStack slotItemStack = slot.getStack();
itemStack = slotItemStack.copy();
if (slotIndex < TileGlassBell.INVENTORY_SIZE) {
if (!this.mergeItemStack(slotItemStack, 1, inventorySlots.size(), true)) {
return null;
}
}
else {
if (!this.mergeItemStack(slotItemStack, 0, TileGlassBell.INVENTORY_SIZE, false)) {
return null;
}
}
if (slotItemStack.stackSize == 0) {
slot.putStack((ItemStack) null);
}
else {
slot.onSlotChanged();
}
}
return itemStack;
}
}

View file

@ -33,7 +33,7 @@ public class TileAlchemicalChest extends TileEE implements IInventory {
/** Server sync counter (once per 20 ticks) */
private int ticksSinceSync;
private final int INVENTORY_SIZE = 13 * 4;
public static final int INVENTORY_SIZE = 13 * 4;
/**
* The ItemStacks that hold the items currently being used in the Alchemical

View file

@ -27,7 +27,7 @@ public class TileAludel extends TileEE implements IInventory {
*/
private ItemStack[] inventory;
private final int INVENTORY_SIZE = 4;
public static final int INVENTORY_SIZE = 4;
public static final int INPUT_INVENTORY_INDEX = 0;
public static final int DUST_INVENTORY_INDEX = 1;

View file

@ -23,7 +23,7 @@ public class TileCalcinator extends TileEE implements IInventory {
*/
private ItemStack[] inventory;
private final int INVENTORY_SIZE = 3;
public static final int INVENTORY_SIZE = 3;
public static final int FUEL_INVENTORY_INDEX = 0;
public static final int INPUT_INVENTORY_INDEX = 1;

View file

@ -18,7 +18,7 @@ public class TileGlassBell extends TileEE implements IInventory {
*/
private ItemStack[] inventory;
private final int INVENTORY_SIZE = 1;
public static final int INVENTORY_SIZE = 1;
public static final int DISPLAY_SLOT_INVENTORY_INDEX = 0;