修复了集装箱的放置bug
This commit is contained in:
parent
a31702624f
commit
38b1ad9098
1 changed files with 4 additions and 2 deletions
|
@ -67,13 +67,15 @@ public class ContainerBlockItem extends BlockItem implements GeoItem {
|
|||
public InteractionResult place(BlockPlaceContext pContext) {
|
||||
ItemStack stack = pContext.getItemInHand();
|
||||
Player player = pContext.getPlayer();
|
||||
var res = super.place(pContext);
|
||||
|
||||
if (player != null) {
|
||||
var tag = BlockItem.getBlockEntityData(stack);
|
||||
if (tag != null && tag.get("Entity") != null && pContext.canPlace()) {
|
||||
if (tag != null && tag.get("Entity") != null && res == InteractionResult.SUCCESS) {
|
||||
player.getInventory().removeItem(stack);
|
||||
}
|
||||
}
|
||||
return super.place(pContext);
|
||||
return res;
|
||||
}
|
||||
|
||||
private PlayState predicate(AnimationState<ContainerBlockItem> event) {
|
||||
|
|
Loading…
Add table
Reference in a new issue