Jump to content

[1.19.2, SOLVED] Mob spawn at world generation \ game freezed


Kosh

Recommended Posts

Hello. How can I spawn my animal at world generation?

 

My animal class - https://github.com/NightKosh/Sophisticated-wolves/blob/feature/1.19.2_update/src/main/java/sophisticated_wolves/entity/SophisticatedWolf.java

 

I've read a few totorials, about it, and add :

1) biome modifier - https://github.com/NightKosh/Sophisticated-wolves/blob/feature/1.19.2_update/src/main/resources/data/sophisticated_wolves/forge/biome_modifier/sophisticated_wolves_spawn_biome_modifier.json

2) SpawnPlacementRegisterEvent - https://github.com/NightKosh/Sophisticated-wolves/blob/ba79daeeb2d6bc08814c6b5976491b381ba8bcb1/src/main/java/sophisticated_wolves/event/EventsEntity.java#L28

but for some reasons my game freezed when I entered to a place where mob should be spawned.

"debug" and "latest" logs have no helpfull information.

 

Edited by Kosh
Link to comment
Share on other sites

You need to look at the stacktrace of the thread that is deadlocked or looping.

You can do that either with a debugger or if you are running from the command line, the jdk tool jstack will give you a thread dump.

https://www.baeldung.com/java-thread-dump

 

But I would guess your problem is in the finalise spawn/biome access.

Here you are accessing the level directly:

https://github.com/NightKosh/Sophisticated-wolves/blob/fb176ace6d9c25ec13ffccd7003d926405601f06/src/main/java/sophisticated_wolves/entity/SophisticatedWolf.java#L410

But it is called indirectly from world generation here:

https://github.com/NightKosh/Sophisticated-wolves/blob/fb176ace6d9c25ec13ffccd7003d926405601f06/src/main/java/sophisticated_wolves/entity/SophisticatedWolf.java#L160

You should be using the LevelAccessor not the Level so you get the data from the ProtoChunk (the chunk while it is being generated)

Otherwise it will go something like this:

1) Minecraft needs to generate a chunk

2) Chunk decides to spawn your entity

3) You ask for the biome of the chunk from the real level data, but the chunk is not loaded yet, it still being generated

4) Minecraft puts the thread in a wait state until the chunk has finished generating, but it never will be because the thread doing the generation is now waiting on itself.

Edited by warjort
  • Like 1

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

  • Kosh changed the title to [1.19.2, SOLVED] Mob spawn at world generation \ game freezed

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.



×
×
  • Create New...

Important Information

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