From d75fe24ebec33bc2feefcbbec27dddc26a09e6ee Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 24 May 2021 12:01:09 +0200 Subject: [PATCH] Add and increase Threshold Signed-off-by: Chaoscaot --- .../bausystem/features/world/InventoryListener_15.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/world/InventoryListener_15.java b/BauSystem_15/src/de/steamwar/bausystem/features/world/InventoryListener_15.java index 06d5e8cf..7160055c 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/features/world/InventoryListener_15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/features/world/InventoryListener_15.java @@ -27,6 +27,8 @@ import org.bukkit.inventory.ItemStack; public class InventoryListener_15 { + private static final int threshold = 2048; + public static boolean checkItemStack(ItemStack item) { net.minecraft.server.v1_15_R1.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); NBTTagCompound tag = nmsItem.getTag(); @@ -34,13 +36,13 @@ public class InventoryListener_15 { NBTTagCompound blockTag = tag.getCompound("BlockEntityTag"); assert blockTag != null; if (blockTag.hasKey("Items")) { - return drillDown(blockTag.getList("Items", 10), 0, 0) > 1024; + return drillDown(blockTag.getList("Items", 10), 0, 0) > threshold; } return false; } private static int drillDown(NBTTagList items, int layer, int start) { - if (layer > 2) return start + 1024; + if (layer > 2) return start + threshold; int invalid = start; for (NBTBase nbtBase : items) { if (!(nbtBase instanceof NBTTagCompound)) @@ -56,7 +58,7 @@ public class InventoryListener_15 { } } } - if (invalid > 1024) + if (invalid > threshold) break; } return invalid;