I’m trying to show a bounding box between two points when a player clicks on a certain block. I’ve come up with this code where i spawn in the world a structure block with the desired bounding box and then i send a client change to actually not showing the structure block but only the bounding box (not the cleanest of the solutions, i know…)
Location<World> location = player.getLocation();
location.setBlock(BlockTypes.STRUCTURE_BLOCK.getDefaultState());
TileEntity structureTileEntity = location.getTileEntity().get();
StructureData structureData = structureTileEntity.getOrCreate(StructureData.class).get();
structureData.set(structureData.size().set(new Vector3i(10, 10, 10)));
structureData.set(structureData.showBoundingBox().set(true));
structureData.set(structureData.mode().set(StructureModes.LOAD));
structureTileEntity.offer(structureData);
player.sendBlockChange(location.getBlockPosition(), BlockTypes.COBBLESTONE.getDefaultState()); // Should show client side a cobblestone block, not the structure block
However the last line doesn’t work, i expected to see a cobblestone block where the structure block is but instead i see the structure block. What am i missing in order to make this work? And also is there a proper way to show a bounding box?