From ddf5660c66f8cf97f5eb466ea226abb889ec0b48 Mon Sep 17 00:00:00 2001 From: fullwall Date: Tue, 26 Jul 2022 15:08:13 +0800 Subject: [PATCH] Stop anvil guis from giving out input items --- .../net/citizensnpcs/nms/v1_12_R1/util/NMSImpl.java | 5 +++++ .../net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java | 5 +++++ .../net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java | 5 +++++ .../net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java | 5 +++++ .../net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java | 5 +++++ .../net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java | 4 ++++ .../net/citizensnpcs/nms/v1_18_R2/util/NMSImpl.java | 4 ++++ .../net/citizensnpcs/nms/v1_19_R1/util/NMSImpl.java | 10 ++++++---- 8 files changed, 39 insertions(+), 4 deletions(-) diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/NMSImpl.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/NMSImpl.java index f3b0f1842..cd721887b 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/NMSImpl.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/NMSImpl.java @@ -865,6 +865,11 @@ public class NMSImpl implements NMSBridge { handle) { private CraftInventoryView bukkitEntity; + @Override + protected void a(EntityHuman entityhuman, net.minecraft.server.v1_12_R1.World world, + IInventory iinventory) { + } + @Override public void e() { super.e(); diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java index 69ecb0674..3f8c9616b 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java @@ -900,6 +900,11 @@ public class NMSImpl implements NMSBridge { handle) { private CraftInventoryView bukkitEntity; + @Override + protected void a(EntityHuman entityhuman, net.minecraft.server.v1_13_R2.World world, + IInventory iinventory) { + } + @Override public void d() { super.d(); diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java index 37dceee40..d6f118b15 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java @@ -969,6 +969,11 @@ public class NMSImpl implements NMSBridge { final ContainerAnvil container = new ContainerAnvil(handle.nextContainerCounter(), handle.inventory, access) { private CraftInventoryView bukkitEntity; + @Override + protected void a(EntityHuman entityhuman, net.minecraft.server.v1_14_R1.World world, + IInventory iinventory) { + } + @Override public void e() { super.e(); diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java index 0d30c1e25..b2ecb774d 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java @@ -981,6 +981,11 @@ public class NMSImpl implements NMSBridge { final ContainerAnvil container = new ContainerAnvil(handle.nextContainerCounter(), handle.inventory, access) { private CraftInventoryView bukkitEntity; + @Override + protected void a(EntityHuman entityhuman, net.minecraft.server.v1_15_R1.World world, + IInventory iinventory) { + } + @Override public void e() { super.e(); diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java index b3af7da69..4b63a0c9e 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java @@ -1005,6 +1005,11 @@ public class NMSImpl implements NMSBridge { ContainerAccess.at(handle.world, new BlockPosition(0, 0, 0))) { private CraftInventoryView bukkitEntity; + @Override + protected void a(EntityHuman entityhuman, net.minecraft.server.v1_16_R3.World world, + IInventory iinventory) { + } + @Override public void e() { super.e(); diff --git a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java index 275be5e73..5ea63fa05 100644 --- a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java +++ b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java @@ -1010,6 +1010,10 @@ public class NMSImpl implements NMSBridge { ContainerLevelAccess.create(handle.level, new BlockPos(0, 0, 0))) { private CraftInventoryView bukkitEntity; + @Override + protected void clearContainer(net.minecraft.world.entity.player.Player entityhuman, Container iinventory) { + } + @Override public void createResult() { super.createResult(); diff --git a/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/NMSImpl.java b/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/NMSImpl.java index 97bdb7dc0..20fc5a5d6 100644 --- a/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/NMSImpl.java +++ b/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/NMSImpl.java @@ -1017,6 +1017,10 @@ public class NMSImpl implements NMSBridge { ContainerLevelAccess.create(handle.level, new BlockPos(0, 0, 0))) { private CraftInventoryView bukkitEntity; + @Override + protected void clearContainer(net.minecraft.world.entity.player.Player entityhuman, Container iinventory) { + } + @Override public void createResult() { super.createResult(); diff --git a/v1_19_R1/src/main/java/net/citizensnpcs/nms/v1_19_R1/util/NMSImpl.java b/v1_19_R1/src/main/java/net/citizensnpcs/nms/v1_19_R1/util/NMSImpl.java index 31968da8b..a7d440725 100644 --- a/v1_19_R1/src/main/java/net/citizensnpcs/nms/v1_19_R1/util/NMSImpl.java +++ b/v1_19_R1/src/main/java/net/citizensnpcs/nms/v1_19_R1/util/NMSImpl.java @@ -1033,6 +1033,10 @@ public class NMSImpl implements NMSBridge { ContainerLevelAccess.create(handle.level, new BlockPos(0, 0, 0))) { private CraftInventoryView bukkitEntity; + @Override + protected void clearContainer(net.minecraft.world.entity.player.Player entityhuman, Container iinventory) { + } + @Override public void createResult() { super.createResult(); @@ -1041,15 +1045,13 @@ public class NMSImpl implements NMSBridge { @Override public CraftInventoryView getBukkitView() { - if (this.bukkitEntity != null) { - return this.bukkitEntity; - } else { + if (this.bukkitEntity == null) { this.bukkitEntity = new CraftInventoryView(this.player.getBukkitEntity(), new CitizensInventoryAnvil(this.access.getLocation(), this.inputSlots, this.resultSlots, this, anvil), this); - return this.bukkitEntity; } + return this.bukkitEntity; } }; container.getBukkitView().setItem(0, anvil.getItem(0));