Jump to content

Recommended Posts

Posted (edited)

Hello, so after tons of debugging, I found out the PlayerEvent.StartTracking event is server-side only. Can anyone confirm this for me?

 

If that's the case, is there any client-sided event that would allow me to detect hostile mobs in player's area, more specifically boss mobs? Or is that considered a cheat?

Where could I find this information about events myself? The Forge documentation doesn't list events nor what they do (or am I wrong?).

 

Thanks for help.

Edited by Sorashi
Posted (edited)

Nobody cares what is considered a cheat. 

 

Why exactly are you looking for ways to check mobs in your area on the client side? 

 

If you want to get a list of mobs in the player's area one way I can think of off the top of my head is to make a tickhandler that gets entities from the world using something like this: 

 

List players = world.getEntitiesWithinAABB(EntityPlayer.class, //or use EntityMob since you're looking for mobs.
     new AxisAlignedBB(
       playerCoord.x - area,
       playerCoord.y - area,
       playerCoord.z - area,
       playerCoord.x + area,
       playerCoord.y + area,
       playerCoord.z + area)); //formatted so it's not a huge string of text. 

    for(int i = 0; i < players.size(); i++){
        do stuff
    }

 

 

which gets you a list of all players around the player. I'm fairly sure that method should work just fine on the client.  (Though I might be mistaken.) (Edit: I just tested it out, it works pretty fine!)

 

If you want to keep using that event you could alternatively try sending a packet to the client. But if you're making a radar of sorts there's not really any reason to bother the client with it. Unless you really want to.  If you're doing anything to these other entities, however. You probably do want to make a packet and execute your code Server side.

Edited by oldcheese
  • Like 1
Posted
4 minutes ago, oldcheese said:

which gets you a list of all players around the player. I'm fairly sure that method should work just fine on the client.  (Though I might be mistaken.)

Why wouldn't it? Mobs still exist on the client.

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.

Posted (edited)
7 minutes ago, Draco18s said:

Why wouldn't it? Mobs still exist on the client.

I was 99% Sure it would. But considering I've never had to track mobs on the client I didn't want to make any false promises. I started out by typing that it would work, but then my insecurities got the better of me. 

 

I actually just tested it. It works like a charm.

Edited by oldcheese

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.