Jump to content

[1.11] Structure lights not updating


Kokkie

Recommended Posts

Hello, I made a structure for in my dimension but the lights of it aren't updated when it spawns, how can I fix this?

Code:

public class WorldGenCheeseHouse2 extends WorldGenerator {

private static final BlockStateMatcher IS_STONE = BlockStateMatcher.forBlock(CheeseBlocks.CHEESE_STONE);
private final ResourceLocation HOUSE = new ResourceLocation(Reference.MODID + ":cheese_house");

public boolean generate(World worldIn, Random rand, BlockPos position) {
	while (worldIn.isAirBlock(position) && position.getY() > 2) {
		position = position.down();
	}
	if (!IS_STONE.apply(worldIn.getBlockState(position))) {
		return false;
	}
        Random random = worldIn.getChunkFromChunkCoords(position.getX(), position.getZ()).getRandomWithSeed(987234911L);
        Rotation[] arotation = Rotation.values();
        Rotation rotation = arotation[random.nextInt(arotation.length)];
        ChunkPos chunkpos = new ChunkPos(position);
        StructureBoundingBox structureboundingbox = new StructureBoundingBox(chunkpos.getXStart() - 16, 0, chunkpos.getZStart() - 16, chunkpos.getXEnd() + 16, 256, chunkpos.getZEnd() + 16);
        PlacementSettings placementsettings = (new PlacementSettings()).setRotation(rotation).setBoundingBox(structureboundingbox).setRandom(random);
        MinecraftServer minecraftserver = worldIn.getMinecraftServer();
	TemplateManager templatemanager = worldIn.getSaveHandler().getStructureTemplateManager();
        Template template = templatemanager.getTemplate(minecraftserver, HOUSE);
        template.addBlocksToWorld(worldIn, position, placementsettings, 20);
	return true;
}

}

Image: https://i.gyazo.com/3a9a3f8df4d5c9dffebf815899a130bf.png

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Link to comment
Share on other sites

I'm not sure specifically about 1.11 but in previous versions you need to make sure that when you add the block to world that the lighting is updated. So you should check what your add block to world function is doing.

 

However, having lighting updated after every block placed can slow the generation of the structure, so maybe you should look for a way to update the chunk lighting once at the end of the structure generation.

 

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

Throw a tape deck turntable style at it while the record turns.

The pencils under the table and the lighter in the drawer.

 

-Spiders are funny  :P

 

-blue lighter is the color of the lighter btw. not white  8)

Thanks, now it works!

It didn't

 

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.