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.

Babatunde

Members
  • Joined

  • Last visited

Everything posted by Babatunde

  1. Intellij IDEA Ultimate. Oh nice! completely forgot about that line lmao. This is what I've got so far, I'm kinda stuck because I have no idea what to do: public class ChangeTabListEvents { private final Field fieldPlayers = ObfuscationReflectionHelper.findField(SPlayerListItemPacket.class, "field_179769_b"); private final Field fieldDisplayName = ObfuscationReflectionHelper.findField(SPlayerListItemPacket.AddPlayerData.class, "field_179965_e"); @SubscribeEvent public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) { PlayerEntity player = event.getPlayer(); if (player.getServer() != null) { try { } catch (Throwable e) { e.printStackTrace(); } player.getServer().getPlayerList().sendPacketToAllPlayers(new SPlayerListItemPacket(SPlayerListItemPacket.Action.UPDATE_DISPLAY_NAME, (ServerPlayerEntity) player)); player.sendMessage(new KeybindTextComponent("Display name updated.")); } } } Do I need to get the list somehow, or do I need to make my own and set my list as the players list? And why do I need the 'displayName'? Thanks for the help so far, I appreciate it!
  2. Thanks for the tip. How do I do this tho?
  3. refreshDisplayName is from 1.12.2. A lot is the documentation is outdated. Thanks, I forgot that existed. I'm sorry, I've never worked with packets before. is there a tutorial or documentation on how to create packets?
  4. So, I've looked at reflection together with a friend of mine, but we could get it to work. We now have this: @SubscribeEvent public void onPlayerLogin(EntityJoinWorldEvent event) { if (event.getEntity() instanceof PlayerEntity) { PlayerEntity player = (PlayerEntity) event.getEntity(); if (player.getServer() != null) { ForgeEventFactory.getPlayerDisplayName(player, player.getGameProfile().getName()); try { Field field = ObfuscationReflectionHelper.findField(SPlayerListItemPacket.class, "field_179769_b"); } catch (Throwable e) { e.printStackTrace(); } player.getServer().getPlayerList().sendPacketToAllPlayers(new SPlayerListItemPacket(SPlayerListItemPacket.Action.UPDATE_DISPLAY_NAME, (ServerPlayerEntity) player)); player.sendMessage(new KeybindTextComponent("Display name updated.")); } } } field_179769_b = players from: private final List<SPlayerListItemPacket.AddPlayerData> players = Lists.newArrayList(); from the SPlayerListItemPacket class. That is the entries you were talking about right? But we don't know wat to do now. P.S. I'm still using the ForgeEventFactory because getDisplayname() wouldn't fire the even for some reason... Help would be much apriciated, thanks.
  5. That doesn't seem to work for me 🤔 This is what I got rn: public class ChangeTabListEvents { @SubscribeEvent public void onNameFormat(PlayerEvent.NameFormat event) { if (event.getEntity() instanceof PlayerEntity) { event.setDisplayname(event.getUsername() + " (" + event.getPlayer().getMaxHealth() + ")"); event.getEntity().sendMessage(new KeybindTextComponent("NameFormat event fired.")); } } @SubscribeEvent public void onPlayerLogin(EntityJoinWorldEvent event) { if (event.getEntity() instanceof PlayerEntity) { PlayerEntity player = (PlayerEntity) event.getEntity(); if (player.getServer() != null) { ForgeEventFactory.getPlayerDisplayName(player, player.getGameProfile().getName()); player.getServer().getPlayerList().sendPacketToAllPlayers(new SPlayerListItemPacket(SPlayerListItemPacket.Action.UPDATE_DISPLAY_NAME)); player.sendMessage(new KeybindTextComponent("Display name updated.")); } } } }
  6. How would I do this? I've never worked with packets before.
  7. Im not very familiar with client side mods but this should do the job: returns true if player is in Creative: Minecraft.getInstance().player.isCreative(); returns true if player is in Spectator: Minecraft.getInstance().player.isSpectator(); returns String of serverIP: Minecraft.getInstance().getCurrentServerData().serverIP;
  8. Hi everyone, I want to add a suffix to every players name, but I cant get it to work. I'm doing it like this: @SubscribeEvent public void onNameFormat(PlayerEvent.NameFormat event) { if (event.getEntity() instanceof PlayerEntity) { event.setDisplayname(event.getUsername() + " test"); } } If I use event.getDisplayname() it shows the name + test, but it doesn't change on the tab list. Do I need to somehow update the tab list for it to work or am I doing it completely wrong? Thanks!
  9. Hi Modders, I'm working on a mod where a player starts with 1 heart and every time they die they gain a heart until they have 10 hearts. But I struggling with how I save the amount a hearts the player has. If I put it in the player data, it will be deleted when the player dies. Same goes for capabilities. I've tried it with a Hashmap but I know its not the best way of doing thing so I'd like some feedback from you guys. Thanks.
  10. Wrong category, sorry.
  11. Hi Modders, I'm working on a mod where a player starts with 1 heart and every time they die they gain a heart until they have 10 hearts. But I struggling with how I save the amount a hearts the player has. If I put it in the player data, it will be deleted when the player dies. Same goes for capabilities. I've tried it with a Hashmap but I know its not the best way of doing thing so I'd like some feedback from you guys. Thanks. EDIT: I'm using 1.15.2 and 1.14.4.
  12. Ye, I've tried everything I could think of and I have done hours of research.
  13. I don't think there is a way to get the number of deaths with ServerPlayerEntity#getStats either
  14. You cant get the amount of deaths using the Stats class
  15. Hello Modders, Is there a way to get the number of deaths a player has from his statistics? MC version 1.15.2 I have been looking for a solution for hours but I cant find the answer.

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.