mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-10-31 20:27:10 +00:00
37 lines
2.2 KiB
Diff
37 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Luna <lunahatesgogle@gmail.com>
|
|
Date: Fri, 28 Apr 2023 16:29:23 -0300
|
|
Subject: [PATCH] Limit map decorations
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
|
|
index 02e3d1c9c18952ba53507f7b6887fd3c81af33a9..61573844b236838fd219526ea35df8c7b0c94026 100644
|
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
|
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
|
|
@@ -63,7 +63,8 @@ public class ClientboundMapItemDataPacket implements Packet<ClientGamePacketList
|
|
b.writeByte(icon.x());
|
|
b.writeByte(icon.y());
|
|
b.writeByte(icon.rot() & 15);
|
|
- b.writeNullable(icon.name(), FriendlyByteBuf::writeComponent);
|
|
+ final boolean passedNameCap = icon.name() == null || icon.name().getString().length() <= 32; // Scissors
|
|
+ b.writeNullable(passedNameCap ? icon.name() : null, FriendlyByteBuf::writeComponent); // Scissors
|
|
}));
|
|
if (this.colorPatch != null) {
|
|
buf.writeByte(this.colorPatch.width);
|
|
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 45269115e63cfc3bd7dc740a5694e2cc7c35bcb1..85ea95f55fd6177748edf921e2380142d93b8b06 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;
|