Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Solved] [1.10.2] How to get the biome a player is in?

Featured Replies

Posted

Hello! I am currently trying to make a client side mod (my signature), and I am trying to use "onClientTick", but I am not really sure how it works. Could somebody explain to me what it does?

 

This is my current code:

 

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onClientTick(ClientTickEvent event) {
final Minecraft minecraft = FMLClientHandler.instance().getClient();
final WorldClient world = minecraft.theWorld;
final EntityPlayerSP player = minecraft.thePlayer;

System.out.println("Client Event");
}

 

"Client Event" is not being printed out into console at all, so is it even doing anything?

 

Edit: I am reading an outdated wiki, and it says something like registering the event.. How do I do that? O.o

I am on my journey of making a remake of matmos, as explained here.

Hmm? ClientTickEvent already gives you the EntityPlayer (and through it, the world as EntityPlayer#worldObj)

Minecraft is already Client-Side, so simply use "Minecraft minecraft = Minecraft.getMinecraft()".

 

Try this instead:

@SubscribeEvent
public void onClientTick(TickEvent.PlayerTickEvent event){
	final Minecraft minecraft = Minecraft.getMinecraft();
	final EntityPlayer player = event.player;
	final World world = player.worldObj;
}

 

Also, have you registered the event-handler to any bus? If it's not registered, it's not going to do anything.

 

To get the biome, as this topic is about, you need to get the player's position, then use world#getBiomeForCoordsBody(BlockPos)

 

 

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

  • Author

Alright. How do I register the event? (Sorry for all the noobish stuff  :-\)

 

Edit: Figured out how to register it!

I am on my journey of making a remake of matmos, as explained here.

To register an event, you need to register it to a bus. You should use the basic EVENT_BUS here.

Create a private final instance of your EventHandler class. For example, using my eventhandler from one of my mods, called UnderworldMapEventHandler.class,

I would use

private final UnderworldMapEventHandler ANY_NAME_YOU_LIKE = new UnderworldMapEventHandler();

Then in your proxy, register it simply with:

MinecraftForge.EVENTBUS.register(ANY_NAME_YOU_LIKE);

(For those you who sees the issue with event->bus here, don't worry, my own eventhandler uses the TERRAIN_GEN_BUS)

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Guest
This topic is now closed to further replies.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.