mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 00:47:38 +01:00
Call PlayerReadyArrowEvent for when items in the offhand are used (#8842)
This commit is contained in:
parent
bb05fcf4ca
commit
8d1acf68ed
@ -7,10 +7,10 @@ Called when a player is firing a bow and the server is choosing an arrow to use.
|
||||
Plugins can skip selection of certain arrows and control which is used.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index e088e5174a4666130cd1f66c751e7ab83d9f7a65..8aa5f8bacb868a3b04af6e696f9eed89463ecaf3 100644
|
||||
index 3bdd77d2e91be5182c32761f736e7cccccb08978..2010e93da4e56a6a22a8e6f8c42a799eeba62acc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -2226,6 +2226,17 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -2226,18 +2226,29 @@ public abstract class Player extends LivingEntity {
|
||||
return ImmutableList.of(Pose.STANDING, Pose.CROUCHING, Pose.SWIMMING);
|
||||
}
|
||||
|
||||
@ -28,12 +28,17 @@ index e088e5174a4666130cd1f66c751e7ab83d9f7a65..8aa5f8bacb868a3b04af6e696f9eed89
|
||||
@Override
|
||||
public ItemStack getProjectile(ItemStack stack) {
|
||||
if (!(stack.getItem() instanceof ProjectileWeaponItem)) {
|
||||
@@ -2242,7 +2253,7 @@ public abstract class Player extends LivingEntity {
|
||||
return ItemStack.EMPTY;
|
||||
} else {
|
||||
- Predicate<ItemStack> predicate = ((ProjectileWeaponItem) stack.getItem()).getSupportedHeldProjectiles();
|
||||
+ Predicate<ItemStack> predicate = ((ProjectileWeaponItem) stack.getItem()).getSupportedHeldProjectiles().and(item -> tryReadyArrow(stack, item)); // Paper
|
||||
ItemStack itemstack1 = ProjectileWeaponItem.getHeldProjectile(this, predicate);
|
||||
|
||||
if (!itemstack1.isEmpty()) {
|
||||
return itemstack1;
|
||||
} else {
|
||||
- predicate = ((ProjectileWeaponItem) stack.getItem()).getAllSupportedProjectiles();
|
||||
+ predicate = ((ProjectileWeaponItem) stack.getItem()).getAllSupportedProjectiles().and(item -> tryReadyArrow(stack, item)); // Paper
|
||||
|
||||
for (int i = 0; i < this.inventory.getContainerSize(); ++i) {
|
||||
ItemStack itemstack2 = this.inventory.getItem(i);
|
||||
|
||||
- if (predicate.test(itemstack2)) {
|
||||
+ if (predicate.test(itemstack2) && tryReadyArrow(stack, itemstack2)) { // Paper
|
||||
return itemstack2;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ offhand slot isn't sent. This is not correct because you *can* put stuff into th
|
||||
by pressing the offhand swap item
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 85570b5c362033075114ed86746f23c24251827d..7d6d3c8556033d289fdadc489e73fba478fce41a 100644
|
||||
index 44c7f65d93b57cd3fff0b10c1d08a98250f3805f..9160725f031c9698a00229c3dfa19d39b4a826c1 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -290,6 +290,13 @@ public class ServerPlayer extends Player {
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] fix Instruments
|
||||
properly handle Player#playNote
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 05fbdba6bc87e5c7f192a061a8ea6cf12b19a216..0e65d674a73d7c31ba3c6d504bd724ccb5068264 100644
|
||||
index 18c2c1454f8f3319b2a0b7649b99d25933cc18a6..ab11ed9d587b633f0f86f13dcb63adac63c3ff78 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -767,62 +767,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add missing SpigotConfig logCommands check
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 08cb3db28f13c352a162009deeb28ee637e98d2a..50d8d16b1856c0c875ccabbcfc240379a7669559 100644
|
||||
index 354b6e86b789ce80fe8f28384e4ca783c37c9007..aa11c64c74e1fd875161c9a80a16dbba6738bf1d 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2256,7 +2256,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Flying Fall Damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 9db2a97aca111862caec47220d5f13f7e5013fc7..f6e4194856d4a2710a169b5823e74da1ba2c9130 100644
|
||||
index 3b946a50ffc832f1dfe39f5f10d7cf2d8d6c65b8..746fd9ba3daac1bbc34cc583df3aa92e872c732e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -181,6 +181,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add Player#sendEquipmentChange(Map) API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 0da6a1a688a67868472143a254942eddc5a91b49..ded1f3034da67d89efaf4b31620ea2e43002f41d 100644
|
||||
index b1d01555cb919edd16d46df28d6b09661317b233..5ec97491d6c2888e360de1d53f3edcc75ccac95a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1068,17 +1068,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
Loading…
Reference in New Issue
Block a user