Jump to content

[1.16.4] Structure generation leads to NBT read/write errors


GenElectrovise

Recommended Posts

I am trying to add my OvergroundShrineFeature to different Biomes. For reference, I have been using the RuinedPortalStructure and its various dependants (i.e. RuinedPortalFeature and its configurations) for reference.

 

I am able to register the Structure, and I am able to register its StructureFeatures.

 

When I use a /locate magiksmostevile:overground_shrine command in game (which it suggests to autocomplete), I get the message "The structure could not be found", as if it were simply very far away, however as I move around, I receive a lot of errors saying that there is either a error reading or writing NBT data. I tracked the error back to writing the References tag (something is null but I can't tell what), but it doesn't always fail there. I can't view some of the variables in debug mode on my IDE, so I can't see exactly what is being written when an exception is thrown...

 

To me, this suggests that I have taken something from the vanilla code that I should not have done, and that there is a better, more "Forge-y", way to handle this.

How should I be managing structure generation?

 

Thanks!

 

Edit: I should add that my Structure.Start class is never called, nor is any other part of the building process: I know because I put breakpoints on them all and nothing is triggered after the structure is added to biomes. Perhaps these NBT errors occur when the game tries to load my structure from NBT, it fails, and terminates the building?

 

====

 

Active GitHub branch: https://github.com/GenElectrovise/MagiksMostEvile/tree/feature/1.16.4/reinstate_shrines

World-Gen package: https://github.com/GenElectrovise/MagiksMostEvile/tree/feature/1.16.4/reinstate_shrines/src/main/java/genelectrovise/magiksmostevile/common/world/gen

DeferredRegistry: https://github.com/GenElectrovise/MagiksMostEvile/blob/feature/1.16.4/reinstate_shrines/src/main/java/genelectrovise/magiksmostevile/common/core/registry/EvileDeferredRegistry.java

 

====

 

Register Structure:

public static final DeferredRegister<Structure<?>> STRUCTURES =
    DeferredRegister.create(ForgeRegistries.STRUCTURE_FEATURES, MagiksMostEvile.MODID);

public static final RegistryObject<Structure<OvergroundShrineFeatureConfig>> OVERGROUND_SHRINE =
    STRUCTURES.register("overground_shrine", () -> new OvergroundShrineStructure());

 

Register StructureFeatures:

// Called in FMLCommonSetupEvent

// Register a different one for each EnumFeatureLocation so that it is generated differently in each case

// Default
OVERGROUND_SHRINE_DEFAULT = StructureAspectRegistrationManager.registerStructureFeature(
    MagiksMostEvile.MODID + ":overground_shrine/default",
    EvileDeferredRegistry.OVERGROUND_SHRINE.get()
        .withConfiguration(new OvergroundShrineFeatureConfig(EnumFeatureLocation.DEFAULT)));

 

Error message (loading NBT only):

[28Dec2020 13:15:51.534] [Server thread/ERROR] [net.minecraft.world.server.ChunkManager/]: Couldn't load chunk [-22, 9]
java.util.concurrent.CompletionException: net.minecraft.crash.ReportedException: Loading NBT data
	at java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:375) ~[?:1.8.0_241]
	at java.util.concurrent.CompletableFuture.join(CompletableFuture.java:1947) ~[?:1.8.0_241]
	at net.minecraft.world.chunk.storage.IOWorker.func_227090_a_(IOWorker.java:64) ~[forge:?]
	at net.minecraft.world.chunk.storage.ChunkLoader.readChunk(ChunkLoader.java:57) ~[forge:?]
	at net.minecraft.world.server.ChunkManager.loadChunkData(ChunkManager.java:831) ~[forge:?]
	at net.minecraft.world.server.ChunkManager.lambda$chunkLoad$14(ChunkManager.java:493) ~[forge:?]
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604) ~[?:1.8.0_241]
	at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:139) ~[forge:?]
	at net.minecraft.world.server.ServerChunkProvider$ChunkExecutor.run(ServerChunkProvider.java:512) ~[forge:?]
	at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:109) ~[forge:?]
	at net.minecraft.world.server.ServerChunkProvider$ChunkExecutor.driveOne(ServerChunkProvider.java:520) ~[forge:?]
	at net.minecraft.world.server.ServerChunkProvider.driveOneTask(ServerChunkProvider.java:270) ~[forge:?]
	at net.minecraft.server.MinecraftServer.driveOneInternal(MinecraftServer.java:746) ~[forge:?]
	at net.minecraft.server.MinecraftServer.driveOne(MinecraftServer.java:735) ~[forge:?]
	at net.minecraft.util.concurrent.ThreadTaskExecutor.drainTasks(ThreadTaskExecutor.java:97) ~[forge:?]
	at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:720) ~[forge:?]
	at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:667) ~[forge:?]
	at net.minecraft.server.MinecraftServer.lambda$startServer$0(MinecraftServer.java:233) ~[forge:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_241]
