carpetmod112
carpetmod112 copied to clipboard
Added lifetime tracker
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
commandLifeTimewith default valuetrue - Added
/lifetimecommand - Added lifetime tracker initializing hook at
carpet.CarpetServer#onLoadAllWorlds - Ported method
cinMessangerclass for easier porting
Minecraft
All modification to the minecraft codes are commented with // CM lifetime tracker
- Created methods in
WorldServerandEntityfor the tracker - Added method hooks at tons of places where entity gets created or removed
- Make some private stuffs in
EntitySelectorpublic for/lifetime filtersub 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




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?
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
done, btw if you search tab character in the carpet package there are some mixing tabs tho xd
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 ?
Yeah it should, commands is only for the interface with the user
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