mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 04:25:26 +01:00
Need to update item in hand if fish bucket pickup cancelled
This commit is contained in:
parent
b634e059e0
commit
2aba349f1a
@ -1117,7 +1117,7 @@
|
|||||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||||
Entity entity = packetplayinuseentity.a((World) worldserver);
|
Entity entity = packetplayinuseentity.a((World) worldserver);
|
||||||
|
|
||||||
@@ -1001,20 +1732,73 @@
|
@@ -1001,20 +1732,74 @@
|
||||||
if (this.player.h(entity) < d0) {
|
if (this.player.h(entity) < d0) {
|
||||||
EnumHand enumhand;
|
EnumHand enumhand;
|
||||||
|
|
||||||
@ -1140,6 +1140,7 @@
|
|||||||
+ // Fish bucket - SPIGOT-4048
|
+ // Fish bucket - SPIGOT-4048
|
||||||
+ if ((entity instanceof EntityFish && origItem != null && origItem.getItem() == Items.WATER_BUCKET) && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem)) {
|
+ if ((entity instanceof EntityFish && origItem != null && origItem.getItem() == Items.WATER_BUCKET) && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem)) {
|
||||||
+ this.sendPacket(new PacketPlayOutSpawnEntityLiving((EntityFish) entity));
|
+ this.sendPacket(new PacketPlayOutSpawnEntityLiving((EntityFish) entity));
|
||||||
|
+ this.player.updateInventory(this.player.activeContainer);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (triggerLeashUpdate && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem)) {
|
+ if (triggerLeashUpdate && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem)) {
|
||||||
@ -1192,7 +1193,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1030,7 +1814,8 @@
|
@@ -1030,7 +1815,8 @@
|
||||||
case PERFORM_RESPAWN:
|
case PERFORM_RESPAWN:
|
||||||
if (this.player.viewingCredits) {
|
if (this.player.viewingCredits) {
|
||||||
this.player.viewingCredits = false;
|
this.player.viewingCredits = false;
|
||||||
@ -1202,7 +1203,7 @@
|
|||||||
CriterionTriggers.v.a(this.player, DimensionManager.THE_END, DimensionManager.OVERWORLD);
|
CriterionTriggers.v.a(this.player, DimensionManager.THE_END, DimensionManager.OVERWORLD);
|
||||||
} else {
|
} else {
|
||||||
if (this.player.getHealth() > 0.0F) {
|
if (this.player.getHealth() > 0.0F) {
|
||||||
@@ -1052,14 +1837,20 @@
|
@@ -1052,14 +1838,20 @@
|
||||||
|
|
||||||
public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
|
public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
|
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
|
||||||
@ -1225,7 +1226,7 @@
|
|||||||
NonNullList<ItemStack> nonnulllist = NonNullList.a();
|
NonNullList<ItemStack> nonnulllist = NonNullList.a();
|
||||||
|
|
||||||
for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) {
|
for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) {
|
||||||
@@ -1068,8 +1859,274 @@
|
@@ -1068,8 +1860,274 @@
|
||||||
|
|
||||||
this.player.a(this.player.activeContainer, nonnulllist);
|
this.player.a(this.player.activeContainer, nonnulllist);
|
||||||
} else {
|
} else {
|
||||||
@ -1501,7 +1502,7 @@
|
|||||||
if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) {
|
if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) {
|
||||||
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true));
|
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true));
|
||||||
this.player.f = true;
|
this.player.f = true;
|
||||||
@@ -1112,6 +2169,7 @@
|
@@ -1112,6 +2170,7 @@
|
||||||
|
|
||||||
public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
|
public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer());
|
PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer());
|
||||||
@ -1509,7 +1510,7 @@
|
|||||||
this.player.resetIdleTimer();
|
this.player.resetIdleTimer();
|
||||||
if (this.player.activeContainer.windowId == packetplayinenchantitem.b() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
|
if (this.player.activeContainer.windowId == packetplayinenchantitem.b() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
|
||||||
this.player.activeContainer.a(this.player, packetplayinenchantitem.c());
|
this.player.activeContainer.a(this.player, packetplayinenchantitem.c());
|
||||||
@@ -1143,6 +2201,43 @@
|
@@ -1143,6 +2202,43 @@
|
||||||
|
|
||||||
boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45;
|
boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45;
|
||||||
boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
|
boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
|
||||||
@ -1553,7 +1554,7 @@
|
|||||||
|
|
||||||
if (flag1 && flag2) {
|
if (flag1 && flag2) {
|
||||||
if (itemstack.isEmpty()) {
|
if (itemstack.isEmpty()) {
|
||||||
@@ -1166,6 +2261,7 @@
|
@@ -1166,6 +2262,7 @@
|
||||||
|
|
||||||
public void a(PacketPlayInTransaction packetplayintransaction) {
|
public void a(PacketPlayInTransaction packetplayintransaction) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer());
|
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer());
|
||||||
@ -1561,7 +1562,7 @@
|
|||||||
Short oshort = (Short) this.k.get(this.player.activeContainer.windowId);
|
Short oshort = (Short) this.k.get(this.player.activeContainer.windowId);
|
||||||
|
|
||||||
if (oshort != null && packetplayintransaction.c() == oshort && this.player.activeContainer.windowId == packetplayintransaction.b() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
|
if (oshort != null && packetplayintransaction.c() == oshort && this.player.activeContainer.windowId == packetplayintransaction.b() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
|
||||||
@@ -1176,6 +2272,7 @@
|
@@ -1176,6 +2273,7 @@
|
||||||
|
|
||||||
public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
|
public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.getWorldServer());
|
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.getWorldServer());
|
||||||
@ -1569,7 +1570,7 @@
|
|||||||
this.player.resetIdleTimer();
|
this.player.resetIdleTimer();
|
||||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||||
BlockPosition blockposition = packetplayinupdatesign.b();
|
BlockPosition blockposition = packetplayinupdatesign.b();
|
||||||
@@ -1192,14 +2289,30 @@
|
@@ -1192,14 +2290,30 @@
|
||||||
|
|
||||||
if (!tileentitysign.d() || tileentitysign.e() != this.player) {
|
if (!tileentitysign.d() || tileentitysign.e() != this.player) {
|
||||||
this.minecraftServer.warning("Player " + this.player.getDisplayName().getString() + " just tried to change non-editable sign");
|
this.minecraftServer.warning("Player " + this.player.getDisplayName().getString() + " just tried to change non-editable sign");
|
||||||
@ -1601,7 +1602,7 @@
|
|||||||
|
|
||||||
tileentitysign.update();
|
tileentitysign.update();
|
||||||
worldserver.notify(blockposition, iblockdata, iblockdata, 3);
|
worldserver.notify(blockposition, iblockdata, iblockdata, 3);
|
||||||
@@ -1208,6 +2321,7 @@
|
@@ -1208,6 +2322,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
|
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
|
||||||
@ -1609,7 +1610,7 @@
|
|||||||
if (this.awaitingKeepAlive && packetplayinkeepalive.b() == this.h) {
|
if (this.awaitingKeepAlive && packetplayinkeepalive.b() == this.h) {
|
||||||
int i = (int) (SystemUtils.getMonotonicMillis() - this.lastKeepAlive);
|
int i = (int) (SystemUtils.getMonotonicMillis() - this.lastKeepAlive);
|
||||||
|
|
||||||
@@ -1221,7 +2335,17 @@
|
@@ -1221,7 +2336,17 @@
|
||||||
|
|
||||||
public void a(PacketPlayInAbilities packetplayinabilities) {
|
public void a(PacketPlayInAbilities packetplayinabilities) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer());
|
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer());
|
||||||
@ -1628,7 +1629,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(PacketPlayInSettings packetplayinsettings) {
|
public void a(PacketPlayInSettings packetplayinsettings) {
|
||||||
@@ -1229,5 +2353,47 @@
|
@@ -1229,5 +2354,47 @@
|
||||||
this.player.a(packetplayinsettings);
|
this.player.a(packetplayinsettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user