Jump to content

[1.8] Messing with trackers.


Ernio

Recommended Posts

This probably goes to diesieben :D

 

Is it safe to remove player from another player's tracker? And how?

 

Expected results: When joining game 1st time you should get "uncloseable" GUI with "something". During that time I need player to be not targetable by mobs (there is even for that), immortal (also event). And invisible to other players from "code" side.

 

So I was like: Let's remove this guy from that guy's tracker in PlayerEvent.StartTracking. Sadly - not possible (not cancelable).

 

Is there a way (read: easy way, one I missed) to make other clients not know about certain player?

 

P.S: What stops "us" from making PlayerEvent.StartTracking cancelable? (aside fact that it is called after adding entity to tracker)

Eventually - make additional event (since StartTracking is called after all updates are made in EntityTrackerEntry#updatePlayerEntity()) before anything even happens - like PlayerEvent.CanTrack?

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Removing a player from another player's tracker wouldn't technically make them 'invisible' to code - the tracker is only responsible for sending updates about an entity's position / state to the various client players tracking it; the server still knows everything, but the player would probably appear 'stuck' to other players. At least that's how I understand the tracking system.

 

However, if you want the player to be basically invincible + unmovable etc, the simplest way I have found is to cancel the LivingUpdateEvent, possibly in addition to the LivingHurtEvent.

Link to comment
Share on other sites

However, if you want the player to be basically invincible + unmovable etc, the simplest way I have found is to cancel the LivingUpdateEvent, possibly in addition to the LivingHurtEvent.

That I know.

 

And "invisible from code" I mean clients, server obviously has to know its shit :D

 

I want one client to not know about other client aside from player list it receives (you know, Tab-player-list).

More accurate definition to "invisible from code" is simply - client won't construct EntityPlayer when it should (and should = when you start tracking other player), but when I allow it to do so.

 

Understanding of trackers is not as simple as it seems - mainly because it's still obfuscated as hell!

I am currently looking for a place to insert custom CanTrack event (and PR it maybe), but damn - gotta make sure nothing can break.

 

Just note: Removing entity from other's tracker will also cause server to not know who tracks whom - I know that. So unless there is a way to say "don't send update packet of this guy to this guy" I want to say "just don't track him" which will give same effect on client side, only server will know even less.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Considering how much code alredy happens in every tick, I'd say that adding one boolean check per CanTrack won't suddenly cause massive performance issue. Hell, I'd even say that it's good that server would retry to add entity until you allow it to do so.

 

Problem rather lies in fact that (not sure about it yet, still reading trackers) that before it would ask "should this guy track this entity", the server has to perform all those chunk-checks if it really should even begin asking. That's bigger performance hit than just a few mod-checks :P

 

As long as event wouldn't be too widely used and only in special-mod cases, this might be a good idea (yet still: While I've seen mods that could utilize it, the hook itself is quite specific, so for most will be useless).

 

Meh, anyway - I alredy used few other events to make client-sided player literally untouchable until confirmation so... gotta other things to code for now. :D

 

Thanks guys :)

 

If anyone sees potential in adding this to Forge, like said: for "special mods cases", give me feedback if I should dig into it.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

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.