2017-06-19 03:36:55 +02:00
|
|
|
From 55935073e08bcccfc096d7a35b1ab26571c0fa53 Mon Sep 17 00:00:00 2001
|
2017-06-12 02:43:59 +02:00
|
|
|
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
|
2017-06-19 03:36:55 +02:00
|
|
|
index 08315599..6ed3d790 100644
|
2017-06-12 02:43:59 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
2017-06-12 03:02:57 +02:00
|
|
|
@@ -329,6 +329,7 @@ public class EntityItem extends Entity implements HopperPusher {
|
2017-06-12 02:43:59 +02:00
|
|
|
// 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);
|
2017-06-12 03:02:57 +02:00
|
|
|
@@ -336,8 +337,14 @@ public class EntityItem extends Entity implements HopperPusher {
|
2017-06-12 02:43:59 +02:00
|
|
|
// event.setCancelled(!entityhuman.canPickUpLoot); TODO
|
|
|
|
this.world.getServer().getPluginManager().callEvent(event);
|
|
|
|
itemstack.setCount(canHold + remaining);
|
|
|
|
+ flyAtPlayer = event.getFlyAtPlayer(); // Paper
|
|
|
|
|
|
|
|
if (event.isCancelled()) {
|
|
|
|
+ // Paper Start
|
|
|
|
+ if (flyAtPlayer) {
|
|
|
|
+ entityhuman.receive(this, i);
|
|
|
|
+ }
|
|
|
|
+ // Paper End
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-06-12 03:02:57 +02:00
|
|
|
@@ -347,7 +354,11 @@ public class EntityItem extends Entity implements HopperPusher {
|
|
|
|
// CraftBukkit end
|
2017-06-12 02:43:59 +02:00
|
|
|
|
2017-06-12 03:02:57 +02:00
|
|
|
if (this.pickupDelay == 0 && (this.h == null || 6000 - this.age <= 200 || this.h.equals(entityhuman.getName())) && entityhuman.inventory.pickup(itemstack)) {
|
2017-06-12 02:43:59 +02:00
|
|
|
- entityhuman.receive(this, i);
|
|
|
|
+ // Paper Start
|
|
|
|
+ if (flyAtPlayer) {
|
|
|
|
+ entityhuman.receive(this, i);
|
|
|
|
+ }
|
|
|
|
+ // Paper End
|
|
|
|
if (itemstack.isEmpty()) {
|
|
|
|
this.die();
|
|
|
|
itemstack.setCount(i);
|
|
|
|
--
|
2017-06-19 03:36:55 +02:00
|
|
|
2.13.1.windows.2
|
2017-06-12 02:43:59 +02:00
|
|
|
|