Caused by: net.minecraft.crash.ReportedException: Loading NBT data
	at net.minecraft.nbt.CompoundNBT.loadNBT(CompoundNBT.java:526) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT.access$200(CompoundNBT.java:31) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT$1.readNBT(CompoundNBT.java:53) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT$1.readNBT(CompoundNBT.java:40) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT.loadNBT(CompoundNBT.java:520) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT.access$200(CompoundNBT.java:31) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT$1.readNBT(CompoundNBT.java:53) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT$1.readNBT(CompoundNBT.java:40) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT.loadNBT(CompoundNBT.java:520) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT.access$200(CompoundNBT.java:31) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT$1.readNBT(CompoundNBT.java:53) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT$1.readNBT(CompoundNBT.java:40) ~[forge:?]
	at net.minecraft.nbt.CompressedStreamTools.read(CompressedStreamTools.java:129) ~[forge:?]
	at net.minecraft.nbt.CompressedStreamTools.read(CompressedStreamTools.java:99) ~[forge:?]
	at net.minecraft.nbt.CompressedStreamTools.read(CompressedStreamTools.java:92) ~[forge:?]
	at net.minecraft.world.chunk.storage.RegionFileCache.readChunk(RegionFileCache.java:51) ~[forge:?]
	at net.minecraft.world.chunk.storage.IOWorker.lambda$func_227090_a_$2(IOWorker.java:54) ~[forge:?]
	at net.minecraft.world.chunk.storage.IOWorker.lambda$null$8(IOWorker.java:99) ~[forge:?]
	at net.minecraft.util.concurrent.ITaskQueue$RunnableWithPriority.run(ITaskQueue.java:61) ~[forge:?]
	at net.minecraft.util.concurrent.DelegatedTaskExecutor.driveOne(DelegatedTaskExecutor.java:88) ~[forge:?]
	at net.minecraft.util.concurrent.DelegatedTaskExecutor.driveWhile(DelegatedTaskExecutor.java:132) ~[forge:?]
	at net.minecraft.util.concurrent.DelegatedTaskExecutor.run(DelegatedTaskExecutor.java:100) ~[forge:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_241]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_241]
	... 1 more
Caused by: java.io.EOFException
	at java.io.DataInputStream.readUnsignedShort(DataInputStream.java:340) ~[?:1.8.0_241]
	at java.io.DataInputStream.readUTF(DataInputStream.java:589) ~[?:1.8.0_241]
	at java.io.DataInputStream.readUTF(DataInputStream.java:564) ~[?:1.8.0_241]
	at net.minecraft.nbt.CompoundNBT.readKey(CompoundNBT.java:515) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT.access$100(CompoundNBT.java:31) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT$1.readNBT(CompoundNBT.java:50) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT$1.readNBT(CompoundNBT.java:40) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT.loadNBT(CompoundNBT.java:520) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT.access$200(CompoundNBT.java:31) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT$1.readNBT(CompoundNBT.java:53) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT$1.readNBT(CompoundNBT.java:40) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT.loadNBT(CompoundNBT.java:520) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT.access$200(CompoundNBT.java:31) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT$1.readNBT(CompoundNBT.java:53) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT$1.readNBT(CompoundNBT.java:40) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT.loadNBT(CompoundNBT.java:520) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT.access$200(CompoundNBT.java:31) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT$1.readNBT(CompoundNBT.java:53) ~[forge:?]
	at net.minecraft.nbt.CompoundNBT$1.readNBT(CompoundNBT.java:40) ~[forge:?]
	at net.minecraft.nbt.CompressedStreamTools.read(CompressedStreamTools.java:129) ~[forge:?]
	at net.minecraft.nbt.CompressedStreamTools.read(CompressedStreamTools.java:99) ~[forge:?]
	at net.minecraft.nbt.CompressedStreamTools.read(CompressedStreamTools.java:92) ~[forge:?]
	at net.minecraft.world.chunk.storage.RegionFileCache.readChunk(RegionFileCache.java:51) ~[forge:?]
	at net.minecraft.world.chunk.storage.IOWorker.lambda$func_227090_a_$2(IOWorker.java:54) ~[forge:?]
	at net.minecraft.world.chunk.storage.IOWorker.lambda$null$8(IOWorker.java:99) ~[forge:?]
	at net.minecraft.util.concurrent.ITaskQueue$RunnableWithPriority.run(ITaskQueue.java:61) ~[forge:?]
	at net.minecraft.util.concurrent.DelegatedTaskExecutor.driveOne(DelegatedTaskExecutor.java:88) ~[forge:?]
	at net.minecraft.util.concurrent.DelegatedTaskExecutor.driveWhile(DelegatedTaskExecutor.java:132) ~[forge:?]
	at net.minecraft.util.concurrent.DelegatedTaskExecutor.run(DelegatedTaskExecutor.java:100) ~[forge:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_241]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_241]
	... 1 more

 

 

Edited by GenElectrovise
Easier for people to read

How to ask a good coding question: https://stackoverflow.com/help/how-to-ask

Give logs, code, desired effects, and actual effects. Be thorough or we can't help you. Don't post code without putting it in a code block (the <> button on the post - select "C-type Language"): syntax highlighting makes everything easier, and it keeps the post tidy.

 

My own mod, Magiks Most Evile: GitHub (https://github.com/GenElectrovise/MagiksMostEvile) Wiki (https://magiksmostevile.fandom.com/wiki/Magiks_Most_Evile_Wiki)

Edit your own signature at https://www.minecraftforge.net/forum/settings/signature/

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.