Jump to content

Can forge api detect biome edge transition event?


tyon2006

Recommended Posts

I'm working on a mod to perform an action to the player when a biome transition is detected. Example, I walk from a minecraft:plains biome to a minecraft:forest biome and then my action occurs. I have not been able to find an event to hook into that can listen for a biome edge transition. I'm coding in 1.12.2. Any suggestions?

Link to comment
Share on other sites

11 hours ago, tyon2006 said:

I'm stumped on how to get the string of the biome name. Could you lend a hand?

 

To elaborate. I am stuck here:

 

Capture.PNG

I am no longer stumped. Here's how I got the biome. This example just prints it to console. 

 

    @SubscribeEvent
    public void checkBiomeOnTick(PlayerTickEvent event) {
        //get player's current position
        BlockPos playerPosition = event.player.getPosition();
        //get world biome from players current position
        Biome currentBiome = event.player.getEntityWorld().getBiomeForCoordsBody(playerPosition);        
        //get biome name data and convert to string
        String biomeNameString = currentBiome.getBiomeName();
        //print biome name to console
        System.out.println(biomeNameString);
    }

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.