mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-26 22:55:39 +00:00
Add patch limiting map decorations back (untested)
This commit is contained in:
parent
d3cf82a23f
commit
c268904a94
@ -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
|
48
patches/server/0039-Limit-map-decorations.patch
Normal file
48
patches/server/0039-Limit-map-decorations.patch
Normal file
@ -0,0 +1,48 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Telesphoreo <me@telesphoreo.me>
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user