mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-26 22:55:39 +00:00
Reject oversized components from updating + removes unnecessary imports from dev-imports.txt
This commit is contained in:
parent
50e5b29c3d
commit
4cecc52099
@ -8,8 +8,3 @@
|
||||
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
|
||||
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
|
||||
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
|
||||
|
||||
minecraft net/minecraft/nbt/NBTTagString.java
|
||||
minecraft net/minecraft/nbt/NBTTagList.java
|
||||
minecraft net/minecraft/nbt/NBTTagCompound.java
|
||||
minecraft net/minecraft/nbt/NBTCompressedStreamTools.java
|
@ -0,0 +1,37 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Mon, 28 Mar 2022 16:49:17 -0600
|
||||
Subject: [PATCH] Reject oversized components from updating
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
||||
index 8f4c83837d0b01a3dbca2607ea718c371db48ef4..fe2717679f84fbef1b8ff1f9a3c3bf0fba8965f1 100644
|
||||
--- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
||||
+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
||||
@@ -37,8 +37,11 @@ public class ComponentUtils {
|
||||
}
|
||||
|
||||
public static MutableComponent updateForEntity(@Nullable CommandSourceStack source, Component text, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
||||
+ // Scissors start - Reject oversized components
|
||||
+ MutableComponent result;
|
||||
+
|
||||
if (depth > 100) {
|
||||
- return text.copy();
|
||||
+ result = text.copy();
|
||||
} else {
|
||||
MutableComponent mutableComponent = text instanceof ContextAwareComponent ? ((ContextAwareComponent)text).resolve(source, sender, depth + 1) : text.plainCopy();
|
||||
|
||||
@@ -46,8 +49,12 @@ public class ComponentUtils {
|
||||
mutableComponent.append(updateForEntity(source, component, sender, depth + 1));
|
||||
}
|
||||
|
||||
- return mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth));
|
||||
+ result = mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth));
|
||||
}
|
||||
+
|
||||
+ // Would the resulting component exceed 65535 bytes when encoded as a string?
|
||||
+ return Component.Serializer.toJson(result).length() > 65535 ? new TextComponent("") : result;
|
||||
+ // Scissors end
|
||||
}
|
||||
|
||||
private static Style resolveStyle(@Nullable CommandSourceStack source, Style style, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
Loading…
Reference in New Issue
Block a user