From c268904a94e1a0c40f134119c464820358e44912 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Sat, 30 Sep 2023 18:45:42 -0500 Subject: [PATCH] Add patch limiting map decorations back (untested) --- build-data/dev-imports.txt | 6 ++- .../server/0039-Limit-map-decorations.patch | 48 +++++++++++++++++++ ...tch => 0040-Add-depth-limit-to-SNBT.patch} | 0 ...ch => 0042-Limit-beacon-effectRange.patch} | 0 ...n-t-log-on-too-many-chained-updates.patch} | 0 ...044-Fix-packet-related-lag-exploits.patch} | 2 +- ...-Limit-save-data-for-Bees-and-Vexes.patch} | 0 ...tch => 0046-Mute-invalid-attributes.patch} | 0 ...047-Mute-invalid-Enderdragon-phases.patch} | 0 ...dd-length-limit-to-note-block-sound.patch} | 0 10 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 patches/server/0039-Limit-map-decorations.patch rename patches/server/{0039-Add-depth-limit-to-SNBT.patch => 0040-Add-depth-limit-to-SNBT.patch} (100%) rename patches/server/{0040-Limit-beacon-effectRange.patch => 0042-Limit-beacon-effectRange.patch} (100%) rename patches/server/{0042-Don-t-log-on-too-many-chained-updates.patch => 0043-Don-t-log-on-too-many-chained-updates.patch} (100%) rename patches/server/{0043-Fix-packet-related-lag-exploits.patch => 0044-Fix-packet-related-lag-exploits.patch} (97%) rename patches/server/{0044-Limit-save-data-for-Bees-and-Vexes.patch => 0045-Limit-save-data-for-Bees-and-Vexes.patch} (100%) rename patches/server/{0045-Mute-invalid-attributes.patch => 0046-Mute-invalid-attributes.patch} (100%) rename patches/server/{0046-Mute-invalid-Enderdragon-phases.patch => 0047-Mute-invalid-Enderdragon-phases.patch} (100%) rename patches/server/{0047-Add-length-limit-to-note-block-sound.patch => 0048-Add-length-limit-to-note-block-sound.patch} (100%) diff --git a/build-data/dev-imports.txt b/build-data/dev-imports.txt index ca50913..5eb90ff 100644 --- a/build-data/dev-imports.txt +++ b/build-data/dev-imports.txt @@ -14,6 +14,8 @@ #minecraft net/minecraft/network/chat/contents/NbtContents #minecraft net/minecraft/network/chat/ComponentUtils #minecraft net/minecraft/network/chat/contents/EntityDataSource -minecraft net/minecraft/network/chat/HoverEvent -minecraft net/minecraft/world/level/block/entity/DecoratedPotBlockEntity + +## Used in Scissors 1.20.2 +#minecraft net/minecraft/network/chat/HoverEvent +#minecraft net/minecraft/world/level/block/entity/DecoratedPotBlockEntity #minecraft net/minecraft/advancements/critereon/MinMaxBounds \ No newline at end of file diff --git a/patches/server/0039-Limit-map-decorations.patch b/patches/server/0039-Limit-map-decorations.patch new file mode 100644 index 0000000..5931341 --- /dev/null +++ b/patches/server/0039-Limit-map-decorations.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Telesphoreo +Date: Sat, 30 Sep 2023 18:41:40 -0500 +Subject: [PATCH] Limit map decorations + + +diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +index e4c4948e076cd64686dfd16ae0568fafc1437140..eff53c21b18574750b691b784fb1688885d4ace7 100644 +--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java ++++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +@@ -361,6 +361,11 @@ public class MapItemSavedData extends SavedData { + } + + private void addDecoration(MapDecoration.Type type, @Nullable LevelAccessor world, String key, double x, double z, double rotation, @Nullable Component text) { ++ // Scissors start - Limit decoration count ++ if (this.decorations.size() > 32) { ++ return; ++ } ++ // Scissors end + int i = 1 << this.scale; + float f = (float) (x - (double) this.centerX) / (float) i; + float f1 = (float) (z - (double) this.centerZ) / (float) i; +diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java +index 2d2bf5c37709b8e747fbfa2db5ce86f258e86224..eeffb546dfa6a094089d322e46e44a8a69238680 100644 +--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java ++++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java +@@ -1,5 +1,6 @@ + package org.bukkit.craftbukkit.map; + ++import net.minecraft.network.chat.Component; + import net.minecraft.world.level.saveddata.maps.MapDecoration; + import net.minecraft.world.level.saveddata.maps.MapItemSavedData; + import org.bukkit.Bukkit; +@@ -42,7 +43,13 @@ public class CraftMapRenderer extends MapRenderer { + } + + MapDecoration decoration = worldMap.decorations.get(key); +- cursors.addCursor(decoration.x(), decoration.y(), (byte) (decoration.rot() & 15), decoration.type().getIcon(), true, decoration.name() == null ? null : io.papermc.paper.adventure.PaperAdventure.asAdventure(decoration.name())); // Paper ++ // Scissors start - Limit decoration text length ++ Component name = decoration.name(); ++ if (decoration.name() != null && decoration.name().getString().length() > 32) { ++ name = null; ++ } ++ cursors.addCursor(decoration.x(), decoration.y(), (byte) (decoration.rot() & 15), decoration.type().getIcon(), true, name == null ? null : io.papermc.paper.adventure.PaperAdventure.asAdventure(decoration.name())); // Paper ++ // Scissors end + } + } + diff --git a/patches/server/0039-Add-depth-limit-to-SNBT.patch b/patches/server/0040-Add-depth-limit-to-SNBT.patch similarity index 100% rename from patches/server/0039-Add-depth-limit-to-SNBT.patch rename to patches/server/0040-Add-depth-limit-to-SNBT.patch diff --git a/patches/server/0040-Limit-beacon-effectRange.patch b/patches/server/0042-Limit-beacon-effectRange.patch similarity index 100% rename from patches/server/0040-Limit-beacon-effectRange.patch rename to patches/server/0042-Limit-beacon-effectRange.patch diff --git a/patches/server/0042-Don-t-log-on-too-many-chained-updates.patch b/patches/server/0043-Don-t-log-on-too-many-chained-updates.patch similarity index 100% rename from patches/server/0042-Don-t-log-on-too-many-chained-updates.patch rename to patches/server/0043-Don-t-log-on-too-many-chained-updates.patch diff --git a/patches/server/0043-Fix-packet-related-lag-exploits.patch b/patches/server/0044-Fix-packet-related-lag-exploits.patch similarity index 97% rename from patches/server/0043-Fix-packet-related-lag-exploits.patch rename to patches/server/0044-Fix-packet-related-lag-exploits.patch index 9da32d6..713a38a 100644 --- a/patches/server/0043-Fix-packet-related-lag-exploits.patch +++ b/patches/server/0044-Fix-packet-related-lag-exploits.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix packet-related lag exploits diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index b4213a2f0f8c57b606b1a1a993d352bda200bd63..957c1ec2b6ae60c5de5960a13a2900762b6ffb61 100644 +index 4d225bb5126c083e0bf7f98992cd6d63c2dd44e9..73f6423b96ffa392e390df269f94c4012333a3e4 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -858,7 +858,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0044-Limit-save-data-for-Bees-and-Vexes.patch b/patches/server/0045-Limit-save-data-for-Bees-and-Vexes.patch similarity index 100% rename from patches/server/0044-Limit-save-data-for-Bees-and-Vexes.patch rename to patches/server/0045-Limit-save-data-for-Bees-and-Vexes.patch diff --git a/patches/server/0045-Mute-invalid-attributes.patch b/patches/server/0046-Mute-invalid-attributes.patch similarity index 100% rename from patches/server/0045-Mute-invalid-attributes.patch rename to patches/server/0046-Mute-invalid-attributes.patch diff --git a/patches/server/0046-Mute-invalid-Enderdragon-phases.patch b/patches/server/0047-Mute-invalid-Enderdragon-phases.patch similarity index 100% rename from patches/server/0046-Mute-invalid-Enderdragon-phases.patch rename to patches/server/0047-Mute-invalid-Enderdragon-phases.patch diff --git a/patches/server/0047-Add-length-limit-to-note-block-sound.patch b/patches/server/0048-Add-length-limit-to-note-block-sound.patch similarity index 100% rename from patches/server/0047-Add-length-limit-to-note-block-sound.patch rename to patches/server/0048-Add-length-limit-to-note-block-sound.patch