Fixed Chest placement

This commit is contained in:
Tschipp 2020-09-06 17:20:59 +02:00
parent 63d7b6dec8
commit c03fab7b19

View File

@ -126,23 +126,23 @@ public class ItemCarryonBlock extends Item
BlockState placementState = containedblock.getStateForPlacement(new BlockItemUseContext(context)); BlockState placementState = containedblock.getStateForPlacement(new BlockItemUseContext(context));
BlockState actualState = containedstate; BlockState actualState = placementState;
for (IProperty<?> prop : placementState.getValues().keySet()) // for (IProperty<?> prop : placementState.getValues().keySet())
{ // {
if (prop instanceof DirectionProperty) // if (prop instanceof DirectionProperty)
actualState = actualState.with((DirectionProperty) prop, placementState.get((DirectionProperty) prop)); // actualState = actualState.with((DirectionProperty) prop, placementState.get((DirectionProperty) prop));
else if (prop == BlockStateProperties.WATERLOGGED) // else if (prop == BlockStateProperties.WATERLOGGED)
actualState = actualState.with((BooleanProperty) prop, placementState.get((BooleanProperty) prop)); // actualState = actualState.with((BooleanProperty) prop, placementState.get((BooleanProperty) prop));
else if(prop instanceof EnumProperty<?>) // else if(prop instanceof EnumProperty<?>)
{ // {
Object value = placementState.get(prop); // Object value = placementState.get(prop);
if(value instanceof Direction.Axis) // if(value instanceof Direction.Axis)
{ // {
actualState = actualState.with((EnumProperty)prop, (Direction.Axis)value); // actualState = actualState.with((EnumProperty)prop, (Direction.Axis)value);
} // }
} // }
} // }
BlockSnapshot snapshot = new BlockSnapshot(world, pos2, containedstate); BlockSnapshot snapshot = new BlockSnapshot(world, pos2, containedstate);
EntityPlaceEvent event = new EntityPlaceEvent(snapshot, world.getBlockState(pos), player); EntityPlaceEvent event = new EntityPlaceEvent(snapshot, world.getBlockState(pos), player);