2015-08-18 20:40:55 -04:00
|
|
|
package team.chisel.inventory;
|
2014-04-21 19:13:15 +01:00
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
|
import net.minecraft.inventory.Slot;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
public class SlotChiselInput extends Slot {
|
|
|
|
|
|
|
|
|
|
public SlotChiselInput(ContainerChisel container, InventoryChiselSelection inv, int i, int j, int k) {
|
|
|
|
|
super(inv, i, j, k);
|
|
|
|
|
selInventory = inv;
|
|
|
|
|
this.container = container;
|
|
|
|
|
}
|
2023-01-29 10:09:28 -08:00
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
@Override
|
|
|
|
|
public boolean isItemValid(ItemStack itemstack) {
|
2023-08-18 03:10:44 -05:00
|
|
|
return !container.finished && !container.carving.getItemsForChiseling(itemstack)
|
|
|
|
|
.isEmpty() && super.isItemValid(itemstack);
|
2015-01-07 19:50:18 -05:00
|
|
|
}
|
2023-01-29 10:09:28 -08:00
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
@Override
|
|
|
|
|
public boolean canTakeStack(EntityPlayer par1EntityPlayer) {
|
|
|
|
|
return !container.finished && super.canTakeStack(par1EntityPlayer);
|
|
|
|
|
}
|
2023-01-29 10:09:28 -08:00
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
@Override
|
|
|
|
|
public void onSlotChanged() {
|
|
|
|
|
if (container.finished) return;
|
2023-01-29 10:09:28 -08:00
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
super.onSlotChanged();
|
2020-11-24 08:06:51 +03:00
|
|
|
selInventory.setCurrentScroll(0);
|
2015-01-07 19:50:18 -05:00
|
|
|
selInventory.updateItems();
|
|
|
|
|
}
|
2023-01-29 10:09:28 -08:00
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
ContainerChisel container;
|
|
|
|
|
InventoryChiselSelection selInventory;
|
2014-04-21 19:13:15 +01:00
|
|
|
}
|