mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Closes #809
This commit is contained in:
parent
7a171c939a
commit
5dbd7aa414
1 changed files with 16 additions and 5 deletions
|
@ -21,6 +21,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -156,11 +157,15 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
|||
}
|
||||
}
|
||||
|
||||
if(StackUtil.isValid(this.slots.getStackInSlot(1)) && this.slots.getStackInSlot(1).getItem() instanceof ItemSolidifiedExperience){
|
||||
this.amount += StackUtil.getStackSize(this.slots.getStackInSlot(1));
|
||||
this.slots.setStackInSlot(1, StackUtil.getNull());
|
||||
ItemStack stack = this.slots.getStackInSlot(1);
|
||||
if(StackUtil.isValid(stack) && stack.getItem() instanceof ItemSolidifiedExperience){
|
||||
int remainingSpace = MathHelper.clamp(Integer.MAX_VALUE - amount, 0, stack.getCount());
|
||||
if(stack.getCount() >= remainingSpace && remainingSpace != 0) {
|
||||
this.amount += remainingSpace;
|
||||
stack.shrink(remainingSpace);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
if(this.lastAmount != this.amount && this.sendUpdateWithInterval()){
|
||||
this.lastAmount = this.amount;
|
||||
|
@ -170,7 +175,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
|||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return false;
|
||||
return i == 1 && stack.getItem() == InitItems.itemSolidifiedExperience;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -178,6 +183,12 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
if(amount < 0) amount = Integer.MAX_VALUE; //don't u go negative on me weird number
|
||||
super.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onButtonPressed(int buttonID, EntityPlayer player){
|
||||
if(buttonID < this.buttonAmounts.length){
|
||||
|
|
Loading…
Reference in a new issue