Paper/Spigot-Server-Patches/0180-PlayerPickupItemEvent-setFlyAtPlayer.patch
Shane Freeder ea855e2b46 Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Developers!: You will need to clean up your work/Minecraft/1.13.2 folder
for this

Also, restore a patch that was dropped in the last upstream

Bukkit Changes:
279eeab3 Fix command description not being set
96e2bb18 Remove debug print from SyntheticEventTest

CraftBukkit Changes:
d3ed1516 Fix dangerously threaded beacons
217a293d Don't relocate joptsimple to allow --help to work.
1be05a21 Prepare for imminent Java 12 release
a49270b2 Mappings Update
5259d80c SPIGOT-4669: Fix PlayerTeleportEvent coordinates for relative teleports

Spigot Changes:
e6eb36f2 Rebuild patches
2019-03-20 01:55:16 +00:00

48 lines
2.2 KiB
Diff

From d2dc3091b8657b318b2813a1e3ab7a1eed394ae8 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 7 May 2017 06:26:09 -0500
Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 39a804b7c..643793d55 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -308,6 +308,7 @@ public class EntityItem extends Entity {
// CraftBukkit start - fire PlayerPickupItemEvent
int canHold = entityhuman.inventory.canHold(itemstack);
int remaining = i - canHold;
+ boolean flyAtPlayer = false; // Paper
if (this.pickupDelay <= 0 && canHold > 0) {
itemstack.setCount(canHold);
@@ -315,7 +316,13 @@ public class EntityItem extends Entity {
PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
playerEvent.setCancelled(!entityhuman.canPickUpLoot);
this.world.getServer().getPluginManager().callEvent(playerEvent);
+ flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper
if (playerEvent.isCancelled()) {
+ // Paper Start
+ if (flyAtPlayer) {
+ entityhuman.receive(this, i);
+ }
+ // Paper End
return;
}
@@ -336,6 +343,11 @@ public class EntityItem extends Entity {
if (this.pickupDelay == 0 && (this.g == null || 6000 - this.age <= 200 || this.g.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) {
entityhuman.receive(this, i);
+ // Paper Start
+ if (flyAtPlayer) {
+ entityhuman.receive(this, i);
+ }
+ // Paper End
if (itemstack.isEmpty()) {
this.die();
itemstack.setCount(i);
--
2.21.0