mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-28 13:36:16 +01:00
Fixed NPEs in infinite item loss fix
This commit is contained in:
parent
cb7b82d452
commit
7ac53dfc8b
@ -858,6 +858,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
|
|
||||||
WorldServer worldserver = this.minecraftServer.a(this.player.dimension);
|
WorldServer worldserver = this.minecraftServer.a(this.player.dimension);
|
||||||
Entity entity = worldserver.getEntity(packet7useentity.target);
|
Entity entity = worldserver.getEntity(packet7useentity.target);
|
||||||
|
ItemStack itemInHand = this.player.inventory.getItemInHand();
|
||||||
|
|
||||||
if (entity != null && this.player.e(entity) && this.player.g(entity) < 36.0D) {
|
if (entity != null && this.player.e(entity) && this.player.g(entity) < 36.0D) {
|
||||||
if (packet7useentity.c == 0) {
|
if (packet7useentity.c == 0) {
|
||||||
@ -870,14 +871,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
this.player.c(entity);
|
this.player.c(entity);
|
||||||
// CraftBukkit start - update the client if the item is an infinite one
|
// CraftBukkit start - update the client if the item is an infinite one
|
||||||
if (this.player.inventory.getItemInHand().count <= -1) {
|
if (itemInHand != null && itemInHand.count <= -1) {
|
||||||
this.player.a(this.player.activeContainer);
|
this.player.a(this.player.activeContainer);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
} else if (packet7useentity.c == 1) {
|
} else if (packet7useentity.c == 1) {
|
||||||
this.player.d(entity);
|
this.player.d(entity);
|
||||||
// CraftBukkit start - update the client if the item is an infinite one
|
// CraftBukkit start - update the client if the item is an infinite one
|
||||||
if (this.player.inventory.getItemInHand().count <= -1) {
|
if (itemInHand != null && itemInHand.count <= -1) {
|
||||||
this.player.a(this.player.activeContainer);
|
this.player.a(this.player.activeContainer);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
Loading…
Reference in New Issue
Block a user