Jump to content

[1.14] Freezes when calling World.getChunk() during chunk loading


felinoid

Recommended Posts

I'm trying to update my mod to 1.14, and I'm having trouble with the part where I replace Minecraft horses with my custom horses. I subscribe to OnEntityJoinWorld events, but when I try to spawn my custom horse in response, the game never loads the chunk. If it happens in the loading screen the game freezes at 100%, or if it happens when a chunk is generated as part of exploration the chunk never loads. My event subscribed code seems to be getting stuck on World.getChunk called from within EntityType.spawn, presumably because it's getting called when the chunk isn't fully loaded yet. Is there a way around this?

Link to comment
Share on other sites

https://github.com/tiffanyjager/horse-colors/blob/master/src/main/java/horse_colors/HorseReplacer.java

 

The problem still happens when replaceHorses is reduced to

    @SubscribeEvent
    public static void replaceHorses(EntityJoinWorldEvent event)
    {
        // We don't want to replace subclasses of horses
        if (event.getEntity().getClass() == HorseEntity.class
            && !event.getWorld().isRemote)
        {
            HorseEntity horse = (HorseEntity)event.getEntity();
            HorseGeneticEntity newHorse = ModEntities.HORSE_GENETIC.spawn(event.getWorld(), null, null, null, new BlockPos(horse), SpawnReason.CONVERSION, false, false);
        }
    }

 

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.