KubeJS

KubeJS

61M Downloads

Use placed block's state instead of default state in BlockStateModifyPlacementCallbackJS

Spyeedy opened this issue ยท 0 comments

commented

Describe the feature

In BlockStateModifyPlacementCallbackJS, it passes in the block's default state in the super call. But shouldn't the block state of the placed block in the world be passed into the super?

I propose to change the super call in BlockStateModifyPlacementCallbackJS from

public BlockStateModifyPlacementCallbackJS(BlockPlaceContext context, Block block) {
  super(block.defaultBlockState());
  this.context = context;
  this.minecraftBlock = block;
  this.block = new BlockContainerJS(context.getLevel(), context.getClickedPos());
}

to be

public BlockStateModifyPlacementCallbackJS(BlockPlaceContext context, Block block) {
  super(blockPlaceContext.getLevel().getBlockState(blockPlaceContext.getClickedPos()));
  this.context = context;
  this.minecraftBlock = block;
  this.block = new BlockContainerJS(context.getLevel(), context.getClickedPos());
}

Additional info

If someone wishes to modify the block state through the BlockBuilder#placementState, the state they are given to modify will always be the default state, rather than the placed block's state. Hence my proposing this change