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 MinecraftForge, can you please help me? If you can do it yourself that would be wonderful but I'm trying to get the Player's IGN once you hit them. Is there a way of doing that.

 

OBJECTIVE:

If you a hit player it will add them to a ArrayList called "Friends" once you hit another player it will clear the ArrayList and add the other player, so my idea is like

 

if(Player is hit)

Friends.clear();

Friends.add(Player's Display Name);

To get access to when Player1 hits Player2, I would recommend you subscribe to the LivingHurtEvent and check if both attacker and victim are players, along with whatever other parameters you require.

 

You can get access to the Player's display name from Entity#getDisplayNameString. (Player's extend Entity.)

If you are going to do anything with that however, for example saving it, to compare later, I would heavily recommend you use the UUID instead, and simply translate it to the Player's name from the UUID. If the player ever change his name, a name-dependent system will break.

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

Nah, Its not going to be permanent once you close MC and reopen its suppose to not save or do anything, everything is reset, its just temporary friends. I wouldn't need anything to worry about changing names :P Probably should've mentioned that...

1. Version?

2. Sided mod (present on server) or client-only?

3. Should friend list be ever saved (quit/join world/server)?

4. The logic you described:

 

if(Player is hit)

Friends.clear();

Friends.add(Player's Display Name);

 

...will end up with List being of size == 0 or 1. Is this desired outcome? If yes - don't use List. Make direct reference to EntityPlayer (or null).

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.