Fixed crash for unplacable Anvil
This commit is contained in:
parent
ab6d015c98
commit
2ba7ed4ec8
1 changed files with 3 additions and 1 deletions
|
@ -27,7 +27,9 @@ public class EndAnvilItem extends BaseAnvilItem {
|
||||||
BlockState blockState = super.getPlacementState(blockPlaceContext);
|
BlockState blockState = super.getPlacementState(blockPlaceContext);
|
||||||
ItemStack stack = blockPlaceContext.getItemInHand();
|
ItemStack stack = blockPlaceContext.getItemInHand();
|
||||||
int durability = stack.getOrCreateTag().getInt(DURABILITY);
|
int durability = stack.getOrCreateTag().getInt(DURABILITY);
|
||||||
blockState = blockState.setValue(((EndAnvilBlock) blockState.getBlock()).getDurability(), durability);
|
if (blockState!=null) {
|
||||||
|
blockState = blockState.setValue(((EndAnvilBlock) blockState.getBlock()).getDurability(), durability);
|
||||||
|
}
|
||||||
return blockState;
|
return blockState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue