PatchworkMC / patchwork-api

An attempt to reimplement the Minecraft Forge API on Fabric
GNU Lesser General Public License v2.1
282 stars 48 forks source link

Implement Item Events #212

Closed WalkerKnapp closed 3 years ago

WalkerKnapp commented 3 years ago

This PR implements everything in net.minecraftforge.event.entity.item. Implementations differ slightly from forge, notably in onPlayerTossEvent (https://github.com/PatchworkMC/YarnForge/blob/af120a35c3e6951b7ef4318801b6b8dce6fc5420/src/main/java/net/minecraftforge/common/ForgeHooks.java#L428). As far as I can tell, this needlessly replaces calls to PlayerEntity#dropItem(ItemStack, boolean, boolean) and calls it instead in ForgeHooks, and has to deal with spawning the item manually. Instead, this PR injects into dropItem(ItemStack, boolean, boolean) directly.

Corresponding testmods PR: PatchworkMC/patchwork-testmods#5