mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-03 01:10:37 +01:00
Use Item from PlayerPickupItemEvent when fired (fixes #1717)
This commit is contained in:
parent
1c8d620e6e
commit
7d25c57f43
@ -1,22 +1,25 @@
|
|||||||
From 7ac07ac07ac07ac07ac07ac07ac07ac07ac07ac0 Mon Sep 17 00:00:00 2001
|
From 5f33e6c078a1af6a8a61615eda853205adf22009 Mon Sep 17 00:00:00 2001
|
||||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||||
Date: Fri, 7 Sep 2018 18:28:24 -0500
|
Date: Fri, 7 Sep 2018 18:28:24 -0500
|
||||||
Subject: [PATCH] Fix #1420
|
Subject: [PATCH] Fix #1420
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||||
index 7ac07ac07ac0..7ac07ac07ac0 100644
|
index 66e574bd3..a72d3dcc6 100644
|
||||||
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||||
@@ -492,6 +492,7 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
@@ -492,7 +492,9 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||||||
if (!this.world.isClientSide && (this.inGround || this.q()) && this.shake <= 0) {
|
if (!this.world.isClientSide && (this.inGround || this.q()) && this.shake <= 0) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
ItemStack itemstack = this.getItemStack();
|
ItemStack itemstack = this.getItemStack();
|
||||||
|
- EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
|
||||||
|
+ EntityItem item = null; // Paper - GH-1420 - allow using event item
|
||||||
+ if (!itemstack.isEmpty()) { // Paper - GH-1420 (skip pick up event for fully damaged (or air) itemstack)
|
+ if (!itemstack.isEmpty()) { // Paper - GH-1420 (skip pick up event for fully damaged (or air) itemstack)
|
||||||
EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
|
+ item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack); // Paper - GH-1420 - allow using event item
|
||||||
if (this.fromPlayer == PickupStatus.ALLOWED && entityhuman.inventory.canHold(itemstack) > 0) {
|
if (this.fromPlayer == PickupStatus.ALLOWED && entityhuman.inventory.canHold(itemstack) > 0) {
|
||||||
PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), (org.bukkit.entity.Arrow) this.getBukkitEntity());
|
PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), (org.bukkit.entity.Arrow) this.getBukkitEntity());
|
||||||
@@ -502,9 +503,10 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
// event.setCancelled(!entityhuman.canPickUpLoot); TODO
|
||||||
|
@@ -502,9 +504,10 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -24,10 +27,10 @@ index 7ac07ac07ac0..7ac07ac07ac0 100644
|
|||||||
boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild || this.q() && this.getShooter().getUniqueID() == entityhuman.getUniqueID();
|
boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild || this.q() && this.getShooter().getUniqueID() == entityhuman.getUniqueID();
|
||||||
|
|
||||||
- if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(item.getItemStack())) {
|
- if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(item.getItemStack())) {
|
||||||
+ if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(itemstack)) { // Paper - GH-1420
|
+ if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(item != null ? item.getItemStack() : itemstack)) { // Paper - GH-1420
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
--
|
--
|
||||||
2.19.1
|
2.19.2
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
From d0a3de41338e9f77091303e911211ba09411900d Mon Sep 17 00:00:00 2001
|
From 202d3b30d84fa38f2d97a0f8854ebd947826baad Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Tue, 23 Oct 2018 20:25:05 -0400
|
Date: Tue, 23 Oct 2018 20:25:05 -0400
|
||||||
Subject: [PATCH] Don't sleep after profile lookups if not needed
|
Subject: [PATCH] Don't sleep after profile lookups if not needed
|
||||||
@ -7,7 +7,7 @@ Mojang was sleeping even if we had no more requests to go after
|
|||||||
the current one finished, resulting in 100ms lost per profile lookup
|
the current one finished, resulting in 100ms lost per profile lookup
|
||||||
|
|
||||||
diff --git a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
|
diff --git a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
|
||||||
index 26a743722..6ed3199c3 100644
|
index 71e48e87b..23f1447cf 100644
|
||||||
--- a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
|
--- a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
|
||||||
+++ b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
|
+++ b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
|
||||||
@@ -42,6 +42,7 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository {
|
@@ -42,6 +42,7 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository {
|
||||||
|
Loading…
Reference in New Issue
Block a user