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.

Featured Replies

Posted

This only happened on 1.9. Here's what I am trying to do.

private boolean msgShown = false;
@SubscribeEvent
public void onTick(TickEvent.PlayerTickEvent event) {
if (!msgShown) {
  event.player.addChatMessage(new TextComponentString("Text 1"));
  Minecraft.getMinecraft().thePlayer.addChatMessage(new TextComponentString("Text 2"));
  msgShown = true;
}
}

Both of these lines work in 1.7.10 - 1.8.9. But in 1.9 I got NullPointerException with Ticking player when opening a world. I don't really know why it doesn't work. I'm using the latest version of Forge for 1.9 ???

I'll post the log if you need to.

The tick event is client and server side so this line should cause a problem on the server side in every minecraft version

Minecraft.getMinecraft().thePlayer.addChatMessage(new TextComponentString("Text 2"));

 

Logs would be helpful.

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

  • Author

The tick event is client and server side so this line should cause a problem on the server side in every minecraft version

Minecraft.getMinecraft().thePlayer.addChatMessage(new TextComponentString("Text 2"));

 

Logs would be helpful.

Interesting, that worked in the previous versions......

Oh well, thanks for the help. (Now I feel kinda dumb.)

MC#thePlayer is the client player which you control.

 

This event is fired for server and client sides - for EVERY player in all server worlds AND for every player in MC#theWorld (client has only one world).

 

Proper way to access player: event.player

 

Additionally: This event has 2 phases (fired twice per tick) - use event.phase to pick ONE.

 

Next: Learn @SideOnly:

http://www.minecraftforge.net/forum/index.php/topic,22764.0.html

 

Also: If you want to only ever use this to display stuff for MC#thePlayer - use ClientTickEvent registered from ClientProxy. That one is fired for client only and can safely use MC#thePlayer.

1.7.10 is no longer supported by forge, you are on your own.

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...

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.