-
Notifications
You must be signed in to change notification settings - Fork 11
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
[Rewrite] Custom Mobs #78
[Rewrite] Custom Mobs #78
Conversation
Seems like very sane changes, don't be afraid to involve GuineaPigs for testing. Please tag me when it's ready to be merged |
@GallowsDove if you could look this over some and let me know if there's anything obvious I should change, just so that once I'm sure it's stable I've already got the code how you want it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, sorry for the long wait!
Since no issues have been found I'm going ahead and marking this ready for review lol |
Testing Status
Currently this PR is not tested in any way, I need to do extensive testing
Description
This PR aims to rewrite the custom mob system (without any changes to the end functionality hopefully) to have improved performance, code readability and just cleanup in general.
Proposed generic changes
Utils#getNearbyPlayersInSurvival(Location, double, double, double)
this method is just a utility since you had loops frequently that all did the same thing, filter down to players in survival, there is also an overloaded method with just one double if the radius on each axis is identical@ParametersNonnullByDefault
instead of a lot of@Nonnull
annotationsProposed changes to CustomMob
SCANNED_CHUNKS
a Set of ChunkPositions, andMOB_CACHE
a map ofCustomMob -> Set<UUID>
cacheEntity(Entity)
anduncacheEntity(Entity)
respectivelyonEntityDeath
that callsuncacheEntity
, and I have added the annotation@OverridingMethodsMustInvokeSuper
and followed that in all the overriding methods as well to ensure that it is always called.spawn
event now callscacheEntity
Proposed changes to MobTicker
getWorlds.getLivingEntities
calls with an iteration over theMOB_CACHE
inCustomMob
Proposed changes to CustomBoss
onMobTick
this handles theonBossPattern
method, this was previously handled in MobTicker, this method also has the@OverridingMethodsMustInvokeSuper
Proposed changes to HeadlessHorseman
onMobTick
to make it more readable, more performant, etc, etcassert helldog != null
with a null check and warning to the log, an assertion error is not very clear to the server administratorsProposed changes to PixieQueen