SteamWar/BauSystem2.0
Archiviert
12
0

Add and increase Threshold

Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Chaoscaot 2021-05-24 12:01:09 +02:00
Ursprung 2f72d011e6
Commit d75fe24ebe

Datei anzeigen

@ -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;