Jump to content
  • Home
  • Files
  • Docs
Status Updates
  • All Content

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Babatunde

Babatunde

Members
 View Profile  See their activity
  • Content Count

    15
  • Joined

    November 28, 2020
  • Last visited

    Saturday at 09:51 PM

 Content Type 

  • All Activity

Profiles

  • Status Updates
  • Status Replies

Forums

  • Topics
  • Posts

Calendar

  • Events

Everything posted by Babatunde

  1. Babatunde

    [1.15.2] Change player name in Tab List (Player List)

    Babatunde replied to Babatunde's topic in Modder Support

    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!
    • January 16
    • 14 replies
  2. Babatunde

    [1.15.2] Change player name in Tab List (Player List)

    Babatunde replied to Babatunde's topic in Modder Support

    Thanks for the tip. How do I do this tho?
    • January 15
    • 14 replies
  3. Babatunde

    [1.15.2] Change player name in Tab List (Player List)

    Babatunde replied to Babatunde's topic in Modder Support

    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?
    • January 15
    • 14 replies
  4. Babatunde

    [1.15.2] Change player name in Tab List (Player List)

    Babatunde replied to Babatunde's topic in Modder Support

    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.
    • January 14
    • 14 replies
  5. Babatunde

    [1.15.2] Change player name in Tab List (Player List)

    Babatunde replied to Babatunde's topic in Modder Support

    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.")); } } } }
    • January 14
    • 14 replies
  6. Babatunde

    [1.15.2] Change player name in Tab List (Player List)

    Babatunde replied to Babatunde's topic in Modder Support

    How would I do this? I've never worked with packets before.
    • January 14
    • 14 replies
  7. Babatunde

    [Any Version] How to get server ip/gamemode (Hypixel)

    Babatunde replied to jacrispys's topic in Modder Support

    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;
    • January 14
    • 3 replies
  8. Babatunde

    [1.15.2] Change player name in Tab List (Player List)

    Babatunde posted a topic in Modder Support

    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!
    • January 14
    • 14 replies
  9. Babatunde

    [1.14.4] What is the best way of saving data on player?

    Babatunde posted a topic in Modder Support

    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.
    • January 9
    • 1 reply
  10. Babatunde

    Save data on death

    Babatunde replied to Babatunde's topic in Modder Support

    Wrong category, sorry.
    • January 9
    • 2 replies
  11. Babatunde

    Save data on death

    Babatunde posted a topic in Modder Support

    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.
    • January 9
    • 2 replies
  12. Babatunde

    Player Statistics

    Babatunde replied to Babatunde's topic in Modder Support

    Ye, I've tried everything I could think of and I have done hours of research.
    • November 28, 2020
    • 7 replies
  13. Babatunde

    Player Statistics

    Babatunde replied to Babatunde's topic in Modder Support

    I don't think there is a way to get the number of deaths with ServerPlayerEntity#getStats either
    • November 28, 2020
    • 7 replies
  14. Babatunde

    Player Statistics

    Babatunde replied to Babatunde's topic in Modder Support

    You cant get the amount of deaths using the Stats class
    • November 28, 2020
    • 7 replies
  15. Babatunde

    Player Statistics

    Babatunde posted a topic in Modder Support

    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.
    • November 28, 2020
    • 7 replies
  • All Activity
  • Home
  • Babatunde
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community