mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-10 12:50:28 +01:00
19de9af63c
Functional GUI fix added by billygalbreath
50 lines
2.3 KiB
Diff
50 lines
2.3 KiB
Diff
From 5adb935325d11e6eec89a40d2b60af88e2c69eff 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 9973fc0b1..4b2e19f30 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
|
@@ -322,6 +322,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);
|
|
@@ -329,8 +330,14 @@ 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()) {
|
|
itemstack.setCount(i); // SPIGOT-5294 - restore count
|
|
+ // Paper Start
|
|
+ if (flyAtPlayer) {
|
|
+ entityhuman.receive(this, i);
|
|
+ }
|
|
+ // Paper End
|
|
return;
|
|
}
|
|
|
|
@@ -354,7 +361,11 @@ public class EntityItem extends Entity {
|
|
// CraftBukkit end
|
|
|
|
if (this.pickupDelay == 0 && (this.owner == null || this.owner.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.25.0.windows.1
|
|
|