Previously the server attempted to compute the block placed by using the
BlockPlaceContext. This approach however fails on replacable blocks, as
the BlockPlaceContext computes this during its construction, which
happened after the actual world modification.
The commit reworks this approach and now stores metadata in the
InteractionResult which can later be read.
The diff is structured to allow for easy future expansion of the tracked
metadata.
The exit location passed to PlayerTeleportEvent/PlayerTeleportEndGatewayEvent in ServerPlayer#teleport(TeleportTransition) needs to be cloned, as it is later compared in case it was changed. Not cloning it results in the ability for plugins to mutate it but such changes will be ignored, as the instance of the Location being the same results in a successful equality check.
It is not necessary to clone the location in other instantiations of the event (or subclasses) as those are not compared afterwards to change the outcome.
The recent commit 121a7bf4ebd42beb9285a694039c2868b4148b07 added
the interface FeatureElement to the GameRules.Type class to expose the
stored feature flags of gamerules.
This however messed with the reobf mappings spigot uses, as the now
overridden method requiredFeatures needs to be mapped to the same
obfuscated name as FeatureElement#requiredFeatures.
To avoid having this in the mappings patch, the commit removes the
inheritance again and instead exposes a wrapper method.
Ports the follow commits from spigot to paper.
All credits to go the respective commit authors listed below.
Bukkit: 47480cd07c0957a94b220f3087b851594b063e54
CraftBukkit: c6c8165aa0d5679b9b015b209c1645a222f8c3a6
CraftBukkit: d275d3b96e041f6421f3bb7de1e6022ea8be5456
By: md_5 <git@md-5.net>
By: Doc <nachito94@msn.com>
Mojangs EQUIPMENT_SLOT_MAPPING uses an Int2ObjectArrayMap and hence
technically does provide iteration stability, however it is filled from
a MapN, which destroys the well order of the entries.
To iterate from smallest to largest inventory index correctly, this
commit introduces a sorted array based on the EQUIPMENT_SLOT_MAPPING.