Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 04:50:05 +01:00
50 Zeilen
2.0 KiB
Diff
50 Zeilen
2.0 KiB
Diff
|
From b8cff2eed487001ad1dfca2d176a6840ef524edc 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 95ca1b8e..2dd27d1c 100644
|
||
|
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
||
|
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
||
|
@@ -328,6 +328,7 @@ public class EntityItem extends Entity implements HopperPusher {
|
||
|
// 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);
|
||
|
@@ -335,8 +336,14 @@ public class EntityItem extends Entity implements HopperPusher {
|
||
|
// 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;
|
||
|
}
|
||
|
|
||
|
@@ -374,7 +381,11 @@ public class EntityItem extends Entity implements HopperPusher {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- entityhuman.receive(this, i);
|
||
|
+ // Paper Start
|
||
|
+ if (flyAtPlayer) {
|
||
|
+ entityhuman.receive(this, i);
|
||
|
+ }
|
||
|
+ // Paper End
|
||
|
if (itemstack.isEmpty()) {
|
||
|
this.die();
|
||
|
itemstack.setCount(i);
|
||
|
--
|
||
|
2.11.0
|
||
|
|