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.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -156,10 +157,14 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(StackUtil.isValid(this.slots.getStackInSlot(1)) && this.slots.getStackInSlot(1).getItem() instanceof ItemSolidifiedExperience){
|
ItemStack stack = this.slots.getStackInSlot(1);
|
||||||
this.amount += StackUtil.getStackSize(this.slots.getStackInSlot(1));
|
if(StackUtil.isValid(stack) && stack.getItem() instanceof ItemSolidifiedExperience){
|
||||||
this.slots.setStackInSlot(1, StackUtil.getNull());
|
int remainingSpace = MathHelper.clamp(Integer.MAX_VALUE - amount, 0, stack.getCount());
|
||||||
this.markDirty();
|
if(stack.getCount() >= remainingSpace && remainingSpace != 0) {
|
||||||
|
this.amount += remainingSpace;
|
||||||
|
stack.shrink(remainingSpace);
|
||||||
|
this.markDirty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.lastAmount != this.amount && this.sendUpdateWithInterval()){
|
if(this.lastAmount != this.amount && this.sendUpdateWithInterval()){
|
||||||
|
@ -170,13 +175,19 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return false;
|
return i == 1 && stack.getItem() == InitItems.itemSolidifiedExperience;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExtractItem(int slot, ItemStack stack){
|
public boolean canExtractItem(int slot, ItemStack stack){
|
||||||
return true;
|
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
|
@Override
|
||||||
public void onButtonPressed(int buttonID, EntityPlayer player){
|
public void onButtonPressed(int buttonID, EntityPlayer player){
|
||||||
|
|
Loading…
Reference in a new issue