Jump to content

How many blocks per tick max is recommended for custom structure generation?


Recommended Posts

Posted

Okay, I made some progress based on suspicion that the lighting is causing the trouble. If you trace the code for setBlock, as mentioned before it updates the lighting. There are a few variables that control this and it seems that the whole thing is skipped if the world.provider.hasNoSky is true.

 

So I did a test where I set hasNoSky to true right before the generation loop, then set it back to false immediately after. Sure enough, the generation at height of 133 was just as fast (4 seconds) as generation at ground level.

 

[22:09:51] [server thread/ERROR]: Encountered an unexpected exception

net.minecraft.util.ReportedException: Exception ticking world

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:698) ~[MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) ~[MinecraftServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[integratedServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]

Caused by: java.lang.NullPointerException

at net.minecraft.world.chunk.storage.ExtendedBlockStorage.getExtSkylightValue(ExtendedBlockStorage.java:164) ~[ExtendedBlockStorage.class:?]

at net.minecraft.world.chunk.Chunk.getBlockLightValue(Chunk.java:824) ~[Chunk.class:?]

at net.minecraft.world.World.getFullBlockLightValue(World.java:857) ~[World.class:?]

at net.minecraft.world.World.func_147467_a(World.java:3133) ~[World.class:?]

at net.minecraft.world.WorldServer.func_147456_g(WorldServer.java:331) ~[WorldServer.class:?]

at net.minecraft.world.WorldServer.tick(WorldServer.java:191) ~[WorldServer.class:?]

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:692) ~[MinecraftServer.class:?]

... 4 more

[22:09:51] [server thread/ERROR]: This crash report has been saved to: E:\ModdingWorkspace\run\.\crash-reports\crash-2015-04-15_22.09.51-server.txt

[22:09:51] [server thread/INFO]: Stopping server

[22:09:51] [server thread/INFO]: Saving players

[22:09:51] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----

// Why is it breaking :(

 

Time: 4/15/15 10:09 PM

Description: Exception ticking world

 

java.lang.NullPointerException: Exception ticking world

at net.minecraft.world.chunk.storage.ExtendedBlockStorage.getExtSkylightValue(ExtendedBlockStorage.java:164)

at net.minecraft.world.chunk.Chunk.getBlockLightValue(Chunk.java:824)

at net.minecraft.world.World.getFullBlockLightValue(World.java:857)

at net.minecraft.world.World.func_147467_a(World.java:3133)

at net.minecraft.world.WorldServer.func_147456_g(WorldServer.java:331)

at net.minecraft.world.WorldServer.tick(WorldServer.java:191)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:692)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at net.minecraft.world.chunk.storage.ExtendedBlockStorage.getExtSkylightValue(ExtendedBlockStorage.java:164)

at net.minecraft.world.chunk.Chunk.getBlockLightValue(Chunk.java:824)

at net.minecraft.world.World.getFullBlockLightValue(World.java:857)

at net.minecraft.world.World.func_147467_a(World.java:3133)

at net.minecraft.world.WorldServer.func_147456_g(WorldServer.java:331)

at net.minecraft.world.WorldServer.tick(WorldServer.java:191)

 

 

So I have some more work to do to figure out how to surgically disable the light updates just during generation. There are a number of public chunk variables also involved so I've started playing around with changing them. One that I thought would work was to change the heightmap prior to generation, since it seems that if the heightmap and block set position don't have gap it wouldn't update lighting, but that didn't speed it up. So I'll keep looking.

 

But overall I guess my advice is that setBlock is slower the higher you do it, but up to a factor of 5.

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

Posted

The fastest way to do it would be to access the chunk's

extendedblockstorage

arrays directly.  Build the structure, then in a last-pass do a standard

setBlock()

somewhere (possibly several?) to update the lighting once, rather than after every block.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

The fastest way to do it would be to access the chunk's

extendedblockstorage

arrays directly.  Build the structure, then in a last-pass do a standard

setBlock()

somewhere (possibly several?) to update the lighting once, rather than after every block.

 

Yeah, that seems like the next logical step. I'll try that.

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

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.