diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiXPSolidifier.java index a790dec2b..f859e2203 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiXPSolidifier.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiXPSolidifier.java @@ -69,6 +69,7 @@ public class GuiXPSolidifier extends GuiContainer{ @Override public void actionPerformed(GuiButton button){ PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer)); + this.solidifier.onButtonPressed(button.id, Minecraft.getMinecraft().thePlayer); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java index 0414ce095..8f03f4f7d 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java @@ -76,17 +76,19 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I @Override public void onButtonPressed(int buttonID, EntityPlayer player){ if(buttonID < this.buttonAmounts.length){ - 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])); - this.amount += this.buttonAmounts[buttonID]; + 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)); - this.amount += xp; + else{ + int xp = this.getPlayerXP(player)/ItemSpecialDrop.SOLID_XP_AMOUNT; + if(this.amount < Short.MAX_VALUE-xp){ + this.addPlayerXP(player, -(xp*ItemSpecialDrop.SOLID_XP_AMOUNT)); + if(!worldObj.isRemote) this.amount += xp; + } } } } @@ -111,7 +113,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } private int getExperienceForLevel(int level){ - if(level != 0){ + if(level > 0){ if(level > 0 && level < 16) return level*17; else if(level > 15 && level < 31) return (int)(1.5*Math.pow(level, 2)-29.5*level+360); else return (int)(3.5*Math.pow(level, 2)-151.5*level+2220);