mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2025-07-05 03:16:42 +00:00
Add depth limit to Component deserializer (1.19.4) (#84)
* Add depth limit to Component deserializer * Make depth limit configurable; increase placeholder penalty
This commit is contained in:
31
patches/server/0041-Limit-map-decoration-text-length.patch
Normal file
31
patches/server/0041-Limit-map-decoration-text-length.patch
Normal file
@ -0,0 +1,31 @@
|
||||
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 decoration text length
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java
|
||||
index 347d2914f9560a3ee8cea59444bc0dfbb7cf3456..b225f770869832775c9a8a79ffaf89e98245cc2e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.world.level.saveddata.maps;
|
||||
|
||||
import java.util.Objects;
|
||||
import javax.annotation.Nullable;
|
||||
+import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.util.Mth;
|
||||
|
||||
@@ -14,6 +15,12 @@ public class MapDecoration {
|
||||
private final Component name;
|
||||
|
||||
public MapDecoration(MapDecoration.Type type, byte x, byte z, byte rotation, @Nullable Component text) {
|
||||
+ // Scissors start - Limit decoration text length
|
||||
+ if (text != null && text.getString().length() > 32) {
|
||||
+ text = null;
|
||||
+ }
|
||||
+ // Scissors end
|
||||
+
|
||||
this.type = type;
|
||||
this.x = x;
|
||||
this.y = z;
|
Reference in New Issue
Block a user