Fixed crash with workbench output

Clicking on the output slot with some output items in hand without
having ingredients in storage would cause a crash due to MC thinking it
could actually take the stack anyway.
This commit is contained in:
Emmanuel BENOîT 2016-07-23 09:43:23 +02:00
parent 6b84b38eaa
commit 9d64709e5a

View file

@ -37,6 +37,21 @@ public class TBWBCraftingSlot
}
@Override
public boolean canTakeStack( EntityPlayer playerIn )
{
if ( !this.getHasStack( ) ) {
return false;
}
final I_CraftingRecipeWrapper wrapper = this.container.getCurrentRecipe( );
if ( wrapper == null ) {
return false;
}
final IInventory storage = this.container.getStorage( );
return storage != null && wrapper.getRequirements( ).checkInventory( storage , 1 , this.container.world );
}
@Override
public ItemStack decrStackSize( final int amount )
{