diff options
author | Spottedleaf <[email protected]> | 2024-07-17 10:24:53 -0700 |
---|---|---|
committer | Spottedleaf <[email protected]> | 2024-07-17 10:28:32 -0700 |
commit | 00b949f1bbbf444e2b5e7b8de7c9b14fbd2133c6 (patch) | |
tree | 82639515bc5e9ae00c1e639e72137ed51e1ac688 /patches/server/0133-PlayerPickupItemEvent-setFlyAtPlayer.patch | |
parent | 967f98aa81da851740aeb429778e46159fd188df (diff) | |
download | Paper-00b949f1bbbf444e2b5e7b8de7c9b14fbd2133c6.tar.gz Paper-00b949f1bbbf444e2b5e7b8de7c9b14fbd2133c6.zip |
Remove Moonrise utils to MCUtils, remove duplicated/unused utils
Diffstat (limited to 'patches/server/0133-PlayerPickupItemEvent-setFlyAtPlayer.patch')
-rw-r--r-- | patches/server/0133-PlayerPickupItemEvent-setFlyAtPlayer.patch | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/patches/server/0133-PlayerPickupItemEvent-setFlyAtPlayer.patch b/patches/server/0133-PlayerPickupItemEvent-setFlyAtPlayer.patch new file mode 100644 index 0000000000..282fdd4f1e --- /dev/null +++ b/patches/server/0133-PlayerPickupItemEvent-setFlyAtPlayer.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath <[email protected]> +Date: Sun, 7 May 2017 06:26:09 -0500 +Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer + + +diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +index 759c246540bbd5cb99c78a722c39b72fbc1951d4..f51f04758e135294bab5c7d1f891a8d67fea78f5 100644 +--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java ++++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +@@ -436,6 +436,7 @@ public class ItemEntity extends Entity implements TraceableEntity { + // CraftBukkit start - fire PlayerPickupItemEvent + int canHold = player.getInventory().canHold(itemstack); + int remaining = i - canHold; ++ boolean flyAtPlayer = false; // Paper + + if (this.pickupDelay <= 0 && canHold > 0) { + itemstack.setCount(canHold); +@@ -443,8 +444,14 @@ public class ItemEntity extends Entity implements TraceableEntity { + PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); + playerEvent.setCancelled(!playerEvent.getPlayer().getCanPickupItems()); + this.level().getCraftServer().getPluginManager().callEvent(playerEvent); ++ flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper + if (playerEvent.isCancelled()) { + itemstack.setCount(i); // SPIGOT-5294 - restore count ++ // Paper start ++ if (flyAtPlayer) { ++ player.take(this, i); ++ } ++ // Paper end + return; + } + +@@ -474,6 +481,7 @@ public class ItemEntity extends Entity implements TraceableEntity { + // CraftBukkit end + + if (this.pickupDelay == 0 && (this.target == null || this.target.equals(player.getUUID())) && player.getInventory().add(itemstack)) { ++ if (flyAtPlayer) // Paper - PlayerPickupItemEvent + player.take(this, i); + if (itemstack.isEmpty()) { + this.discard(EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause |