Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added lifetime tracker #156

Open
wants to merge 4 commits into
base: staging
Choose a base branch
from

Conversation

Fallen-Breath
Copy link

@Fallen-Breath Fallen-Breath commented Jun 21, 2021

Ported from Carpet TIS Addition v1.20.0, code modified from TISCarpet13

Doc: https://github.com/TISUnion/TISCarpet113/blob/TIS-Server/docs/Features.md#lifetime

/lifetime tracking [start|stop|restart|realtime]
/lifetime filter <entity_type> [set <selector>|clear]
/lifetime <entity_type> [life_time|spawning|removal [realtime]]

Codes

All related classes of lifetime tracker are in package carpet.commands.lifetime

See the change files for more details

Carpet

  • Added rule commandLifeTime with default value true
  • Added /lifetime command
  • Added lifetime tracker initializing hook at carpet.CarpetServer#onLoadAllWorlds
  • Ported method c in Messanger class for easier porting

Minecraft

All modification to the minecraft codes are commented with // CM lifetime tracker

  • Created methods in WorldServer and Entity for the tracker
  • Added method hooks at tons of places where entity gets created or removed
  • Make some private stuffs in EntitySelector public for /lifetime filter sub command

Issue

Due to mob being able to spawn outside of the spawning sphere, mobs with DESPAWN_IMMEDIATELY removal reason might spam in the statistic. It can be fixed with rule optimizedDespawnRange enabled

Showcase

image

image

image

image

@Earthcomputer
Copy link
Collaborator

My goodness that's a lot of code! Before I start reviewing it properly, can you reindent your added files with 4 spaces rather than tabs?

@Fallen-Breath
Copy link
Author

My goodness that's a lot of code! Before I start reviewing it properly, can you reindent your added files with 4 spaces rather than tabs?

Ahhh right I forgot that, one second

ported from Carpet TIS Addition 1.20.0
@Fallen-Breath
Copy link
Author

Fallen-Breath commented Jun 21, 2021

done, btw if you search tab character in the carpet package there are some mixing tabs tho xd

@kerbaras
Copy link
Collaborator

I haven't started reviewing it yet as well, but one simple thoguth so far. I'm not sure the trackers should be under the commands packet but rather under utls/helpers or just its own space. any thougths on that @Earthcomputer ?

@Earthcomputer
Copy link
Collaborator

Yeah it should, commands is only for the interface with the user

@Fallen-Breath
Copy link
Author

Now all lifetime tracker stuffs are moved to the helpers package. I also finished the filter support for the tracker and updated the pr description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants