mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Made the XP Solidifier work perfectly now
This commit is contained in:
parent
8cced0ee38
commit
d43583d843
2 changed files with 14 additions and 11 deletions
|
@ -69,6 +69,7 @@ public class GuiXPSolidifier extends GuiContainer{
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(GuiButton button){
|
public void actionPerformed(GuiButton button){
|
||||||
PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer));
|
PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer));
|
||||||
|
this.solidifier.onButtonPressed(button.id, Minecraft.getMinecraft().thePlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -76,17 +76,19 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
||||||
@Override
|
@Override
|
||||||
public void onButtonPressed(int buttonID, EntityPlayer player){
|
public void onButtonPressed(int buttonID, EntityPlayer player){
|
||||||
if(buttonID < this.buttonAmounts.length){
|
if(buttonID < this.buttonAmounts.length){
|
||||||
|
if(this.getPlayerXP(player) > 0){
|
||||||
if(this.buttonAmounts[buttonID] != -999){
|
if(this.buttonAmounts[buttonID] != -999){
|
||||||
if(this.amount < Short.MAX_VALUE-this.buttonAmounts[buttonID] && this.getPlayerXP(player) >= ItemSpecialDrop.SOLID_XP_AMOUNT*this.buttonAmounts[buttonID]){
|
if(this.amount < Short.MAX_VALUE-this.buttonAmounts[buttonID] && this.getPlayerXP(player) >= ItemSpecialDrop.SOLID_XP_AMOUNT*this.buttonAmounts[buttonID]){
|
||||||
this.addPlayerXP(player, -(ItemSpecialDrop.SOLID_XP_AMOUNT*this.buttonAmounts[buttonID]));
|
this.addPlayerXP(player, -(ItemSpecialDrop.SOLID_XP_AMOUNT*this.buttonAmounts[buttonID]));
|
||||||
this.amount += this.buttonAmounts[buttonID];
|
if(!worldObj.isRemote) this.amount += this.buttonAmounts[buttonID];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
int xp = this.getPlayerXP(player)/ItemSpecialDrop.SOLID_XP_AMOUNT;
|
int xp = this.getPlayerXP(player)/ItemSpecialDrop.SOLID_XP_AMOUNT;
|
||||||
if(this.amount < Short.MAX_VALUE-xp){
|
if(this.amount < Short.MAX_VALUE-xp){
|
||||||
this.addPlayerXP(player, -(xp*ItemSpecialDrop.SOLID_XP_AMOUNT));
|
this.addPlayerXP(player, -(xp*ItemSpecialDrop.SOLID_XP_AMOUNT));
|
||||||
this.amount += xp;
|
if(!worldObj.isRemote) this.amount += xp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +113,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getExperienceForLevel(int level){
|
private int getExperienceForLevel(int level){
|
||||||
if(level != 0){
|
if(level > 0){
|
||||||
if(level > 0 && level < 16) return level*17;
|
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 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);
|
else return (int)(3.5*Math.pow(level, 2)-151.5*level+2220);
|
||||||
|
|
Loading…
Reference in a new issue