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

Hello everyone! I am very new to developing with Forge (I am used to Bukkit/Spigot), and I was hoping someone could shed some light on how to change a player's nametag based on how much health they have. For instance:

public void onNameTag(AsyncPlayerReceiveNameTagEvent event) {

if (event.getPlayer().getHealth == 20.0f) {

event.setTag(player.getName() + " 20HP");

}else{

//other stuff

}

}

I want this to work on both servers, and local worlds. I don't believe I have to send packets, because I only want this to appear client-side. In theory, it should set the nametag above every player,who has full health, to display their original name + "20HP". I want to thank anyone who responds to this in advance.

PlayerEvent.NameFormat is only event that gives you power over this feature.

 

If you want more complex displays you will need RenderWorldLastEvent and render tags on your own.

 

Note to you:

As you are Bukkit/Spigot guy - you need to see that Forge is Modding platform, while others are "plugins". Big difference is the fact that forge ships tools that allow you to do almost anything, but has no ver-specific-like-bukkit-ones. If you want to have more fun with "plugins" rather that real modding I suggest SpongeAPI (edit) for Forge.

 

EDIT

Diesieben was faster. :x

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.