diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java index c7633dc74..1f3f7dac6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java @@ -67,6 +67,16 @@ public class BlockGiantChest extends BlockContainerBase{ } } + @Override + public boolean isFullCube(IBlockState state){ + return false; + } + + @Override + public boolean isOpaqueCube(IBlockState state){ + return false; + } + @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java index a224ac39e..7e3f04bf7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java @@ -11,6 +11,7 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; +import de.ellpeck.actuallyadditions.mod.items.ItemSolidifiedExperience; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier; import net.minecraft.entity.player.EntityPlayer; @@ -27,7 +28,8 @@ public class ContainerXPSolidifier extends Container{ public ContainerXPSolidifier(InventoryPlayer inventory, TileEntityBase tile){ this.solidifier = (TileEntityXPSolidifier)tile; - this.addSlotToContainer(new SlotOutput(this.solidifier, 0, 80, 8)); + this.addSlotToContainer(new SlotOutput(this.solidifier, 0, 95, 8)); + this.addSlotToContainer(new Slot(this.solidifier, 1, 65, 8)); for(int i = 0; i < 3; i++){ for(int j = 0; j < 9; j++){ @@ -41,7 +43,7 @@ public class ContainerXPSolidifier extends Container{ @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot){ - int inventoryStart = 1; + int inventoryStart = 2; int inventoryEnd = inventoryStart+26; int hotbarStart = inventoryEnd+1; int hotbarEnd = hotbarStart+8; @@ -54,7 +56,12 @@ public class ContainerXPSolidifier extends Container{ //Other Slots in Inventory excluded if(slot >= inventoryStart){ - if(slot >= inventoryStart && slot <= inventoryEnd){ + if(newStack.getItem() instanceof ItemSolidifiedExperience){ + if(!this.mergeItemStack(newStack, 1, 2, false)){ + return null; + } + } + else if(slot >= inventoryStart && slot <= inventoryEnd){ if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ return null; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java index cf5190a36..26119c278 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java @@ -21,7 +21,7 @@ import net.minecraft.util.EnumFacing; public class TileEntityXPSolidifier extends TileEntityInventoryBase implements IButtonReactor{ - private static final Integer[] XP_MAP = new Integer[256]; + private static final int[] XP_MAP = new int[256]; static{ for(int i = 0; i < XP_MAP.length; i++){ @@ -30,13 +30,17 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } private final int[] buttonAmounts = new int[]{1, 5, 10, 20, 30, 40, 50, 64, -999}; - public short amount; - private short lastAmount; + public int amount; + private int lastAmount; public TileEntityXPSolidifier(){ - super(1, "xpSolidifier"); + super(2, "xpSolidifier"); } + /* + * The below methods were excerpted from EnderIO by SleepyTrousers with permission, thanks! + */ + public static int getExperienceForLevel(int level){ if(level >= 0 && level < XP_MAP.length){ return XP_MAP[level]; @@ -85,10 +89,6 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I return (int)(getExperienceForLevel(player.experienceLevel)+(player.experience*player.xpBarCap())); } - /* - * The below methods were excerpted from EnderIO by SleepyTrousers with permission, thanks! - */ - public static void addPlayerXP(EntityPlayer player, int amount){ int experience = Math.max(0, getPlayerXP(player)+amount); player.experienceTotal = experience; @@ -100,13 +100,13 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I @Override public void writeSyncableNBT(NBTTagCompound compound, NBTType type){ super.writeSyncableNBT(compound, type); - compound.setShort("Amount", this.amount); + compound.setInteger("Amount", this.amount); } @Override public void readSyncableNBT(NBTTagCompound compound, NBTType type){ super.readSyncableNBT(compound, type); - this.amount = compound.getShort("Amount"); + this.amount = compound.getInteger("Amount"); } @Override @@ -126,6 +126,11 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I this.amount -= toAdd; } } + + if(this.slots[1] != null && this.slots[1].getItem() instanceof ItemSolidifiedExperience){ + this.amount+=this.slots[1].stackSize; + this.slots[1] = null; + } if(this.lastAmount != this.amount && this.sendUpdateWithInterval()){ this.lastAmount = this.amount; diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiXPSolidifier.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiXPSolidifier.png index f31beeab4..505fc681a 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/gui/guiXPSolidifier.png and b/src/main/resources/assets/actuallyadditions/textures/gui/guiXPSolidifier.png differ