feat: only input slot change need rebuild

This commit is contained in:
RiggZh committed 2025-04-17 08:40:56 +08:00
1 parent f377cac87d
commit 6aba01fb2c
1 file changed
+17 -1
@@ -53,9 +53,25 @@ public class ToolStationLogic extends InventoryLogic implements ISidedInventory
return new ToolStationContainer(inventoryplayer, this);
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack) {
super.setInventorySlotContents(slot, stack);
if (slot != 0) {
buildTool(toolName);
}
}
@Override
public ItemStack decrStackSize(int slot, int amount) {
ItemStack itemstack = super.decrStackSize(slot, amount);
if (slot != 0) {
buildTool(toolName);
}
return itemstack;
}
@Override
public void markDirty() {
buildTool(toolName);
if (this.worldObj != null) {
this.blockMetadata = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord);
this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);