Jump to content

Recommended Posts

Posted
Just now, diesieben07 said:

Define "certain thing". It does not help if you are vague... Please describe exactly what you want to happen in terms of a user, not how you intend to program it.

 

I want to display text when it finds that fake player in the tab list.

So I tried looping through the tab list, to try and find the player - but it doesn't work, the only thing I get is null.

Posted
Just now, diesieben07 said:

Where do you want to display that text? What text? Always?

 

I already got the text part, it works very well. The only thing I need is to detect the player being in the tab list :) I could make it work without a problem, if it didn't return a null

Posted (edited)
6 minutes ago, diesieben07 said:

Dude... 

What returns null? When called from where? You need to show proper code, not just snippets...

 
 

I explained it before in this exact post. I said that I had this inside a methood that runs on the text render event.

Collection<NetworkPlayerInfo> users = mc.getNetHandler().getPlayerInfoMap();
        for (NetworkPlayerInfo cuser : users) {
            System.out.println("LOOK AT THIS DAMMIT! " + cuser.getDisplayName());
        }

 

This code should get the playerinfomap (all the users in the tab list) and put them inside users. after that I tried looping through all the users inside the users collection and outputing the resultes.

All it did is output "LOOK AT THIS DAMMIT! null" like this exactly. So was I doing something wrong? all I wanted to do here ^ is just display all the users that exist inside the tab list.

Edited by Bets
Posted
8 minutes ago, diesieben07 said:

NetworkPlayerInfo::getDisplayName is for an overridden display name that is not the user's username. Look at GuiPlayerTabOverlay::getPlayerName.

 

Tried doing this, game crashed.

Collection<GuiPlayerTabOverlay> users = (Collection<GuiPlayerTabOverlay>) mc.ingameGUI.getTabList();
        for (GuiPlayerTabOverlay cuser : users) {
            System.out.println("LOOK AT THIS DAMMIT! " + cuser.getPlayerName((NetworkPlayerInfo) users));
        }

 

Posted
17 hours ago, diesieben07 said:

What... what is that even? Those casts do not make any sense.

GuiIngame::getTabList returns GuiPlayerTabOverlay. You can't just cast that to Collection<GuiPlayerTabOverlay> and expect it to magically work.

You then also cast a Collection<GuiPlayerTabOverlay> to NetworkPlayerInfo, which makes even less sense.

 

Haha, sorry I am really bad at this stuff right now, all the casting things.

Can you maybe point the way I should go towards? like what casts should I use etc

Posted

Casting isn't hard. You can only cast an object to something that it already is.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements




×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.