From ab72efa176cec4e46adc58a537f9f5110bd273c7 Mon Sep 17 00:00:00 2001 From: Allink Date: Sat, 17 Jun 2023 00:37:33 +0100 Subject: [PATCH] Merge large tag reset patches --- patches/server/0022-Reset-large-tags.patch | 254 +++++++++++++++++ ...-Account-for-items-inside-containers.patch | 260 ------------------ ...ehicle-collision-checks-to-3-and-di.patch} | 0 ...handling-of-invalid-JSON-components.patch} | 0 ...-oversized-components-from-updating.patch} | 0 ...ch => 0026-Add-MasterBlockFireEvent.patch} | 0 ...-Don-t-log-invalid-teams-to-console.patch} | 0 ...=> 0028-Block-server-side-chunkbans.patch} | 0 ...> 0029-Add-spectator-teleport-event.patch} | 0 ...30-Prevent-invalid-container-events.patch} | 0 ...te-block-entity-tag-query-positions.patch} | 0 ...-legacy-messages-over-1k-characters.patch} | 0 ...-bounds-HangingEntity-crash-exploit.patch} | 0 ...tch => 0034-Prevent-velocity-freeze.patch} | 0 ...Scissors-configuration-file-command.patch} | 0 ...ch-invalid-entity-rotation-log-spam.patch} | 0 ...Patch-large-selector-distance-crash.patch} | 0 ...mit-sculk-catalyst-cursor-positions.patch} | 0 ...patch => 0039-Limit-map-decorations.patch} | 0 ...layer-banning-using-duplicate-UUIDs.patch} | 0 ...on-t-warn-on-duplicate-entity-UUIDs.patch} | 0 ...ayers-from-nbt-components-configura.patch} | 0 ...component-extra-empty-array-exploit.patch} | 0 ...pth-limit-to-Component-deserializer.patch} | 0 ...tch => 0045-Add-depth-limit-to-SNBT.patch} | 0 ...0046-Implement-command-block-events.patch} | 0 ...ch => 0047-Limit-beacon-effectRange.patch} | 0 ...0048-Fix-invalid-armor-trim-exploit.patch} | 0 ...ove-validation-of-ResourceLocations.patch} | 0 29 files changed, 254 insertions(+), 260 deletions(-) delete mode 100644 patches/server/0023-Account-for-items-inside-containers.patch rename patches/server/{0024-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch => 0023-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch} (100%) rename patches/server/{0025-Better-handling-of-invalid-JSON-components.patch => 0024-Better-handling-of-invalid-JSON-components.patch} (100%) rename patches/server/{0026-Reject-oversized-components-from-updating.patch => 0025-Reject-oversized-components-from-updating.patch} (100%) rename patches/server/{0027-Add-MasterBlockFireEvent.patch => 0026-Add-MasterBlockFireEvent.patch} (100%) rename patches/server/{0028-Don-t-log-invalid-teams-to-console.patch => 0027-Don-t-log-invalid-teams-to-console.patch} (100%) rename patches/server/{0029-Block-server-side-chunkbans.patch => 0028-Block-server-side-chunkbans.patch} (100%) rename patches/server/{0030-Add-spectator-teleport-event.patch => 0029-Add-spectator-teleport-event.patch} (100%) rename patches/server/{0031-Prevent-invalid-container-events.patch => 0030-Prevent-invalid-container-events.patch} (100%) rename patches/server/{0032-Validate-block-entity-tag-query-positions.patch => 0031-Validate-block-entity-tag-query-positions.patch} (100%) rename patches/server/{0033-Refuse-to-convert-legacy-messages-over-1k-characters.patch => 0032-Refuse-to-convert-legacy-messages-over-1k-characters.patch} (100%) rename patches/server/{0034-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch => 0033-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch} (100%) rename patches/server/{0035-Prevent-velocity-freeze.patch => 0034-Prevent-velocity-freeze.patch} (100%) rename patches/server/{0036-Add-Scissors-configuration-file-command.patch => 0035-Add-Scissors-configuration-file-command.patch} (100%) rename patches/server/{0037-Patch-invalid-entity-rotation-log-spam.patch => 0036-Patch-invalid-entity-rotation-log-spam.patch} (100%) rename patches/server/{0038-Patch-large-selector-distance-crash.patch => 0037-Patch-large-selector-distance-crash.patch} (100%) rename patches/server/{0039-Limit-sculk-catalyst-cursor-positions.patch => 0038-Limit-sculk-catalyst-cursor-positions.patch} (100%) rename patches/server/{0040-Limit-map-decorations.patch => 0039-Limit-map-decorations.patch} (100%) rename patches/server/{0041-Prevent-player-banning-using-duplicate-UUIDs.patch => 0040-Prevent-player-banning-using-duplicate-UUIDs.patch} (100%) rename patches/server/{0042-Don-t-warn-on-duplicate-entity-UUIDs.patch => 0041-Don-t-warn-on-duplicate-entity-UUIDs.patch} (100%) rename patches/server/{0043-Make-excluding-players-from-nbt-components-configura.patch => 0042-Make-excluding-players-from-nbt-components-configura.patch} (100%) rename patches/server/{0044-Fix-component-extra-empty-array-exploit.patch => 0043-Fix-component-extra-empty-array-exploit.patch} (100%) rename patches/server/{0045-Add-depth-limit-to-Component-deserializer.patch => 0044-Add-depth-limit-to-Component-deserializer.patch} (100%) rename patches/server/{0046-Add-depth-limit-to-SNBT.patch => 0045-Add-depth-limit-to-SNBT.patch} (100%) rename patches/server/{0047-Implement-command-block-events.patch => 0046-Implement-command-block-events.patch} (100%) rename patches/server/{0048-Limit-beacon-effectRange.patch => 0047-Limit-beacon-effectRange.patch} (100%) rename patches/server/{0049-Fix-invalid-armor-trim-exploit.patch => 0048-Fix-invalid-armor-trim-exploit.patch} (100%) rename patches/server/{0050-Improve-validation-of-ResourceLocations.patch => 0049-Improve-validation-of-ResourceLocations.patch} (100%) diff --git a/patches/server/0022-Reset-large-tags.patch b/patches/server/0022-Reset-large-tags.patch index e6f3e63..3d8781f 100644 --- a/patches/server/0022-Reset-large-tags.patch +++ b/patches/server/0022-Reset-large-tags.patch @@ -4,6 +4,60 @@ Date: Sat, 10 Dec 2022 23:38:53 -0600 Subject: [PATCH] Reset large tags +diff --git a/src/main/java/net/minecraft/world/ContainerHelper.java b/src/main/java/net/minecraft/world/ContainerHelper.java +index 4092c7a8c2b0d9d26e6f4d97386735236300d132..9e0ab51dd7a4f9fed8f9edde962d42d4bbf604c1 100644 +--- a/src/main/java/net/minecraft/world/ContainerHelper.java ++++ b/src/main/java/net/minecraft/world/ContainerHelper.java +@@ -2,6 +2,7 @@ package net.minecraft.world; + + import java.util.List; + import java.util.function.Predicate; ++import me.totalfreedom.scissors.NbtUtility; + import net.minecraft.core.NonNullList; + import net.minecraft.nbt.CompoundTag; + import net.minecraft.nbt.ListTag; +@@ -22,10 +23,13 @@ public class ContainerHelper { + + public static CompoundTag saveAllItems(CompoundTag nbt, NonNullList stacks, boolean setIfEmpty) { + ListTag listTag = new ListTag(); ++ // Scissors - Account for items inside containers ++ long total = 0; + + for(int i = 0; i < stacks.size(); ++i) { + ItemStack itemStack = stacks.get(i); + if (!itemStack.isEmpty()) { ++ total += NbtUtility.getTagSize(itemStack.getTag()); // Scissors + CompoundTag compoundTag = new CompoundTag(); + compoundTag.putByte("Slot", (byte)i); + itemStack.save(compoundTag); +@@ -33,7 +37,7 @@ public class ContainerHelper { + } + } + +- if (!listTag.isEmpty() || setIfEmpty) { ++ if ((!listTag.isEmpty() || setIfEmpty) && !(total > NbtUtility.MAXIMUM_SIZE)) { // Scissors + nbt.put("Items", listTag); + } + +@@ -42,11 +46,18 @@ public class ContainerHelper { + + public static void loadAllItems(CompoundTag nbt, NonNullList stacks) { + ListTag listTag = nbt.getList("Items", 10); ++ // Scissors - Account for items inside containers ++ long total = 0; + + for(int i = 0; i < listTag.size(); ++i) { + CompoundTag compoundTag = listTag.getCompound(i); + int j = compoundTag.getByte("Slot") & 255; + if (j >= 0 && j < stacks.size()) { ++ total += NbtUtility.getTagSize(compoundTag); ++ if (total >= NbtUtility.MAXIMUM_SIZE) { ++ stacks.clear(); ++ break; ++ } + stacks.set(j, ItemStack.of(compoundTag)); + } + } diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java index adb7220be617d6d9f2cdd7fbe4fa2dd24cc7d142..aabde31cd4c6a4f58855156272bc451b042cc315 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java @@ -52,3 +106,203 @@ index adb7220be617d6d9f2cdd7fbe4fa2dd24cc7d142..aabde31cd4c6a4f58855156272bc451b this.tag = nbt; this.processEnchantOrder(this.tag); // Paper if (this.getItem().canBeDepleted()) { +diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +index 448fa4f4f200430d6ce3051763c7ceb697696146..430810b9cc554dfb3bb0972c103c8a36e8db67ef 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +@@ -9,6 +9,7 @@ import java.util.Iterator; + import java.util.List; + import java.util.Map; + import javax.annotation.Nullable; ++import me.totalfreedom.scissors.NbtUtility; + import net.minecraft.SharedConstants; + import net.minecraft.Util; + import net.minecraft.core.BlockPos; +@@ -212,6 +213,16 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit + public List transaction = new java.util.ArrayList(); + + public List getContents() { ++ // Scissors - Account for items inside containers ++ long total = 0; ++ ++ for (ItemStack item : this.items) { ++ total += NbtUtility.getTagSize(item.getOrCreateTag()); ++ } ++ ++ if (total > NbtUtility.MAXIMUM_SIZE) { ++ this.items.clear(); ++ } + return this.items; + } + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java +index 416aa989ebb18a8741cc9d605a1180ab830f6643..893cf89dd2b022e2b785318e7e86eb5d75be8ed8 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java +@@ -1,5 +1,6 @@ + package net.minecraft.world.level.block.entity; + ++import me.totalfreedom.scissors.NbtUtility; + import net.minecraft.core.BlockPos; + import net.minecraft.core.Direction; + import net.minecraft.core.NonNullList; +@@ -34,6 +35,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity { + + @Override + public List getContents() { ++ // Scissors - Account for items inside containers ++ long total = 0; ++ ++ for (ItemStack item : this.items) { ++ total += NbtUtility.getTagSize(item.getOrCreateTag()); ++ } ++ ++ if (total > NbtUtility.MAXIMUM_SIZE) { ++ this.items.clear(); ++ } + return this.items; + } + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java +index c57efcb9a79337ec791e4e8f6671612f0a82b441..2963b72061a9ede734842d6fb46a67a1c41d4740 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java +@@ -3,6 +3,7 @@ package net.minecraft.world.level.block.entity; + import java.util.Arrays; + import java.util.Iterator; + import javax.annotation.Nullable; ++import me.totalfreedom.scissors.NbtUtility; + import net.minecraft.core.BlockPos; + import net.minecraft.core.Direction; + import net.minecraft.core.NonNullList; +@@ -73,6 +74,16 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements + } + + public List getContents() { ++ // Scissors - Account for items inside containers ++ long total = 0; ++ ++ for (ItemStack item : this.items) { ++ total += NbtUtility.getTagSize(item.getOrCreateTag()); ++ } ++ ++ if (total > NbtUtility.MAXIMUM_SIZE) { ++ this.items.clear(); ++ } + return this.items; + } + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java +index a71414397bd45ee7bcacfeef0041d80dfa25f114..1b6f91055eb01627761e83e5e99e1731029b32ab 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java +@@ -1,5 +1,6 @@ + package net.minecraft.world.level.block.entity; + ++import me.totalfreedom.scissors.NbtUtility; + import net.minecraft.core.BlockPos; + import net.minecraft.core.Direction; + import net.minecraft.core.NonNullList; +@@ -40,6 +41,16 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement + private int maxStack = MAX_STACK; + + public List getContents() { ++ // Scissors - Account for items inside containers ++ long total = 0; ++ ++ for (ItemStack item : this.items) { ++ total += NbtUtility.getTagSize(item.getOrCreateTag()); ++ } ++ ++ if (total > NbtUtility.MAXIMUM_SIZE) { ++ this.items.clear(); ++ } + return this.items; + } + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java +index 881379681c39230a00b3a1f11cd87498984396c7..1be5d600573f7632e6630224530dd76522e1b191 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java +@@ -1,5 +1,6 @@ + package net.minecraft.world.level.block.entity; + ++import me.totalfreedom.scissors.NbtUtility; + import net.minecraft.core.BlockPos; + import net.minecraft.core.NonNullList; + import net.minecraft.nbt.CompoundTag; +@@ -28,6 +29,16 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity { + private int maxStack = MAX_STACK; + + public List getContents() { ++ // Scissors - Account for items inside containers ++ long total = 0; ++ ++ for (ItemStack item : this.items) { ++ total += NbtUtility.getTagSize(item.getOrCreateTag()); ++ } ++ ++ if (total > NbtUtility.MAXIMUM_SIZE) { ++ this.items.clear(); ++ } + return this.items; + } + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +index a8a26a0a37a08b6bbeb5a1fde417d6f448d3c79f..2502c38640fa39552efc02b59733bd0d7330e13a 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +@@ -6,6 +6,7 @@ import java.util.function.BooleanSupplier; + import java.util.stream.Collectors; + import java.util.stream.IntStream; + import javax.annotation.Nullable; ++import me.totalfreedom.scissors.NbtUtility; + import net.minecraft.core.BlockPos; + import net.minecraft.core.Direction; + import net.minecraft.core.NonNullList; +@@ -56,6 +57,16 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen + private int maxStack = MAX_STACK; + + public List getContents() { ++ // Scissors - Account for items inside containers ++ long total = 0; ++ ++ for (ItemStack item : this.items) { ++ total += NbtUtility.getTagSize(item.getOrCreateTag()); ++ } ++ ++ if (total > NbtUtility.MAXIMUM_SIZE) { ++ this.items.clear(); ++ } + return this.items; + } + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java +index b7686fd63b7c5d88c3a12ec4ee9bc01a17f997e0..c2904048625bb4439c7f0ba8a2605d3194b66070 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java +@@ -3,6 +3,7 @@ package net.minecraft.world.level.block.entity; + import java.util.List; + import java.util.stream.IntStream; + import javax.annotation.Nullable; ++import me.totalfreedom.scissors.NbtUtility; + import net.minecraft.core.BlockPos; + import net.minecraft.core.Direction; + import net.minecraft.core.NonNullList; +@@ -60,6 +61,16 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl + public boolean opened; + + public List getContents() { ++ // Scissors - Account for items inside containers ++ long total = 0; ++ ++ for (ItemStack item : this.itemStacks) { ++ total += NbtUtility.getTagSize(item.getOrCreateTag()); ++ } ++ ++ if (total > NbtUtility.MAXIMUM_SIZE) { ++ this.itemStacks.clear(); ++ } + return this.itemStacks; + } + diff --git a/patches/server/0023-Account-for-items-inside-containers.patch b/patches/server/0023-Account-for-items-inside-containers.patch deleted file mode 100644 index 7e8aab7..0000000 --- a/patches/server/0023-Account-for-items-inside-containers.patch +++ /dev/null @@ -1,260 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Business Goose -Date: Sat, 11 Jun 2022 23:33:13 -0500 -Subject: [PATCH] Account for items inside containers - - -diff --git a/src/main/java/net/minecraft/world/ContainerHelper.java b/src/main/java/net/minecraft/world/ContainerHelper.java -index 4092c7a8c2b0d9d26e6f4d97386735236300d132..9e0ab51dd7a4f9fed8f9edde962d42d4bbf604c1 100644 ---- a/src/main/java/net/minecraft/world/ContainerHelper.java -+++ b/src/main/java/net/minecraft/world/ContainerHelper.java -@@ -2,6 +2,7 @@ package net.minecraft.world; - - import java.util.List; - import java.util.function.Predicate; -+import me.totalfreedom.scissors.NbtUtility; - import net.minecraft.core.NonNullList; - import net.minecraft.nbt.CompoundTag; - import net.minecraft.nbt.ListTag; -@@ -22,10 +23,13 @@ public class ContainerHelper { - - public static CompoundTag saveAllItems(CompoundTag nbt, NonNullList stacks, boolean setIfEmpty) { - ListTag listTag = new ListTag(); -+ // Scissors - Account for items inside containers -+ long total = 0; - - for(int i = 0; i < stacks.size(); ++i) { - ItemStack itemStack = stacks.get(i); - if (!itemStack.isEmpty()) { -+ total += NbtUtility.getTagSize(itemStack.getTag()); // Scissors - CompoundTag compoundTag = new CompoundTag(); - compoundTag.putByte("Slot", (byte)i); - itemStack.save(compoundTag); -@@ -33,7 +37,7 @@ public class ContainerHelper { - } - } - -- if (!listTag.isEmpty() || setIfEmpty) { -+ if ((!listTag.isEmpty() || setIfEmpty) && !(total > NbtUtility.MAXIMUM_SIZE)) { // Scissors - nbt.put("Items", listTag); - } - -@@ -42,11 +46,18 @@ public class ContainerHelper { - - public static void loadAllItems(CompoundTag nbt, NonNullList stacks) { - ListTag listTag = nbt.getList("Items", 10); -+ // Scissors - Account for items inside containers -+ long total = 0; - - for(int i = 0; i < listTag.size(); ++i) { - CompoundTag compoundTag = listTag.getCompound(i); - int j = compoundTag.getByte("Slot") & 255; - if (j >= 0 && j < stacks.size()) { -+ total += NbtUtility.getTagSize(compoundTag); -+ if (total >= NbtUtility.MAXIMUM_SIZE) { -+ stacks.clear(); -+ break; -+ } - stacks.set(j, ItemStack.of(compoundTag)); - } - } -diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index 448fa4f4f200430d6ce3051763c7ceb697696146..430810b9cc554dfb3bb0972c103c8a36e8db67ef 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -9,6 +9,7 @@ import java.util.Iterator; - import java.util.List; - import java.util.Map; - import javax.annotation.Nullable; -+import me.totalfreedom.scissors.NbtUtility; - import net.minecraft.SharedConstants; - import net.minecraft.Util; - import net.minecraft.core.BlockPos; -@@ -212,6 +213,16 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit - public List transaction = new java.util.ArrayList(); - - public List getContents() { -+ // Scissors - Account for items inside containers -+ long total = 0; -+ -+ for (ItemStack item : this.items) { -+ total += NbtUtility.getTagSize(item.getOrCreateTag()); -+ } -+ -+ if (total > NbtUtility.MAXIMUM_SIZE) { -+ this.items.clear(); -+ } - return this.items; - } - -diff --git a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java -index 416aa989ebb18a8741cc9d605a1180ab830f6643..893cf89dd2b022e2b785318e7e86eb5d75be8ed8 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java -@@ -1,5 +1,6 @@ - package net.minecraft.world.level.block.entity; - -+import me.totalfreedom.scissors.NbtUtility; - import net.minecraft.core.BlockPos; - import net.minecraft.core.Direction; - import net.minecraft.core.NonNullList; -@@ -34,6 +35,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity { - - @Override - public List getContents() { -+ // Scissors - Account for items inside containers -+ long total = 0; -+ -+ for (ItemStack item : this.items) { -+ total += NbtUtility.getTagSize(item.getOrCreateTag()); -+ } -+ -+ if (total > NbtUtility.MAXIMUM_SIZE) { -+ this.items.clear(); -+ } - return this.items; - } - -diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java -index c57efcb9a79337ec791e4e8f6671612f0a82b441..2963b72061a9ede734842d6fb46a67a1c41d4740 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java -@@ -3,6 +3,7 @@ package net.minecraft.world.level.block.entity; - import java.util.Arrays; - import java.util.Iterator; - import javax.annotation.Nullable; -+import me.totalfreedom.scissors.NbtUtility; - import net.minecraft.core.BlockPos; - import net.minecraft.core.Direction; - import net.minecraft.core.NonNullList; -@@ -73,6 +74,16 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements - } - - public List getContents() { -+ // Scissors - Account for items inside containers -+ long total = 0; -+ -+ for (ItemStack item : this.items) { -+ total += NbtUtility.getTagSize(item.getOrCreateTag()); -+ } -+ -+ if (total > NbtUtility.MAXIMUM_SIZE) { -+ this.items.clear(); -+ } - return this.items; - } - -diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java -index a71414397bd45ee7bcacfeef0041d80dfa25f114..1b6f91055eb01627761e83e5e99e1731029b32ab 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java -@@ -1,5 +1,6 @@ - package net.minecraft.world.level.block.entity; - -+import me.totalfreedom.scissors.NbtUtility; - import net.minecraft.core.BlockPos; - import net.minecraft.core.Direction; - import net.minecraft.core.NonNullList; -@@ -40,6 +41,16 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement - private int maxStack = MAX_STACK; - - public List getContents() { -+ // Scissors - Account for items inside containers -+ long total = 0; -+ -+ for (ItemStack item : this.items) { -+ total += NbtUtility.getTagSize(item.getOrCreateTag()); -+ } -+ -+ if (total > NbtUtility.MAXIMUM_SIZE) { -+ this.items.clear(); -+ } - return this.items; - } - -diff --git a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java -index 881379681c39230a00b3a1f11cd87498984396c7..1be5d600573f7632e6630224530dd76522e1b191 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java -@@ -1,5 +1,6 @@ - package net.minecraft.world.level.block.entity; - -+import me.totalfreedom.scissors.NbtUtility; - import net.minecraft.core.BlockPos; - import net.minecraft.core.NonNullList; - import net.minecraft.nbt.CompoundTag; -@@ -28,6 +29,16 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity { - private int maxStack = MAX_STACK; - - public List getContents() { -+ // Scissors - Account for items inside containers -+ long total = 0; -+ -+ for (ItemStack item : this.items) { -+ total += NbtUtility.getTagSize(item.getOrCreateTag()); -+ } -+ -+ if (total > NbtUtility.MAXIMUM_SIZE) { -+ this.items.clear(); -+ } - return this.items; - } - -diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index a8a26a0a37a08b6bbeb5a1fde417d6f448d3c79f..2502c38640fa39552efc02b59733bd0d7330e13a 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -@@ -6,6 +6,7 @@ import java.util.function.BooleanSupplier; - import java.util.stream.Collectors; - import java.util.stream.IntStream; - import javax.annotation.Nullable; -+import me.totalfreedom.scissors.NbtUtility; - import net.minecraft.core.BlockPos; - import net.minecraft.core.Direction; - import net.minecraft.core.NonNullList; -@@ -56,6 +57,16 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen - private int maxStack = MAX_STACK; - - public List getContents() { -+ // Scissors - Account for items inside containers -+ long total = 0; -+ -+ for (ItemStack item : this.items) { -+ total += NbtUtility.getTagSize(item.getOrCreateTag()); -+ } -+ -+ if (total > NbtUtility.MAXIMUM_SIZE) { -+ this.items.clear(); -+ } - return this.items; - } - -diff --git a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java -index b7686fd63b7c5d88c3a12ec4ee9bc01a17f997e0..c2904048625bb4439c7f0ba8a2605d3194b66070 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java -@@ -3,6 +3,7 @@ package net.minecraft.world.level.block.entity; - import java.util.List; - import java.util.stream.IntStream; - import javax.annotation.Nullable; -+import me.totalfreedom.scissors.NbtUtility; - import net.minecraft.core.BlockPos; - import net.minecraft.core.Direction; - import net.minecraft.core.NonNullList; -@@ -60,6 +61,16 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl - public boolean opened; - - public List getContents() { -+ // Scissors - Account for items inside containers -+ long total = 0; -+ -+ for (ItemStack item : this.itemStacks) { -+ total += NbtUtility.getTagSize(item.getOrCreateTag()); -+ } -+ -+ if (total > NbtUtility.MAXIMUM_SIZE) { -+ this.itemStacks.clear(); -+ } - return this.itemStacks; - } - diff --git a/patches/server/0024-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch b/patches/server/0023-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch similarity index 100% rename from patches/server/0024-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch rename to patches/server/0023-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch diff --git a/patches/server/0025-Better-handling-of-invalid-JSON-components.patch b/patches/server/0024-Better-handling-of-invalid-JSON-components.patch similarity index 100% rename from patches/server/0025-Better-handling-of-invalid-JSON-components.patch rename to patches/server/0024-Better-handling-of-invalid-JSON-components.patch diff --git a/patches/server/0026-Reject-oversized-components-from-updating.patch b/patches/server/0025-Reject-oversized-components-from-updating.patch similarity index 100% rename from patches/server/0026-Reject-oversized-components-from-updating.patch rename to patches/server/0025-Reject-oversized-components-from-updating.patch diff --git a/patches/server/0027-Add-MasterBlockFireEvent.patch b/patches/server/0026-Add-MasterBlockFireEvent.patch similarity index 100% rename from patches/server/0027-Add-MasterBlockFireEvent.patch rename to patches/server/0026-Add-MasterBlockFireEvent.patch diff --git a/patches/server/0028-Don-t-log-invalid-teams-to-console.patch b/patches/server/0027-Don-t-log-invalid-teams-to-console.patch similarity index 100% rename from patches/server/0028-Don-t-log-invalid-teams-to-console.patch rename to patches/server/0027-Don-t-log-invalid-teams-to-console.patch diff --git a/patches/server/0029-Block-server-side-chunkbans.patch b/patches/server/0028-Block-server-side-chunkbans.patch similarity index 100% rename from patches/server/0029-Block-server-side-chunkbans.patch rename to patches/server/0028-Block-server-side-chunkbans.patch diff --git a/patches/server/0030-Add-spectator-teleport-event.patch b/patches/server/0029-Add-spectator-teleport-event.patch similarity index 100% rename from patches/server/0030-Add-spectator-teleport-event.patch rename to patches/server/0029-Add-spectator-teleport-event.patch diff --git a/patches/server/0031-Prevent-invalid-container-events.patch b/patches/server/0030-Prevent-invalid-container-events.patch similarity index 100% rename from patches/server/0031-Prevent-invalid-container-events.patch rename to patches/server/0030-Prevent-invalid-container-events.patch diff --git a/patches/server/0032-Validate-block-entity-tag-query-positions.patch b/patches/server/0031-Validate-block-entity-tag-query-positions.patch similarity index 100% rename from patches/server/0032-Validate-block-entity-tag-query-positions.patch rename to patches/server/0031-Validate-block-entity-tag-query-positions.patch diff --git a/patches/server/0033-Refuse-to-convert-legacy-messages-over-1k-characters.patch b/patches/server/0032-Refuse-to-convert-legacy-messages-over-1k-characters.patch similarity index 100% rename from patches/server/0033-Refuse-to-convert-legacy-messages-over-1k-characters.patch rename to patches/server/0032-Refuse-to-convert-legacy-messages-over-1k-characters.patch diff --git a/patches/server/0034-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch b/patches/server/0033-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch similarity index 100% rename from patches/server/0034-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch rename to patches/server/0033-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch diff --git a/patches/server/0035-Prevent-velocity-freeze.patch b/patches/server/0034-Prevent-velocity-freeze.patch similarity index 100% rename from patches/server/0035-Prevent-velocity-freeze.patch rename to patches/server/0034-Prevent-velocity-freeze.patch diff --git a/patches/server/0036-Add-Scissors-configuration-file-command.patch b/patches/server/0035-Add-Scissors-configuration-file-command.patch similarity index 100% rename from patches/server/0036-Add-Scissors-configuration-file-command.patch rename to patches/server/0035-Add-Scissors-configuration-file-command.patch diff --git a/patches/server/0037-Patch-invalid-entity-rotation-log-spam.patch b/patches/server/0036-Patch-invalid-entity-rotation-log-spam.patch similarity index 100% rename from patches/server/0037-Patch-invalid-entity-rotation-log-spam.patch rename to patches/server/0036-Patch-invalid-entity-rotation-log-spam.patch diff --git a/patches/server/0038-Patch-large-selector-distance-crash.patch b/patches/server/0037-Patch-large-selector-distance-crash.patch similarity index 100% rename from patches/server/0038-Patch-large-selector-distance-crash.patch rename to patches/server/0037-Patch-large-selector-distance-crash.patch diff --git a/patches/server/0039-Limit-sculk-catalyst-cursor-positions.patch b/patches/server/0038-Limit-sculk-catalyst-cursor-positions.patch similarity index 100% rename from patches/server/0039-Limit-sculk-catalyst-cursor-positions.patch rename to patches/server/0038-Limit-sculk-catalyst-cursor-positions.patch diff --git a/patches/server/0040-Limit-map-decorations.patch b/patches/server/0039-Limit-map-decorations.patch similarity index 100% rename from patches/server/0040-Limit-map-decorations.patch rename to patches/server/0039-Limit-map-decorations.patch diff --git a/patches/server/0041-Prevent-player-banning-using-duplicate-UUIDs.patch b/patches/server/0040-Prevent-player-banning-using-duplicate-UUIDs.patch similarity index 100% rename from patches/server/0041-Prevent-player-banning-using-duplicate-UUIDs.patch rename to patches/server/0040-Prevent-player-banning-using-duplicate-UUIDs.patch diff --git a/patches/server/0042-Don-t-warn-on-duplicate-entity-UUIDs.patch b/patches/server/0041-Don-t-warn-on-duplicate-entity-UUIDs.patch similarity index 100% rename from patches/server/0042-Don-t-warn-on-duplicate-entity-UUIDs.patch rename to patches/server/0041-Don-t-warn-on-duplicate-entity-UUIDs.patch diff --git a/patches/server/0043-Make-excluding-players-from-nbt-components-configura.patch b/patches/server/0042-Make-excluding-players-from-nbt-components-configura.patch similarity index 100% rename from patches/server/0043-Make-excluding-players-from-nbt-components-configura.patch rename to patches/server/0042-Make-excluding-players-from-nbt-components-configura.patch diff --git a/patches/server/0044-Fix-component-extra-empty-array-exploit.patch b/patches/server/0043-Fix-component-extra-empty-array-exploit.patch similarity index 100% rename from patches/server/0044-Fix-component-extra-empty-array-exploit.patch rename to patches/server/0043-Fix-component-extra-empty-array-exploit.patch diff --git a/patches/server/0045-Add-depth-limit-to-Component-deserializer.patch b/patches/server/0044-Add-depth-limit-to-Component-deserializer.patch similarity index 100% rename from patches/server/0045-Add-depth-limit-to-Component-deserializer.patch rename to patches/server/0044-Add-depth-limit-to-Component-deserializer.patch diff --git a/patches/server/0046-Add-depth-limit-to-SNBT.patch b/patches/server/0045-Add-depth-limit-to-SNBT.patch similarity index 100% rename from patches/server/0046-Add-depth-limit-to-SNBT.patch rename to patches/server/0045-Add-depth-limit-to-SNBT.patch diff --git a/patches/server/0047-Implement-command-block-events.patch b/patches/server/0046-Implement-command-block-events.patch similarity index 100% rename from patches/server/0047-Implement-command-block-events.patch rename to patches/server/0046-Implement-command-block-events.patch diff --git a/patches/server/0048-Limit-beacon-effectRange.patch b/patches/server/0047-Limit-beacon-effectRange.patch similarity index 100% rename from patches/server/0048-Limit-beacon-effectRange.patch rename to patches/server/0047-Limit-beacon-effectRange.patch diff --git a/patches/server/0049-Fix-invalid-armor-trim-exploit.patch b/patches/server/0048-Fix-invalid-armor-trim-exploit.patch similarity index 100% rename from patches/server/0049-Fix-invalid-armor-trim-exploit.patch rename to patches/server/0048-Fix-invalid-armor-trim-exploit.patch diff --git a/patches/server/0050-Improve-validation-of-ResourceLocations.patch b/patches/server/0049-Improve-validation-of-ResourceLocations.patch similarity index 100% rename from patches/server/0050-Improve-validation-of-ResourceLocations.patch rename to patches/server/0049-Improve-validation-of-ResourceLocations.patch