mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Fixed all Shift-Click Mechanics
This commit is contained in:
parent
d43583d843
commit
5a25595fa1
21 changed files with 473 additions and 494 deletions
|
@ -46,34 +46,32 @@ public class ContainerBreaker extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(currentStack.getItem() != null){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
ItemStack newStack = theSlot.getStack();
|
||||||
this.mergeItemStack(newStack, 0, 9, false);
|
ItemStack currentStack = newStack.copy();
|
||||||
|
|
||||||
|
//Other Slots in Inventory excluded
|
||||||
|
if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(!this.mergeItemStack(newStack, 0, 10, false)){
|
||||||
|
//
|
||||||
|
if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false))
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
|
else theSlot.onSlotChanged();
|
||||||
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
|
return currentStack;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package ellpeck.actuallyadditions.inventory;
|
package ellpeck.actuallyadditions.inventory;
|
||||||
|
|
||||||
|
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||||
import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
|
import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
|
||||||
import ellpeck.actuallyadditions.items.InitItems;
|
import ellpeck.actuallyadditions.items.InitItems;
|
||||||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||||
|
@ -8,10 +9,11 @@ import ellpeck.actuallyadditions.tile.TileEntityCanolaPress;
|
||||||
import invtweaks.api.container.InventoryContainer;
|
import invtweaks.api.container.InventoryContainer;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
@InventoryContainer
|
@InventoryContainer
|
||||||
public class ContainerCanolaPress extends Container{
|
public class ContainerCanolaPress extends Container{
|
||||||
|
@ -48,33 +50,33 @@ public class ContainerCanolaPress extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(currentStack.getItem() == InitItems.itemMisc && currentStack.getItemDamage() == TheMiscItems.CANOLA.ordinal()){
|
ItemStack newStack = theSlot.getStack();
|
||||||
this.mergeItemStack(newStack, 0, 1, false);
|
ItemStack currentStack = newStack.copy();
|
||||||
|
|
||||||
|
//Other Slots in Inventory excluded
|
||||||
|
if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(newStack.getItem() == InitItems.itemMisc && newStack.getItemDamage() == TheMiscItems.CANOLA.ordinal()){
|
||||||
|
if(!this.mergeItemStack(newStack, 0, 1, false)) return null;
|
||||||
}
|
}
|
||||||
if(currentStack.getItem() == Items.bucket){
|
else if(FluidContainerRegistry.getContainerCapacity(new FluidStack(InitBlocks.fluidCanolaOil, 1), newStack) > 0){
|
||||||
this.mergeItemStack(newStack, 1, 2, false);
|
if(!this.mergeItemStack(newStack, 1, 2, false)) return null;
|
||||||
}
|
}
|
||||||
}
|
//
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
else if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
}
|
}
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
else theSlot.onSlotChanged();
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
return currentStack;
|
return currentStack;
|
||||||
|
|
|
@ -43,31 +43,30 @@ public class ContainerCoalGenerator extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
if(theSlot != null && theSlot.getHasStack()){
|
||||||
if(TileEntityFurnace.getItemBurnTime(currentStack) > 0){
|
ItemStack newStack = theSlot.getStack();
|
||||||
this.mergeItemStack(newStack, 0, 1, false);
|
ItemStack currentStack = newStack.copy();
|
||||||
|
|
||||||
|
//Other Slots in Inventory excluded
|
||||||
|
if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(TileEntityFurnace.getItemBurnTime(newStack) > 0){
|
||||||
|
if(!this.mergeItemStack(newStack, 0, 1, false)) return null;
|
||||||
}
|
}
|
||||||
}
|
//
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
else if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
else theSlot.onSlotChanged();
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
return currentStack;
|
return currentStack;
|
||||||
|
|
|
@ -60,45 +60,47 @@ public class ContainerCoffeeMachine extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(currentStack.getItem() != null){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
ItemStack newStack = theSlot.getStack();
|
||||||
if(currentStack.getItem() == InitItems.itemCoffeeBean){
|
ItemStack currentStack = newStack.copy();
|
||||||
this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS+1, false);
|
|
||||||
}
|
|
||||||
if(currentStack.getItem() == InitItems.itemMisc && currentStack.getItemDamage() == TheMiscItems.CUP.ordinal()){
|
|
||||||
this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_INPUT, TileEntityCoffeeMachine.SLOT_INPUT+1, false);
|
|
||||||
}
|
|
||||||
if(ItemCoffee.getIngredientFromStack(newStack) != null){
|
|
||||||
this.mergeItemStack(newStack, 3, 10, false);
|
|
||||||
}
|
|
||||||
if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME))){
|
|
||||||
this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_WATER_INPUT, TileEntityCoffeeMachine.SLOT_WATER_INPUT+1, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
//Slots in Inventory to shift from
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
if(slot == TileEntityCoffeeMachine.SLOT_OUTPUT){
|
||||||
}
|
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null;
|
||||||
|
theSlot.onSlotChange(newStack, currentStack);
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
}
|
||||||
|
//Other Slots in Inventory excluded
|
||||||
|
else if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(newStack.getItem() == InitItems.itemMisc && newStack.getItemDamage() == TheMiscItems.CUP.ordinal()){
|
||||||
|
if(!this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_INPUT, TileEntityCoffeeMachine.SLOT_INPUT+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(FluidRegistry.WATER, 1))){
|
||||||
|
if(!this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_WATER_INPUT, TileEntityCoffeeMachine.SLOT_WATER_INPUT+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(ItemCoffee.getIngredientFromStack(newStack) != null){
|
||||||
|
if(!this.mergeItemStack(newStack, 3, 11, false)) return null;
|
||||||
|
}
|
||||||
|
else if(newStack.getItem() == InitItems.itemCoffeeBean){
|
||||||
|
if(!this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS+1, false)) return null;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
|
||||||
|
else if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
|
else theSlot.onSlotChanged();
|
||||||
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
|
return currentStack;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,36 +78,33 @@ public class ContainerDrill extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(currentStack.getItem() != null){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
ItemStack newStack = theSlot.getStack();
|
||||||
if(currentStack.getItem() instanceof ItemDrillUpgrade){
|
ItemStack currentStack = newStack.copy();
|
||||||
this.mergeItemStack(newStack, 0, SLOT_AMOUNT, false);
|
|
||||||
}
|
//Other Slots in Inventory excluded
|
||||||
|
if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(newStack.getItem() instanceof ItemDrillUpgrade){
|
||||||
|
if(!this.mergeItemStack(newStack, 0, 5, false)) return null;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
else if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
}
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
|
else theSlot.onSlotChanged();
|
||||||
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
|
return currentStack;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,34 +46,32 @@ public class ContainerDropper extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(currentStack.getItem() != null){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
ItemStack newStack = theSlot.getStack();
|
||||||
this.mergeItemStack(newStack, 0, 9, false);
|
ItemStack currentStack = newStack.copy();
|
||||||
|
|
||||||
|
//Other Slots in Inventory excluded
|
||||||
|
if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(!this.mergeItemStack(newStack, 0, 10, false)){
|
||||||
|
//
|
||||||
|
if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false))
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
|
else theSlot.onSlotChanged();
|
||||||
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
|
return currentStack;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,29 +70,35 @@ public class ContainerEnergizer extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(currentStack.getItem() instanceof IEnergyContainerItem){
|
ItemStack newStack = theSlot.getStack();
|
||||||
this.mergeItemStack(newStack, 0, 1, false);
|
ItemStack currentStack = newStack.copy();
|
||||||
|
|
||||||
|
//Slots in Inventory to shift from
|
||||||
|
if(slot == 1){
|
||||||
|
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null;
|
||||||
|
theSlot.onSlotChange(newStack, currentStack);
|
||||||
|
}
|
||||||
|
//Other Slots in Inventory excluded
|
||||||
|
else if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(newStack.getItem() instanceof IEnergyContainerItem){
|
||||||
|
if(!this.mergeItemStack(newStack, 0, 1, false)) return null;
|
||||||
}
|
}
|
||||||
}
|
//
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
else if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
}
|
}
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
else theSlot.onSlotChanged();
|
else theSlot.onSlotChanged();
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
return currentStack;
|
return currentStack;
|
||||||
|
|
|
@ -61,7 +61,6 @@ public class ContainerEnervator extends Container{
|
||||||
return this.enervator.isUseableByPlayer(player);
|
return this.enervator.isUseableByPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO Armor Shift-Clicking
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
||||||
final int inventoryStart = 2;
|
final int inventoryStart = 2;
|
||||||
|
@ -70,31 +69,35 @@ public class ContainerEnervator extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(currentStack.getItem() instanceof IEnergyContainerItem){
|
ItemStack newStack = theSlot.getStack();
|
||||||
this.mergeItemStack(newStack, 0, 1, false);
|
ItemStack currentStack = newStack.copy();
|
||||||
|
|
||||||
|
//Slots in Inventory to shift from
|
||||||
|
if(slot == 1){
|
||||||
|
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null;
|
||||||
|
theSlot.onSlotChange(newStack, currentStack);
|
||||||
|
}
|
||||||
|
//Other Slots in Inventory excluded
|
||||||
|
else if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(newStack.getItem() instanceof IEnergyContainerItem){
|
||||||
|
if(!this.mergeItemStack(newStack, 0, 1, false)) return null;
|
||||||
}
|
}
|
||||||
}
|
//
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
else if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
else theSlot.onSlotChanged();
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
return currentStack;
|
return currentStack;
|
||||||
|
|
|
@ -35,40 +35,38 @@ public class ContainerFeeder extends Container{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
||||||
final int inventoryStart = 1;
|
final int inventoryStart = 9;
|
||||||
final int inventoryEnd = inventoryStart+26;
|
final int inventoryEnd = inventoryStart+26;
|
||||||
final int hotbarStart = inventoryEnd+1;
|
final int hotbarStart = inventoryEnd+1;
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(currentStack.getItem() != null){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
ItemStack newStack = theSlot.getStack();
|
||||||
this.mergeItemStack(newStack, 0, 1, false);
|
ItemStack currentStack = newStack.copy();
|
||||||
|
|
||||||
|
//Other Slots in Inventory excluded
|
||||||
|
if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(!this.mergeItemStack(newStack, 0, 1, false)){
|
||||||
|
//
|
||||||
|
if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false))
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
|
else theSlot.onSlotChanged();
|
||||||
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
|
return currentStack;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import ellpeck.actuallyadditions.tile.TileEntityFermentingBarrel;
|
||||||
import invtweaks.api.container.InventoryContainer;
|
import invtweaks.api.container.InventoryContainer;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -44,45 +43,42 @@ public class ContainerFermentingBarrel extends Container{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
||||||
final int inventoryStart = 4;
|
final int inventoryStart = 3;
|
||||||
final int inventoryEnd = inventoryStart+26;
|
final int inventoryEnd = inventoryStart+26;
|
||||||
final int hotbarStart = inventoryEnd+1;
|
final int hotbarStart = inventoryEnd+1;
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(currentStack.getItem() != null){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
ItemStack newStack = theSlot.getStack();
|
||||||
if(FluidContainerRegistry.containsFluid(currentStack, new FluidStack(InitBlocks.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME))){
|
ItemStack currentStack = newStack.copy();
|
||||||
this.mergeItemStack(newStack, 0, 1, false);
|
|
||||||
}
|
//Other Slots in Inventory excluded
|
||||||
if(currentStack.getItem() == Items.bucket){
|
if(slot >= inventoryStart){
|
||||||
this.mergeItemStack(newStack, 2, 3, false);
|
//Shift from Inventory
|
||||||
}
|
if(FluidContainerRegistry.getContainerCapacity(new FluidStack(InitBlocks.fluidOil, 1), newStack) > 0){
|
||||||
|
if(!this.mergeItemStack(newStack, 3, 4, false)) return null;
|
||||||
}
|
}
|
||||||
|
else if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(InitBlocks.fluidCanolaOil, 1))){
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
if(!this.mergeItemStack(newStack, 1, 2, false)) return null;
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
else if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
}
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
|
else theSlot.onSlotChanged();
|
||||||
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
|
return currentStack;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,43 +45,38 @@ public class ContainerFluidCollector extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(currentStack.getItem() != null){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
ItemStack newStack = theSlot.getStack();
|
||||||
if(this.collector.isPlacer){
|
ItemStack currentStack = newStack.copy();
|
||||||
if(FluidContainerRegistry.isBucket(currentStack) && !newStack.isItemEqual(FluidContainerRegistry.EMPTY_BUCKET)){
|
|
||||||
this.mergeItemStack(newStack, 0, 1, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if(newStack.isItemEqual(FluidContainerRegistry.EMPTY_BUCKET)){
|
|
||||||
this.mergeItemStack(newStack, 0, 1, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
//Slots in Inventory to shift from
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
if(slot == 1){
|
||||||
}
|
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null;
|
||||||
|
theSlot.onSlotChange(newStack, currentStack);
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
}
|
||||||
|
//Other Slots in Inventory excluded
|
||||||
|
else if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(FluidContainerRegistry.isEmptyContainer(newStack)){
|
||||||
|
if(!this.mergeItemStack(newStack, 0, 1, false)) return null;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
|
||||||
|
else if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
|
else theSlot.onSlotChanged();
|
||||||
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
|
return currentStack;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package ellpeck.actuallyadditions.inventory;
|
package ellpeck.actuallyadditions.inventory;
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
|
import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
|
||||||
|
import ellpeck.actuallyadditions.recipe.CrusherRecipeManualRegistry;
|
||||||
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
||||||
import ellpeck.actuallyadditions.tile.TileEntityFurnaceDouble;
|
import ellpeck.actuallyadditions.tile.TileEntityFurnaceDouble;
|
||||||
import invtweaks.api.container.InventoryContainer;
|
import invtweaks.api.container.InventoryContainer;
|
||||||
|
@ -9,7 +10,6 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
|
||||||
|
|
||||||
@InventoryContainer
|
@InventoryContainer
|
||||||
public class ContainerFurnaceDouble extends Container{
|
public class ContainerFurnaceDouble extends Container{
|
||||||
|
@ -47,37 +47,40 @@ public class ContainerFurnaceDouble extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(currentStack.getItem() != null){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
ItemStack newStack = theSlot.getStack();
|
||||||
if(FurnaceRecipes.smelting().getSmeltingResult(currentStack) != null){
|
ItemStack currentStack = newStack.copy();
|
||||||
this.mergeItemStack(newStack, TileEntityFurnaceDouble.SLOT_INPUT_1, TileEntityFurnaceDouble.SLOT_INPUT_1+1, false);
|
|
||||||
this.mergeItemStack(newStack, TileEntityFurnaceDouble.SLOT_INPUT_2, TileEntityFurnaceDouble.SLOT_INPUT_2+2, false);
|
//Slots in Inventory to shift from
|
||||||
|
if(slot == TileEntityFurnaceDouble.SLOT_OUTPUT_1 || slot == TileEntityFurnaceDouble.SLOT_OUTPUT_2){
|
||||||
|
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null;
|
||||||
|
theSlot.onSlotChange(newStack, currentStack);
|
||||||
|
}
|
||||||
|
//Other Slots in Inventory excluded
|
||||||
|
else if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(CrusherRecipeManualRegistry.getOutput(newStack, false) != null){
|
||||||
|
if(!this.mergeItemStack(newStack, TileEntityFurnaceDouble.SLOT_INPUT_1, TileEntityFurnaceDouble.SLOT_INPUT_1+1, false)){
|
||||||
|
if(!this.mergeItemStack(newStack, TileEntityFurnaceDouble.SLOT_INPUT_2, TileEntityFurnaceDouble.SLOT_INPUT_2+1, false)) return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
else if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
}
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
|
else theSlot.onSlotChanged();
|
||||||
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
|
return currentStack;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,34 +46,32 @@ public class ContainerGiantChest extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(currentStack.getItem() != null){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
ItemStack newStack = theSlot.getStack();
|
||||||
this.mergeItemStack(newStack, 0, 117, false);
|
ItemStack currentStack = newStack.copy();
|
||||||
|
|
||||||
|
//Other Slots in Inventory excluded
|
||||||
|
if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(!this.mergeItemStack(newStack, 0, 117, false)){
|
||||||
|
//
|
||||||
|
if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false))
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
|
else theSlot.onSlotChanged();
|
||||||
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
|
return currentStack;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,37 +53,42 @@ public class ContainerGrinder extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(currentStack.getItem() != null){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
ItemStack newStack = theSlot.getStack();
|
||||||
if(CrusherRecipeManualRegistry.getOutput(currentStack, false) != null){
|
ItemStack currentStack = newStack.copy();
|
||||||
this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_1, TileEntityGrinder.SLOT_INPUT_1+1, false);
|
|
||||||
if(this.isDouble) this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_2, TileEntityGrinder.SLOT_INPUT_2+1, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
//Slots in Inventory to shift from
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
if(slot == TileEntityGrinder.SLOT_OUTPUT_1_1 || slot == TileEntityGrinder.SLOT_OUTPUT_1_2 || slot == TileEntityGrinder.SLOT_OUTPUT_2_1 || slot == TileEntityGrinder.SLOT_OUTPUT_2_2){
|
||||||
}
|
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null;
|
||||||
|
theSlot.onSlotChange(newStack, currentStack);
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
}
|
||||||
|
//Other Slots in Inventory excluded
|
||||||
|
else if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(CrusherRecipeManualRegistry.getOutput(newStack, false) != null){
|
||||||
|
if(!this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_1, TileEntityGrinder.SLOT_INPUT_1+1, false)){
|
||||||
|
if(this.tileGrinder.isDouble){
|
||||||
|
if(!this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_2, TileEntityGrinder.SLOT_INPUT_2+1, false)) return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
|
||||||
|
else if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
|
else theSlot.onSlotChanged();
|
||||||
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
|
return currentStack;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,40 +51,38 @@ public class ContainerInputter extends Container{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
||||||
final int inventory = this.isAdvanced ? 25 : 1;
|
final int inventoryStart = this.isAdvanced ? 25 : 1;
|
||||||
final int inventoryEnd = inventory+26;
|
final int inventoryEnd = inventoryStart+26;
|
||||||
final int hotbar = inventoryEnd+1;
|
final int hotbarStart = inventoryEnd+1;
|
||||||
final int hotbarEnd = hotbar+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(currentStack.getItem() != null){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(slot <= hotbarEnd && slot >= inventory){
|
ItemStack newStack = theSlot.getStack();
|
||||||
this.mergeItemStack(newStack, 0, 1, false);
|
ItemStack currentStack = newStack.copy();
|
||||||
|
|
||||||
|
//Other Slots in Inventory excluded
|
||||||
|
if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(!this.mergeItemStack(newStack, 0, 1, false)){
|
||||||
|
//
|
||||||
|
if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false))
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbar){
|
|
||||||
this.mergeItemStack(newStack, inventory, inventoryEnd, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot <= inventoryEnd && slot >= inventory){
|
|
||||||
this.mergeItemStack(newStack, hotbar, hotbarEnd, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventory){
|
|
||||||
this.mergeItemStack(newStack, inventory, hotbarEnd, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
|
else theSlot.onSlotChanged();
|
||||||
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
|
return currentStack;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,36 +47,33 @@ public class ContainerOilGenerator extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(currentStack.getItem() != null){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
ItemStack newStack = theSlot.getStack();
|
||||||
if(FluidContainerRegistry.containsFluid(currentStack, new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME))){
|
ItemStack currentStack = newStack.copy();
|
||||||
this.mergeItemStack(newStack, 0, 1, false);
|
|
||||||
}
|
//Other Slots in Inventory excluded
|
||||||
|
if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(InitBlocks.fluidOil, 1))){
|
||||||
|
if(!this.mergeItemStack(newStack, 0, 1, false)) return null;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
else if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
}
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
|
else theSlot.onSlotChanged();
|
||||||
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
|
return currentStack;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,34 +46,32 @@ public class ContainerPhantomPlacer extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(currentStack.getItem() != null){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
ItemStack newStack = theSlot.getStack();
|
||||||
this.mergeItemStack(newStack, 0, 9, false);
|
ItemStack currentStack = newStack.copy();
|
||||||
|
|
||||||
|
//Other Slots in Inventory excluded
|
||||||
|
if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(!this.mergeItemStack(newStack, 0, 10, false)){
|
||||||
|
//
|
||||||
|
if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false))
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
|
else theSlot.onSlotChanged();
|
||||||
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
|
return currentStack;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,36 +44,33 @@ public class ContainerRepairer extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(currentStack.getItem() != null){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
ItemStack newStack = theSlot.getStack();
|
||||||
if(TileEntityItemRepairer.canBeRepaired(currentStack)){
|
ItemStack currentStack = newStack.copy();
|
||||||
this.mergeItemStack(newStack, TileEntityItemRepairer.SLOT_INPUT, TileEntityItemRepairer.SLOT_INPUT+1, false);
|
|
||||||
}
|
//Other Slots in Inventory excluded
|
||||||
|
if(slot >= inventoryStart){
|
||||||
|
//Shift from Inventory
|
||||||
|
if(TileEntityItemRepairer.canBeRepaired(newStack)){
|
||||||
|
if(!this.mergeItemStack(newStack, TileEntityItemRepairer.SLOT_INPUT, TileEntityItemRepairer.SLOT_INPUT+1, false)) return null;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
else if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
}
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
|
else theSlot.onSlotChanged();
|
||||||
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
|
return currentStack;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,30 +43,27 @@ public class ContainerXPSolidifier extends Container{
|
||||||
final int hotbarEnd = hotbarStart+8;
|
final int hotbarEnd = hotbarStart+8;
|
||||||
|
|
||||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||||
if(theSlot.getHasStack()){
|
|
||||||
ItemStack currentStack = theSlot.getStack();
|
|
||||||
ItemStack newStack = currentStack.copy();
|
|
||||||
|
|
||||||
if(currentStack.getItem() != null){
|
if (theSlot != null && theSlot.getHasStack()){
|
||||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
ItemStack newStack = theSlot.getStack();
|
||||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
ItemStack currentStack = newStack.copy();
|
||||||
|
|
||||||
|
//Other Slots in Inventory excluded
|
||||||
|
if(slot >= inventoryStart){
|
||||||
|
if(slot >= inventoryStart && slot <= inventoryEnd){
|
||||||
|
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null;
|
||||||
}
|
}
|
||||||
|
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(slot < inventoryStart){
|
|
||||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
|
||||||
else theSlot.onSlotChanged();
|
|
||||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
|
||||||
theSlot.onPickupFromSlot(player, newStack);
|
|
||||||
|
|
||||||
return currentStack;
|
|
||||||
}
|
}
|
||||||
|
else if(!this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)) return null;
|
||||||
|
|
||||||
|
if (newStack.stackSize == 0) theSlot.putStack(null);
|
||||||
|
else theSlot.onSlotChanged();
|
||||||
|
|
||||||
|
if (newStack.stackSize == currentStack.stackSize) return null;
|
||||||
|
theSlot.onPickupFromSlot(player, newStack);
|
||||||
|
|
||||||
|
return currentStack;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class ItemCoffee extends ItemFood implements INameableItem{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PotionEffect[] getEffectsFromStack(ItemStack stack){
|
public static PotionEffect[] getEffectsFromStack(ItemStack stack){
|
||||||
ArrayList<PotionEffect> effects = new ArrayList<PotionEffect>();
|
ArrayList<PotionEffect> effects = new ArrayList<>();
|
||||||
NBTTagCompound tag = stack.getTagCompound();
|
NBTTagCompound tag = stack.getTagCompound();
|
||||||
if(tag != null){
|
if(tag != null){
|
||||||
int counter = tag.getInteger("Counter");
|
int counter = tag.getInteger("Counter");
|
||||||
|
|
|
@ -77,18 +77,10 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
||||||
public void onButtonPressed(int buttonID, EntityPlayer player){
|
public void onButtonPressed(int buttonID, EntityPlayer player){
|
||||||
if(buttonID < this.buttonAmounts.length){
|
if(buttonID < this.buttonAmounts.length){
|
||||||
if(this.getPlayerXP(player) > 0){
|
if(this.getPlayerXP(player) > 0){
|
||||||
if(this.buttonAmounts[buttonID] != -999){
|
int xp = this.buttonAmounts[buttonID] == -999 ? this.getPlayerXP(player)/ItemSpecialDrop.SOLID_XP_AMOUNT : this.buttonAmounts[buttonID];
|
||||||
if(this.amount < Short.MAX_VALUE-this.buttonAmounts[buttonID] && this.getPlayerXP(player) >= ItemSpecialDrop.SOLID_XP_AMOUNT*this.buttonAmounts[buttonID]){
|
if(this.amount < Short.MAX_VALUE-xp && this.getPlayerXP(player) >= ItemSpecialDrop.SOLID_XP_AMOUNT*xp){
|
||||||
this.addPlayerXP(player, -(ItemSpecialDrop.SOLID_XP_AMOUNT*this.buttonAmounts[buttonID]));
|
this.addPlayerXP(player, -(ItemSpecialDrop.SOLID_XP_AMOUNT*xp));
|
||||||
if(!worldObj.isRemote) this.amount += this.buttonAmounts[buttonID];
|
if(!worldObj.isRemote) this.amount += xp;
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
int xp = this.getPlayerXP(player)/ItemSpecialDrop.SOLID_XP_AMOUNT;
|
|
||||||
if(this.amount < Short.MAX_VALUE-xp){
|
|
||||||
this.addPlayerXP(player, -(xp*ItemSpecialDrop.SOLID_XP_AMOUNT));
|
|
||||||
if(!worldObj.isRemote) this.amount += xp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue