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

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

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.

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

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.