Closed fierceeo closed 4 years ago
Hi, this is actually normal behaviour. What your code is doing, is changing the shape of all GRASS blocks from a cube to a pole.
What you probably want to do, is create a new block with a grass type and the shape of a pole.
Block customBlock = Block.builder()
.name(BlockIds.getName(TypeIds.GRASS, ShapeIds.POLE)) // this is a helper method to create a generic name: "grass-pole_up"
.shape(ShapeIds.POLE)
.type(TypeIds.GRASS)
.solid(true)
.transparent(false)
.usingMultipleImages(true)
.build();
BlockRegistry blockRegistry = BlocksConfig.getInstance().getBlockRegistry();
blockRegistry.register(customBlock);
To retrieve the block from the registry, use:
Block grassPoleBlock = blockRegistry.get(BlockIds.getName(TypeIds.GRASS, ShapeIds.POLE));
Now you can place this block wherever you want:
chunkManager.addBlock(blockLocation.subtract(0.5f, 0.5f, 0.5f), customBlock);
Thanks for the info and the explanation, that solved my issue :)
When placing a block in a chunk that is different then all the current blocks in that chunk, all the blocks in that chunk will become the block that you placed.
Screenshot:
Note: I am placing blocks using this code: Block myBlock = blockRegistry.get(BlockIds.GRASS); myBlock.setShape(ShapeIds.POLE); chunkManager.addBlock(blockLocation.subtract(0.5f, 0.5f, 0.5f), myBlock)
I am using blocks version: 1.6.3 and minie version: 3.0.0+debug