Mojang included some sanity checks on arguments passed to the BlockData.
This code results in the Hash look up occuring twice per call, one to test if it exists
and another to retrieve the result.
This code should ideally never be hit, unless mojang released a bad build. We can discover bugs with this as furthur code that never expects a null
would then NPE, so it would not result in hidden issues.
This is super hot code, so removing those checks should give decent gains.
Removing chunks from the unload queue when performing chunk lookups is a costly activity.
It drastically slows down server performance as many methods call getChunkAt, resulting in a bandaid
to skip removing chunks from the unload queue.
This patch optimizes the unload queue to instead use a boolean on the Chunk object itself to mark
if the chunk is active, and then insert into a LinkedList queue.
The benefits here is that all chunk unload queue actions are now O(1) constant time.
A LinkedList will never need to resize, and can be removed from in constant time when
used in a queue like method.
We mark the chunk as active in many places that notify it is still being used, so that
when the chunk unload queue reaches that chunk, and sees the chunk became active again,
it will skip it and move to next.
First, Enchantment order would blow away seeing 2 items as the same,
however the Client forces enchantment list in a certain order, as well
as does the /enchant command. Anvils can insert it into forced order,
causing 2 same items to be considered different.
This change makes unhandled NBT Tags and Enchantments use a sorted tree map,
so they will always be in a consistent order.
Additionally, the old enchantment API was never updated when ItemMeta
was added, resulting in 2 different ways to modify an items enchantments.
For consistency, the old API methods now forward to use the
ItemMeta API equivalents, and should deprecate the old API's.
If the server lags out and skips multiple ticks, Furnace cooking behavior would not
cook in the expected amount of time as the cook time was not decremented correctly.
This patch ensures that furnaces cook to the correct wall time expectation.
Metadata is not meant to persist reload as things break badly with non primitive types
This will invalidate metadata on reload so it does not crash everything if a plugin uses it.
Under previous behavior, plugins were not able to check if a player had a permission
if it was defined in permissions.yml. there is no clean way for a plugin to fix that either.
This will change the order so that by default, permissions.yml loads BEFORE plugins instead of after.
This gives plugins expected permission checks.
It also helps improve the expected logic, as servers should set the initial defaults, and then let plugins
modify that. Under the previous logic, plugins were unable (cleanly) override permissions.yml.
A config option has been added for those who depend on the previous behavior, but I don't expect that.
Sometimes a chunk region file is closed prematurely, resulting in a "Stream Closed" error on chunk saving.
Ultimately there is a race condition that causes it, but re-trying the save will avoid the issue.
Retry the save 5 times to try our best to avoid rollbacks due to chunk save failures.
Reflection (although highly optimized), has noticable overhead.
It also creates noticable GC overhead by allocating arrays with arguments, as @Aikar has said.
Based on WaterfallMC/Waterfall@1692934370
Merge pull request #45 from Techcable/feature/asm-executors