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