1.0.1d push
This commit is contained in:
parent
e13818e2da
commit
1c0deadfc6
129 changed files with 4403 additions and 2247 deletions
|
@ -751,10 +751,7 @@ public class TEWritingTable extends TileEntity implements ISidedInventory
|
|||
progress = 0;
|
||||
this.setInventorySlotContents(6, getResultingItemStack());
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
this.decrStackSizeLeaveContainer(i + 1, 1);
|
||||
}
|
||||
this.decrementSlots(AlchemyRecipeRegistry.getRecipeForItemStack(getResultingItemStack()));
|
||||
|
||||
if (worldObj != null)
|
||||
{
|
||||
|
@ -782,10 +779,7 @@ public class TEWritingTable extends TileEntity implements ISidedInventory
|
|||
result.stackSize += getStackInSlot(6).stackSize;
|
||||
this.setInventorySlotContents(6, result);
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
this.decrStackSizeLeaveContainer(i + 1, 1);
|
||||
}
|
||||
this.decrementSlots(AlchemyRecipeRegistry.getRecipeForItemStack(getResultingItemStack()));
|
||||
|
||||
if (worldObj != null)
|
||||
{
|
||||
|
@ -842,4 +836,31 @@ public class TEWritingTable extends TileEntity implements ISidedInventory
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void decrementSlots(ItemStack[] recipe)
|
||||
{
|
||||
boolean[] decrementedList = new boolean[]{false,false,false,false,false};
|
||||
|
||||
for(int i=0; i<(Math.min(recipe.length,5)); i++)
|
||||
{
|
||||
ItemStack decStack = recipe[i];
|
||||
|
||||
if(decStack == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for(int j=0; j<5; j++)
|
||||
{
|
||||
ItemStack testStack = this.getStackInSlot(j+1);
|
||||
|
||||
if(testStack != null && testStack.isItemEqual(decStack) && !(decrementedList[j]))
|
||||
{
|
||||
this.decrStackSize(j+1, 1);
|
||||
decrementedList[j] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +1,12 @@
|
|||
package WayofTime.alchemicalWizardry.common.tileEntity.container;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
|
||||
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 WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
|
||||
|
||||
public class ContainerWritingTable extends Container
|
||||
{
|
||||
|
@ -52,7 +53,7 @@ public class ContainerWritingTable extends Container
|
|||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot)
|
||||
{
|
||||
ItemStack stack = null;
|
||||
ItemStack stack = null;
|
||||
Slot slotObject = (Slot) inventorySlots.get(slot);
|
||||
|
||||
//null checks and checks if the item can be stacked (maxStackSize > 1)
|
||||
|
@ -61,26 +62,23 @@ public class ContainerWritingTable extends Container
|
|||
ItemStack stackInSlot = slotObject.getStack();
|
||||
stack = stackInSlot.copy();
|
||||
|
||||
if (slot == 7)
|
||||
//merges the item into player inventory since its in the tileEntity
|
||||
if (slot <= 6)
|
||||
{
|
||||
if (!this.mergeItemStack(stackInSlot, 7, 35, true))
|
||||
if (!this.mergeItemStack(stackInSlot, 7, 43, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
slotObject.onSlotChange(stackInSlot, stack);
|
||||
}
|
||||
|
||||
//merges the item into player inventory since its in the tileEntity
|
||||
if (slot < 6)
|
||||
else if(stack.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
if (!this.mergeItemStack(stackInSlot, 7, 35, true))
|
||||
if (!this.mergeItemStack(stackInSlot, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//places it into the tileEntity is possible since its in the player inventory
|
||||
else if (!this.mergeItemStack(stackInSlot, 0, 7, false))
|
||||
else if (!this.mergeItemStack(stackInSlot, 1, 6, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue