Fixed all Shift-Click Mechanics

This commit is contained in:
Ellpeck 2015-07-15 09:28:01 +02:00
parent d43583d843
commit 5a25595fa1
21 changed files with 473 additions and 494 deletions

View file

@ -46,35 +46,33 @@ 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();
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
//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 && slot >= inventoryStart){
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
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);
}
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;
}
}

View file

@ -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,32 +50,32 @@ 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(currentStack.getItem() == Items.bucket){
this.mergeItemStack(newStack, 1, 2, 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);
//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;
}
else if(slot <= inventoryEnd && slot >= inventoryStart){
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
else if(FluidContainerRegistry.getContainerCapacity(new FluidStack(InitBlocks.fluidCanolaOil, 1), newStack) > 0){
if(!this.mergeItemStack(newStack, 1, 2, false)) return null;
}
//
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);
else theSlot.onSlotChanged();
if (newStack.stackSize == currentStack.stackSize) return null;
theSlot.onPickupFromSlot(player, newStack);

View file

@ -43,30 +43,29 @@ 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();
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
//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;
}
//
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);
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);

View file

@ -60,46 +60,48 @@ 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);
//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 <= 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);
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;
}
}

View file

@ -78,37 +78,34 @@ 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();
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, 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;
}
//
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);
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;
}

View file

@ -46,35 +46,33 @@ 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();
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
//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 && slot >= inventoryStart){
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
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);
}
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;
}
}

View file

@ -70,28 +70,34 @@ 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();
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
//Slots in Inventory to shift from
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);
//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;
}
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);
else theSlot.onSlotChanged();
if (newStack.stackSize == currentStack.stackSize) return null;
theSlot.onPickupFromSlot(player, newStack);

View file

@ -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,30 +69,34 @@ 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();
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
//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;
}
//
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);
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);

View file

@ -35,41 +35,39 @@ 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();
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
//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 && slot >= inventoryStart){
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
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);
}
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;
}
}

View file

@ -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,46 +43,43 @@ 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();
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
//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;
}
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);
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;
}
}

View file

@ -45,44 +45,39 @@ 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);
//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 <= 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);
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;
}
}

View file

@ -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,38 +47,41 @@ 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();
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, 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;
}
}
//
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);
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;
}
}

View file

@ -46,35 +46,33 @@ 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();
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
//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 && slot >= inventoryStart){
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
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);
}
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;
}
}

View file

@ -53,38 +53,43 @@ 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);
//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 <= 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);
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;
}
}

View file

@ -51,41 +51,39 @@ 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();
if(slot <= hotbarEnd && slot >= hotbar){
this.mergeItemStack(newStack, inventory, inventoryEnd, false);
//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 && slot >= inventory){
this.mergeItemStack(newStack, hotbar, hotbarEnd, false);
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false))
return null;
}
else if(slot < inventory){
this.mergeItemStack(newStack, inventory, hotbarEnd, false);
}
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;
}
}

View file

@ -47,37 +47,34 @@ 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();
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+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;
}
//
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);
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;
}
}

View file

@ -46,35 +46,33 @@ 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();
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
//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 && slot >= inventoryStart){
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
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);
}
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;
}
}

View file

@ -44,37 +44,34 @@ 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();
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+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;
}
//
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);
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;
}
}

View file

@ -43,31 +43,28 @@ 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();
else if(slot <= inventoryEnd && slot >= inventoryStart){
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
//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 < inventoryStart){
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
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;
}
}

View file

@ -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");

View file

@ -77,22 +77,14 @@ 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));
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;
}
}
}
}
}
private int getPlayerXP(EntityPlayer player){
return (int)(this.getExperienceForLevel(player.experienceLevel)+(player.experience*player.xpBarCap()));