Commit Graph
15 Commits
Author SHA1 Message Date
Bjarne Koll 751beefa8e Close library classloader and improve PluginDescriptionFile (#8901) 2023-02-22 21:54:27 +01:00
Bjarne Koll 78f94ecb2d Configure mokitor Server mock as stubOnly (#8861)
A recent patch moved the internal unit tests to mokito, allowing
deep mocking to easily setup a mocked server instance.
While this change is useful, the server's Server#getItemFactory methods
is one of the hottest paths during unit testing, being called numerous
times by material tests.
As mokito mocks keep track of each invocation to allow for verifications
of invocations down the line, the server mock allocates a huge amount of
memory to keep track of all invocations, ultimately leading to an OOM
exception.

The previous solution solved this by increasing the tests memory to 2 GB,
however as of right now simply configuring the server mock as "stubOnly",
properly prevents the overflow of invocation records as none of the unit
test code relies on invocation verification.
2023-02-21 17:18:49 +01:00
Bjarne Koll ef23d583c0 Correctly shrink items during EntityResurrectEvent (#8780)
The EntityResurrectEvent logic is supposed to locate a totem of undying
in any of the interaction slots of the player inventory and then, if the
called EntityResurrectEvent is not cancelled, shrink that item by 1,
usually reducing it to zero.

For this, the logic iterates over the items in the interaction slots and
breaks out the loop if a totem of undying was found.
However, even if no totem of undying was found, the iteration item stack
variable remains as a refernce to the last interaction slot probed.

Plugins uncancelling a EntityResurrectEvent, which is published
pre-cancelled to listeners if no totem of undying could be found,
would hence cause the server logic to shrink completely unrelated items
found in, at the writing of this patch, the players off hand slot.

This patch corrects this behaviour by only shrinking the item if a totem
of undying was found and the event was called uncancelled.
2023-01-19 23:09:08 +01:00
Bjarne Koll 43f4155da3 Persist paper lootable on entities (#8762) 2023-01-05 11:59:10 +01:00
Bjarne Koll ce991b96eb Fully deserialise persistent anger post async load (#8560)
The modified patch prevents entity loading off the main thread when
entities are initially loaded.

However, the initial loading of an entity is not the only time the
Entity#readAdditionalSaveData method is called. Commands like /data also
invoke the method (through Entity#load) to update an entities data
without completely re-creating it.

This however breaks with the current patch, as the patch moves parts of
the entity lookup for persistent anger deserialisation into the first
tick of an entity (which obviously is only called once and hence not
re-run when an already ticking entity is modified as laid out above).

This change actively runs the now split logic for deserialisation again
if the entity has already ticked its first tick. This way, initial
deserialisation is still split into one off thread and the first tick
parts, but following main thread deserialisations can happen completely
inside Entity#readAdditionalSaveData is called.
2022-12-02 18:09:41 +01:00
Bjarne Koll f044bd9e6c Mark parsed PoiChunks with data as not loaded (#8405)
Previously, PoiChunk#empty would create a new empty poi chunk with
loaded already set to true, as no data was contained in the chunk.
This allowed the poi chunk to skip expensive trips to the main thread.

However, PoiChunk#parse used #empty to create the initial PoiChunk
instance that is then filled with data.
This leads to PoiChunks returned from #parse to already be marked as
loaded, preventing the then needed trip to the tick thread to update
things like the village distance tracker.

To fix this, this commit now marks the PoiChunks loaded state as false
if the parse logic actually read and parsed any data.
This allows the PoiChunk#load method to properly run its callbacks when
called for the first time.
2022-09-29 17:54:47 +02:00
Bjarne Koll 614f528234 Fix typos in isTickingWorlds API javadocs (#8382) 2022-09-25 02:01:17 +02:00
Bjarne Koll 0ed6315664 Properly close section storage managed files (#8364) 2022-09-17 20:50:01 +02:00
Bjarne Koll c908ebcbcb Add ZombieVillager conversion without entity event (#8111)
The ZombieVillager#setConversionTime API method internally calls
startConversion which always broadcasts the entity event responsible for
playing the respective sound at the beginning of a conversion.

This is not always wanted by developers when modifying already
converting zombies in particular.

This commit expands the ZombieVillager interface with another overload
of the setConversionTime method that also takes a simple toggle flag
indicating whether or not the entity event should be published to the
world.
2022-07-07 23:43:28 +02:00
Bjarne Koll 569283aecf Call EntityDropItemEvent for goats dropping horns (#8094) 2022-07-04 21:26:43 +02:00
Bjarne Koll 0c85e94214 Revert to old createProfile(UUID, String) logic (#7723) 2022-04-22 20:54:08 +02:00
Bjarne Koll 6b895464b0 Properly create profiles with custom name/uuid (#7558) 2022-03-19 14:39:38 +01:00
Bjarne Koll 905e5cdc31 Properly lookup random-ticked precipitation blocks (#7606) 2022-03-15 19:44:25 +01:00
Bjarne Koll 9425b30b18 Use access transformers for player profile API (#7468) 2022-02-18 18:30:37 +01:00
Bjarne Koll 1586de3418 Log exceptions thrown during chat processing (#7467) 2022-02-12 03:42:12 +01:00