Cutting knife fixes (#3619)

Fixes #3226
This commit is contained in:
fscan
2018-07-14 21:03:27 +02:00
committed by GitHub
parent fe4db2eb98
commit 67c733b418
@@ -156,15 +156,22 @@ public class ContainerQuartzKnife extends AEBaseContainer
private void makePlate()
{
if( !this.getItemHandler().extractItem( 0, 1, false ).isEmpty() )
if( Platform.isServer() )
{
final ItemStack item = ContainerQuartzKnife.this.toolInv.getItemStack();
item.damageItem( 1, ContainerQuartzKnife.this.getPlayerInv().player );
if( item.getCount() == 0 )
if( !this.getItemHandler().extractItem( 0, 1, false ).isEmpty() )
{
ContainerQuartzKnife.this.getPlayerInv().mainInventory.add( ContainerQuartzKnife.this.getPlayerInv().currentItem, ItemStack.EMPTY );
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( ContainerQuartzKnife.this.getPlayerInv().player, item, null ) );
final ItemStack item = ContainerQuartzKnife.this.toolInv.getItemStack();
final ItemStack before = item.copy();
item.damageItem( 1, ContainerQuartzKnife.this.getPlayerInv().player );
if( item.getCount() == 0 )
{
ContainerQuartzKnife.this.getPlayerInv()
.setInventorySlotContents( ContainerQuartzKnife.this.getPlayerInv().currentItem, ItemStack.EMPTY );
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( ContainerQuartzKnife.this.getPlayerInv().player, before, null ) );
}
ContainerQuartzKnife.this.detectAndSendChanges();
}
}
}