mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-10-31 20:27:10 +00:00
apply patches that i can
This commit is contained in:
parent
43afa1c23f
commit
b495eaa9f8
@ -2,7 +2,7 @@ group=me.totalfreedom.scissors
|
|||||||
version=1.20.4-R0.1-SNAPSHOT
|
version=1.20.4-R0.1-SNAPSHOT
|
||||||
|
|
||||||
mcVersion=1.20.4
|
mcVersion=1.20.4
|
||||||
paperRef=5436d44bf2509ff89129f8790ee4643f09c72871
|
paperRef=4445d23544e0801fb6f658de98815ce0d8c04f58
|
||||||
|
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] UUID validation
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
index 7fd85ae2ebd7225f06d874aa7e37fbdb89e3ea92..b2cc15da40aa7bbcfc234b4e147ed0e53f359efa 100644
|
index 9067bab8ec695417d479393f07d9bc6432427d73..433e586bed53a8c17adec74b3088899c748d4be3 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
@@ -20,6 +20,7 @@ import net.minecraft.nbt.CompoundTag;
|
@@ -20,6 +20,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||||
@ -16,7 +16,7 @@ index 7fd85ae2ebd7225f06d874aa7e37fbdb89e3ea92..b2cc15da40aa7bbcfc234b4e147ed0e5
|
|||||||
import net.minecraft.util.StringRepresentable;
|
import net.minecraft.util.StringRepresentable;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
@@ -161,7 +162,14 @@ public class HoverEvent {
|
@@ -148,7 +149,14 @@ public class HoverEvent {
|
||||||
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
||||||
Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
|
Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
|
||||||
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
|
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
|
||||||
@ -31,4 +31,4 @@ index 7fd85ae2ebd7225f06d874aa7e37fbdb89e3ea92..b2cc15da40aa7bbcfc234b4e147ed0e5
|
|||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
return DataResult.success(new HoverEvent.EntityTooltipInfo(entityType, uUID, component));
|
return DataResult.success(new HoverEvent.EntityTooltipInfo(entityType, uUID, component));
|
||||||
} catch (Exception var5) {
|
} catch (Exception var5) {
|
||||||
return DataResult.error(() -> {
|
return DataResult.error(() -> "Failed to parse tooltip: " + var5.getMessage());
|
||||||
|
@ -6,17 +6,17 @@ Subject: [PATCH] Fixes Knowledge Books causing log spam when invalid data is
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
diff --git a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
||||||
index 37f37be56bab171df442b980ff46ff325daae283..deade19d16a7d6870171b9a60806a8cadb437db4 100644
|
index 5ebc309aed545a4c22970e617519fe916a29fa3c..14a35465e41c9ecb51bea5b084e2637ebd21d295 100644
|
||||||
--- a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
--- a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
||||||
+++ b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
+++ b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
||||||
@@ -40,9 +40,9 @@ public class KnowledgeBookItem extends Item {
|
@@ -40,9 +40,9 @@ public class KnowledgeBookItem extends Item {
|
||||||
|
|
||||||
for(int i = 0; i < listTag.size(); ++i) {
|
for (int i = 0; i < listTag.size(); i++) {
|
||||||
String string = listTag.getString(i);
|
String string = listTag.getString(i);
|
||||||
- Optional<RecipeHolder<?>> optional = recipeManager.byKey(new ResourceLocation(string));
|
- Optional<RecipeHolder<?>> optional = recipeManager.byKey(new ResourceLocation(string));
|
||||||
+ Optional<RecipeHolder<?>> optional = recipeManager.byKey(ResourceLocation.tryParse(string)); // Scissors - Validate resource locations
|
+ Optional<RecipeHolder<?>> optional = recipeManager.byKey(ResourceLocation.tryParse(string)); // Scissors - Validate resource locations
|
||||||
if (!optional.isPresent()) {
|
if (!optional.isPresent()) {
|
||||||
- LOGGER.error("Invalid recipe: {}", (Object)string);
|
- LOGGER.error("Invalid recipe: {}", string);
|
||||||
+ // Scissors - Don't log errors caused by invalid recipes being provided
|
+ // Scissors - Don't log errors caused by invalid recipes being provided
|
||||||
return InteractionResultHolder.fail(itemStack);
|
return InteractionResultHolder.fail(itemStack);
|
||||||
}
|
}
|
||||||
@ -25,7 +25,7 @@ index 37f37be56bab171df442b980ff46ff325daae283..deade19d16a7d6870171b9a60806a8ca
|
|||||||
|
|
||||||
return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide());
|
return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide());
|
||||||
} else {
|
} else {
|
||||||
- LOGGER.error("Tag not valid: {}", (Object)compoundTag);
|
- LOGGER.error("Tag not valid: {}", compoundTag);
|
||||||
+ // Scissors - Don't throw errors into the logs if an NBT compound isn't present or is missing the Recipes tag.
|
+ // Scissors - Don't throw errors into the logs if an NBT compound isn't present or is missing the Recipes tag.
|
||||||
return InteractionResultHolder.fail(itemStack);
|
return InteractionResultHolder.fail(itemStack);
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Validate BlockState and SoundEvent values
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
index e3a3f19a6e63fd42e29c418e5a7439972484d492..39866c58f9dbca9b4f0018922eac076c64ffbdae 100644
|
index fe4bea6af0d8734f3a5b972dce5f1e3914d6690e..0ee64be4288f59240beec26c470b78cc1aeac424 100644
|
||||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
@@ -231,7 +231,7 @@ public final class NbtUtils {
|
@@ -223,7 +223,7 @@ public final class NbtUtils {
|
||||||
return Blocks.AIR.defaultBlockState();
|
return Blocks.AIR.defaultBlockState();
|
||||||
} else {
|
} else {
|
||||||
// Paper start - Validate resource location
|
// Paper start - Validate resource location
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
|
||||||
Date: Sun, 10 Dec 2023 17:13:15 -0600
|
|
||||||
Subject: [PATCH] Do not log invalid items in HoverEvent and ItemFrame
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
||||||
index b2cc15da40aa7bbcfc234b4e147ed0e53f359efa..dbe9f81e298a931c3e0e5b879dc13b493b3fdb52 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
||||||
@@ -280,7 +280,7 @@ public class HoverEvent {
|
|
||||||
return DataResult.success(new HoverEvent.ItemStackInfo(ItemStack.of(compoundTag)));
|
|
||||||
} catch (CommandSyntaxException var2) {
|
|
||||||
return DataResult.error(() -> {
|
|
||||||
- return "Failed to parse item tag: " + var2.getMessage();
|
|
||||||
+ return null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
|
||||||
index 80303f9466b8c7097151be313afc9a383693d18a..a5235e9035768a588af522af645fa136c9c897cf 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
|
||||||
@@ -436,7 +436,7 @@ public class ItemFrame extends HangingEntity {
|
|
||||||
ItemStack itemstack = ItemStack.of(nbttagcompound1);
|
|
||||||
|
|
||||||
if (itemstack.isEmpty()) {
|
|
||||||
- ItemFrame.LOGGER.warn("Unable to load item from: {}", nbttagcompound1);
|
|
||||||
+ // Scissors - ignore invalid items
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack itemstack1 = this.getItem();
|
|
@ -5,7 +5,7 @@ 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
|
diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
||||||
index 57206594f305961a33542e1f8079c75bfa7c535f..ea4504be0eb115e563a4abd9dcbcedd57f9edcc2 100644
|
index 3365aed2b67ae0e4dd0410f5190ba474f146139b..43b62a07b040b1d7d76dc8f940f35b51d1d5f868 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
--- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
||||||
@@ -38,8 +38,9 @@ public class ComponentUtils {
|
@@ -38,8 +38,9 @@ public class ComponentUtils {
|
@ -1,150 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Video <videogamesm12@gmail.com>
|
|
||||||
Date: Sun, 10 Dec 2023 17:26:11 -0600
|
|
||||||
Subject: [PATCH] Better handling of invalid JSON components
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
|
|
||||||
index e028353e0261310afc42ca0454b723d9f1ffc131..4e9366eee55236a08f1b8c56029c50e7b8c663de 100644
|
|
||||||
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
|
|
||||||
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
|
|
||||||
@@ -675,12 +675,6 @@ public final class MCUtil {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
String string = compound.getString(key);
|
|
||||||
- try {
|
|
||||||
- return net.minecraft.network.chat.Component.Serializer.fromJson(string);
|
|
||||||
- } catch (com.google.gson.JsonParseException e) {
|
|
||||||
- org.bukkit.Bukkit.getLogger().warning("Unable to parse " + key + " from " + compound +": " + e.getMessage());
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- return null;
|
|
||||||
+ return net.minecraft.network.chat.Component.Serializer.fromJsonSafe(string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
|
||||||
index d3a80d0a23be762c05931ae8001d98e43cab2b4a..ba13650b52e39c9cc5cfa421f7720c7d4ba75678 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
|
||||||
@@ -23,6 +23,8 @@ import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+
|
|
||||||
+import net.minecraft.ChatFormatting;
|
|
||||||
import net.minecraft.Util;
|
|
||||||
import net.minecraft.network.chat.contents.DataSource;
|
|
||||||
import net.minecraft.network.chat.contents.KeybindContents;
|
|
||||||
@@ -315,6 +317,26 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
|
||||||
return json == null ? null : Serializer.deserialize(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ @Nullable
|
|
||||||
+ public static MutableComponent fromJsonSafe(String json) {
|
|
||||||
+ try {
|
|
||||||
+ return fromJson(json);
|
|
||||||
+ } catch (Exception ex) {
|
|
||||||
+ return Component.empty().append("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Nullable
|
|
||||||
+ public static MutableComponent fromJsonSafe(JsonElement json) {
|
|
||||||
+ try {
|
|
||||||
+ return fromJson(json);
|
|
||||||
+ } catch (Exception ex) {
|
|
||||||
+ return Component.empty().append("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
@Nullable
|
|
||||||
public static MutableComponent fromJsonLenient(String json) {
|
|
||||||
JsonReader jsonreader = new JsonReader(new StringReader(json));
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
||||||
index dbe9f81e298a931c3e0e5b879dc13b493b3fdb52..6708290b6d096e8081c56d2e0da3c9ae2a112176 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
||||||
@@ -160,7 +160,7 @@ public class HoverEvent {
|
|
||||||
public static DataResult<HoverEvent.EntityTooltipInfo> legacyCreate(Component text) {
|
|
||||||
try {
|
|
||||||
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
|
||||||
- Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
|
|
||||||
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("name")); // Scissors - Use safer method for getting Components from JSON
|
|
||||||
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
|
|
||||||
// Scissors start
|
|
||||||
UUID uUID;
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
|
||||||
index 186547674894fd084bceb478bb6017b747df4173..74c880425964da042ca57c097eb93273da59ce7e 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
|
||||||
@@ -115,10 +115,10 @@ public class NbtContents implements ComponentContents {
|
|
||||||
Component component = DataFixUtils.orElse(ComponentUtils.updateForEntity(source, this.separator, sender, depth), ComponentUtils.DEFAULT_NO_STYLE_SEPARATOR);
|
|
||||||
return stream.flatMap((text) -> {
|
|
||||||
try {
|
|
||||||
- MutableComponent mutableComponent = Component.Serializer.fromJson(text);
|
|
||||||
+ MutableComponent mutableComponent = Component.Serializer.fromJsonSafe(text);
|
|
||||||
return Stream.of(ComponentUtils.updateForEntity(source, mutableComponent, sender, depth));
|
|
||||||
} catch (Exception var5) {
|
|
||||||
- LOGGER.warn("Failed to parse component: {}", text, var5);
|
|
||||||
+ // Scissors - don't log
|
|
||||||
return Stream.of();
|
|
||||||
}
|
|
||||||
}).reduce((accumulator, current) -> {
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
index 51097f1d04d981db2823e8647b546658b8fd27c1..2e32c600a04e0ad280a7ddcce23668afbd187a57 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
@@ -2545,11 +2545,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
||||||
if (nbt.contains("CustomName", 8)) {
|
|
||||||
String s = nbt.getString("CustomName");
|
|
||||||
|
|
||||||
- try {
|
|
||||||
- this.setCustomName(Component.Serializer.fromJson(s));
|
|
||||||
- } catch (Exception exception) {
|
|
||||||
- Entity.LOGGER.warn("Failed to parse entity custom name {}", s, exception);
|
|
||||||
- }
|
|
||||||
+ this.setCustomName(Component.Serializer.fromJsonSafe(s)); // Scissors - Use safer method for getting Components from JSON
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setCustomNameVisible(nbt.getBoolean("CustomNameVisible"));
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
|
||||||
index 6c3ed29e13ea78ceb1c9bb11ce0d9938bb8b4c62..ab2f9b9a021e05ad66a3701577862fa2acf81f52 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
|
||||||
@@ -41,7 +41,7 @@ public class ScoreboardSaveData extends SavedData {
|
|
||||||
CompoundTag compoundTag = nbt.getCompound(i);
|
|
||||||
String string = compoundTag.getString("Name");
|
|
||||||
PlayerTeam playerTeam = this.scoreboard.addPlayerTeam(string);
|
|
||||||
- Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName"));
|
|
||||||
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("DisplayName")); // Scissors - Use safer method for getting Components from JSON
|
|
||||||
if (component != null) {
|
|
||||||
playerTeam.setDisplayName(component);
|
|
||||||
}
|
|
||||||
@@ -59,14 +59,14 @@ public class ScoreboardSaveData extends SavedData {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (compoundTag.contains("MemberNamePrefix", 8)) {
|
|
||||||
- Component component2 = Component.Serializer.fromJson(compoundTag.getString("MemberNamePrefix"));
|
|
||||||
+ Component component2 = Component.Serializer.fromJsonSafe(compoundTag.getString("MemberNamePrefix")); // Scissors - Use safer method for getting Components from JSON
|
|
||||||
if (component2 != null) {
|
|
||||||
playerTeam.setPlayerPrefix(component2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (compoundTag.contains("MemberNameSuffix", 8)) {
|
|
||||||
- Component component3 = Component.Serializer.fromJson(compoundTag.getString("MemberNameSuffix"));
|
|
||||||
+ Component component3 = Component.Serializer.fromJsonSafe(compoundTag.getString("MemberNameSuffix")); // Scissors - Use safer method for getting Components from JSON
|
|
||||||
if (component3 != null) {
|
|
||||||
playerTeam.setPlayerSuffix(component3);
|
|
||||||
}
|
|
||||||
@@ -126,7 +126,7 @@ public class ScoreboardSaveData extends SavedData {
|
|
||||||
return ObjectiveCriteria.DUMMY;
|
|
||||||
});
|
|
||||||
String string2 = compoundTag.getString("Name");
|
|
||||||
- Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName"));
|
|
||||||
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("DisplayName")); // Scissors - Use safer method for getting Components from JSON
|
|
||||||
ObjectiveCriteria.RenderType renderType = ObjectiveCriteria.RenderType.byId(compoundTag.getString("RenderType"));
|
|
||||||
boolean bl = compoundTag.getBoolean("display_auto_update");
|
|
||||||
NumberFormat numberFormat = NumberFormatTypes.CODEC.parse(NbtOps.INSTANCE, compoundTag.get("format")).result().orElse((NumberFormat)null);
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Block server-side chunkbans
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
|
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||||
index 85b8be8ffac0fb40e9cae0528271ed41473811c8..d0cfc4fc00d45c91380d2d794ca816db74d40266 100644
|
index 96d5448019d53ac3575e209c1c5c223a62a2638d..d0cfc4fc00d45c91380d2d794ca816db74d40266 100644
|
||||||
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
|
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||||
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java
|
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||||
@@ -7,8 +7,17 @@ import io.netty.handler.codec.MessageToByteEncoder;
|
@@ -7,8 +7,17 @@ import io.netty.handler.codec.MessageToByteEncoder;
|
||||||
@ -50,7 +50,7 @@ index 85b8be8ffac0fb40e9cae0528271ed41473811c8..d0cfc4fc00d45c91380d2d794ca816db
|
|||||||
protected void encode(ChannelHandlerContext channelHandlerContext, Packet<?> packet, ByteBuf byteBuf) throws Exception {
|
protected void encode(ChannelHandlerContext channelHandlerContext, Packet<?> packet, ByteBuf byteBuf) throws Exception {
|
||||||
Attribute<ConnectionProtocol.CodecData<?>> attribute = channelHandlerContext.channel().attr(this.codecKey);
|
Attribute<ConnectionProtocol.CodecData<?>> attribute = channelHandlerContext.channel().attr(this.codecKey);
|
||||||
ConnectionProtocol.CodecData<?> codecData = attribute.get();
|
ConnectionProtocol.CodecData<?> codecData = attribute.get();
|
||||||
@@ -34,46 +60,58 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
|
@@ -34,45 +60,58 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
|
||||||
throw new IOException("Can't serialize unregistered packet");
|
throw new IOException("Can't serialize unregistered packet");
|
||||||
} else {
|
} else {
|
||||||
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf);
|
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf);
|
||||||
@ -74,7 +74,10 @@ index 85b8be8ffac0fb40e9cae0528271ed41473811c8..d0cfc4fc00d45c91380d2d794ca816db
|
|||||||
- String packetName = io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(packet.getClass().getName());
|
- String packetName = io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(packet.getClass().getName());
|
||||||
- if (packetName.contains(".")) {
|
- if (packetName.contains(".")) {
|
||||||
- packetName = packetName.substring(packetName.lastIndexOf(".") + 1);
|
- packetName = packetName.substring(packetName.lastIndexOf(".") + 1);
|
||||||
- }
|
+ packet = capPacket(packet, i);
|
||||||
|
+ if (packet == null) {
|
||||||
|
+ throw new SkipPacketException(new IllegalArgumentException("Packet too big: " + packet));
|
||||||
|
}
|
||||||
-
|
-
|
||||||
- LOGGER.error("Packet encoding of packet {} (ID: {}) threw (skippable? {})", packetName, i, packet.isSkippable(), var13);
|
- LOGGER.error("Packet encoding of packet {} (ID: {}) threw (skippable? {})", packetName, i, packet.isSkippable(), var13);
|
||||||
- // Paper end
|
- // Paper end
|
||||||
@ -88,16 +91,12 @@ index 85b8be8ffac0fb40e9cae0528271ed41473811c8..d0cfc4fc00d45c91380d2d794ca816db
|
|||||||
- int packetLength = friendlyByteBuf.readableBytes();
|
- int packetLength = friendlyByteBuf.readableBytes();
|
||||||
- if (packetLength > MAX_PACKET_SIZE) {
|
- if (packetLength > MAX_PACKET_SIZE) {
|
||||||
- throw new PacketTooLargeException(packet, this.codecKey, packetLength);
|
- throw new PacketTooLargeException(packet, this.codecKey, packetLength);
|
||||||
+ packet = capPacket(packet, i);
|
- }
|
||||||
+ if (packet == null) {
|
|
||||||
+ throw new SkipPacketException(new IllegalArgumentException("Packet too big: " + packet));
|
|
||||||
}
|
|
||||||
- // Paper end - Handle large packets disconnecting client
|
- // Paper end - Handle large packets disconnecting client
|
||||||
- ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet);
|
- ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet);
|
||||||
+ friendlyByteBuf.clear();
|
+ friendlyByteBuf.clear();
|
||||||
+ k = this.tryWrite(packet, friendlyByteBuf, channelHandlerContext, i);
|
+ k = this.tryWrite(packet, friendlyByteBuf, channelHandlerContext, i);
|
||||||
}
|
}
|
||||||
-
|
|
||||||
+ JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k);
|
+ JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k);
|
||||||
+ ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet);
|
+ ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet);
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
@ -154,7 +153,7 @@ index 3944852921335c78a04a9dc301882ab5b152b1ed..96ee53c7cc862e059328c5cdf5e07f30
|
|||||||
this.type = blockEntityType;
|
this.type = blockEntityType;
|
||||||
this.tag = nbt.isEmpty() ? null : nbt;
|
this.tag = nbt.isEmpty() ? null : nbt;
|
||||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||||
index 998deae645b4497c3285bfba3260c636439f9ecf..f419d4330ea55c1ed91c539a7884ee6814a16ca3 100644
|
index 76bde683d193b37e563a67c1c7b9bdcf17d64524..185aa88ff28e6f3e3314abe19dff88609a47334e 100644
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||||
@@ -33,6 +33,13 @@ public class ClientboundLevelChunkPacketData {
|
@@ -33,6 +33,13 @@ public class ClientboundLevelChunkPacketData {
|
||||||
@ -174,7 +173,7 @@ index 998deae645b4497c3285bfba3260c636439f9ecf..f419d4330ea55c1ed91c539a7884ee68
|
|||||||
@@ -58,6 +65,7 @@ public class ClientboundLevelChunkPacketData {
|
@@ -58,6 +65,7 @@ public class ClientboundLevelChunkPacketData {
|
||||||
int totalTileEntities = 0; // Paper - Handle oversized block entities in chunks
|
int totalTileEntities = 0; // Paper - Handle oversized block entities in chunks
|
||||||
|
|
||||||
for(Map.Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) {
|
for (Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) {
|
||||||
+ if (this.extraPackets.size() > 50) break; // Scissors - Limit extraPackets size
|
+ if (this.extraPackets.size() > 50) break; // Scissors - Limit extraPackets size
|
||||||
// Paper start - Handle oversized block entities in chunks
|
// Paper start - Handle oversized block entities in chunks
|
||||||
if (++totalTileEntities > TE_LIMIT) {
|
if (++totalTileEntities > TE_LIMIT) {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Don't query player data in the `nbt` component
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
diff --git a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
||||||
index 3bec895fecb3521653fb0b88d4a4854fd3766b46..5fd278ac13c02b9d511be22dba9719cb0cb0e17b 100644
|
index 2750702cff35762bc817ffbe5bf81631e86bc49b..8714c3be77490a87aa6df0ff36a87557c6b99e25 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
--- a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
+++ b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
||||||
@@ -8,12 +8,15 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
|
@@ -8,12 +8,15 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
@ -23,7 +23,7 @@ index 3bec895fecb3521653fb0b88d4a4854fd3766b46..5fd278ac13c02b9d511be22dba9719cb
|
|||||||
+import net.minecraft.world.entity.player.Player;
|
+import net.minecraft.world.entity.player.Player;
|
||||||
|
|
||||||
public record EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector) implements DataSource {
|
public record EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector) implements DataSource {
|
||||||
public static final MapCodec<EntityDataSource> SUB_CODEC = RecordCodecBuilder.mapCodec((instance) -> {
|
public static final MapCodec<EntityDataSource> SUB_CODEC = RecordCodecBuilder.mapCodec(
|
||||||
@@ -39,7 +42,11 @@ public record EntityDataSource(String selectorPattern, @Nullable EntitySelector
|
@@ -39,7 +42,11 @@ public record EntityDataSource(String selectorPattern, @Nullable EntitySelector
|
||||||
public Stream<CompoundTag> getData(CommandSourceStack source) throws CommandSyntaxException {
|
public Stream<CompoundTag> getData(CommandSourceStack source) throws CommandSyntaxException {
|
||||||
if (this.compiledSelector != null) {
|
if (this.compiledSelector != null) {
|
@ -5,32 +5,32 @@ Subject: [PATCH] Limit string tag visitors to 1024 elements
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java b/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java
|
diff --git a/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java b/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java
|
||||||
index e07cc7970955ce240754cfe424d768c2bba0241a..a4f41bb4ec6cb20f782668c714229b61415cfdfb 100644
|
index b45bb4ddf6b586ba1285db230e0bc3d1b5e447e8..4a46935cac263325a87a1b0bf32302839a75516e 100644
|
||||||
--- a/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java
|
--- a/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java
|
||||||
+++ b/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java
|
+++ b/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java
|
||||||
@@ -89,6 +89,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
|
@@ -89,6 +89,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
|
||||||
public void visitByteArray(ByteArrayTag element) {
|
public void visitByteArray(ByteArrayTag element) {
|
||||||
StringBuilder stringBuilder = (new StringBuilder("[")).append("B").append(";");
|
StringBuilder stringBuilder = new StringBuilder("[").append("B").append(";");
|
||||||
byte[] bs = element.getAsByteArray();
|
byte[] bs = element.getAsByteArray();
|
||||||
+ if (bs.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors
|
+ if (bs.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors
|
||||||
|
|
||||||
for(int i = 0; i < bs.length; ++i) {
|
for (int i = 0; i < bs.length; i++) {
|
||||||
stringBuilder.append(" ").append((int)bs[i]).append("B");
|
stringBuilder.append(" ").append(bs[i]).append("B");
|
||||||
@@ -105,6 +106,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
|
@@ -105,6 +106,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
|
||||||
public void visitIntArray(IntArrayTag element) {
|
public void visitIntArray(IntArrayTag element) {
|
||||||
StringBuilder stringBuilder = (new StringBuilder("[")).append("I").append(";");
|
StringBuilder stringBuilder = new StringBuilder("[").append("I").append(";");
|
||||||
int[] is = element.getAsIntArray();
|
int[] is = element.getAsIntArray();
|
||||||
+ if (is.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors
|
+ if (is.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors
|
||||||
|
|
||||||
for(int i = 0; i < is.length; ++i) {
|
for (int i = 0; i < is.length; i++) {
|
||||||
stringBuilder.append(" ").append(is[i]);
|
stringBuilder.append(" ").append(is[i]);
|
||||||
@@ -122,6 +124,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
|
@@ -122,6 +124,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
|
||||||
String string = "L";
|
String string = "L";
|
||||||
StringBuilder stringBuilder = (new StringBuilder("[")).append("L").append(";");
|
StringBuilder stringBuilder = new StringBuilder("[").append("L").append(";");
|
||||||
long[] ls = element.getAsLongArray();
|
long[] ls = element.getAsLongArray();
|
||||||
+ if (ls.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors
|
+ if (ls.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors
|
||||||
|
|
||||||
for(int i = 0; i < ls.length; ++i) {
|
for (int i = 0; i < ls.length; i++) {
|
||||||
stringBuilder.append(" ").append(ls[i]).append("L");
|
stringBuilder.append(" ").append(ls[i]).append("L");
|
||||||
@@ -136,7 +139,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
|
@@ -136,7 +139,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ index e07cc7970955ce240754cfe424d768c2bba0241a..a4f41bb4ec6cb20f782668c714229b61
|
|||||||
} else {
|
} else {
|
||||||
StringBuilder stringBuilder = new StringBuilder("{");
|
StringBuilder stringBuilder = new StringBuilder("{");
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/StringTagVisitor.java b/src/main/java/net/minecraft/nbt/StringTagVisitor.java
|
diff --git a/src/main/java/net/minecraft/nbt/StringTagVisitor.java b/src/main/java/net/minecraft/nbt/StringTagVisitor.java
|
||||||
index a687a0f17df30126d53a1e3a669dc6d157c23ed5..2c50f41dd8034af16fcceca75eeb6c7a9940e327 100644
|
index d8892641d5671fa100aeb43d42ebb6103a2d280c..d10242ecd6f8442e1af3f4cd13f769517b33058a 100644
|
||||||
--- a/src/main/java/net/minecraft/nbt/StringTagVisitor.java
|
--- a/src/main/java/net/minecraft/nbt/StringTagVisitor.java
|
||||||
+++ b/src/main/java/net/minecraft/nbt/StringTagVisitor.java
|
+++ b/src/main/java/net/minecraft/nbt/StringTagVisitor.java
|
||||||
@@ -53,6 +53,7 @@ public class StringTagVisitor implements TagVisitor {
|
@@ -53,6 +53,7 @@ public class StringTagVisitor implements TagVisitor {
|
||||||
@ -60,7 +60,7 @@ index a687a0f17df30126d53a1e3a669dc6d157c23ed5..2c50f41dd8034af16fcceca75eeb6c7a
|
|||||||
byte[] bs = element.getAsByteArray();
|
byte[] bs = element.getAsByteArray();
|
||||||
+ if (bs.length > 1024) { this.builder.append(']'); return; } // Scissors
|
+ if (bs.length > 1024) { this.builder.append(']'); return; } // Scissors
|
||||||
|
|
||||||
for(int i = 0; i < bs.length; ++i) {
|
for (int i = 0; i < bs.length; i++) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
@@ -69,6 +70,7 @@ public class StringTagVisitor implements TagVisitor {
|
@@ -69,6 +70,7 @@ public class StringTagVisitor implements TagVisitor {
|
||||||
public void visitIntArray(IntArrayTag element) {
|
public void visitIntArray(IntArrayTag element) {
|
||||||
@ -68,7 +68,7 @@ index a687a0f17df30126d53a1e3a669dc6d157c23ed5..2c50f41dd8034af16fcceca75eeb6c7a
|
|||||||
int[] is = element.getAsIntArray();
|
int[] is = element.getAsIntArray();
|
||||||
+ if (is.length > 1024) { this.builder.append(']'); return; } // Scissors
|
+ if (is.length > 1024) { this.builder.append(']'); return; } // Scissors
|
||||||
|
|
||||||
for(int i = 0; i < is.length; ++i) {
|
for (int i = 0; i < is.length; i++) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
@@ -85,6 +87,7 @@ public class StringTagVisitor implements TagVisitor {
|
@@ -85,6 +87,7 @@ public class StringTagVisitor implements TagVisitor {
|
||||||
public void visitLongArray(LongArrayTag element) {
|
public void visitLongArray(LongArrayTag element) {
|
||||||
@ -76,7 +76,7 @@ index a687a0f17df30126d53a1e3a669dc6d157c23ed5..2c50f41dd8034af16fcceca75eeb6c7a
|
|||||||
long[] ls = element.getAsLongArray();
|
long[] ls = element.getAsLongArray();
|
||||||
+ if (ls.length > 1024) { this.builder.append(']'); return; } // Scissors
|
+ if (ls.length > 1024) { this.builder.append(']'); return; } // Scissors
|
||||||
|
|
||||||
for(int i = 0; i < ls.length; ++i) {
|
for (int i = 0; i < ls.length; i++) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
@@ -100,6 +103,7 @@ public class StringTagVisitor implements TagVisitor {
|
@@ -100,6 +103,7 @@ public class StringTagVisitor implements TagVisitor {
|
||||||
@Override
|
@Override
|
||||||
@ -84,7 +84,7 @@ index a687a0f17df30126d53a1e3a669dc6d157c23ed5..2c50f41dd8034af16fcceca75eeb6c7a
|
|||||||
this.builder.append('[');
|
this.builder.append('[');
|
||||||
+ if (element.size() > 1024) { this.builder.append(']'); return; } // Scissors
|
+ if (element.size() > 1024) { this.builder.append(']'); return; } // Scissors
|
||||||
|
|
||||||
for(int i = 0; i < element.size(); ++i) {
|
for (int i = 0; i < element.size(); i++) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
@@ -116,6 +120,7 @@ public class StringTagVisitor implements TagVisitor {
|
@@ -116,6 +120,7 @@ public class StringTagVisitor implements TagVisitor {
|
||||||
public void visitCompound(CompoundTag compound) {
|
public void visitCompound(CompoundTag compound) {
|
||||||
@ -93,9 +93,9 @@ index a687a0f17df30126d53a1e3a669dc6d157c23ed5..2c50f41dd8034af16fcceca75eeb6c7a
|
|||||||
+ if (list.size() > 1024) { this.builder.append('}'); return; } // Scissors
|
+ if (list.size() > 1024) { this.builder.append('}'); return; } // Scissors
|
||||||
Collections.sort(list);
|
Collections.sort(list);
|
||||||
|
|
||||||
for(String string : list) {
|
for (String string : list) {
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java b/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
diff --git a/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java b/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
||||||
index 149def3da0b92f64e4fc04630965dce44884f938..c9d753f37bd65e35f8a4e2eb5c6fe8f74d5d1606 100644
|
index 4e238ae29347c5e976ff0d506e94972df0aa7362..9776b9741a7ec46c603b2c2bccd5f006c15cee41 100644
|
||||||
--- a/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
--- a/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
||||||
+++ b/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
+++ b/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
||||||
@@ -97,6 +97,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
@@ -97,6 +97,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
||||||
@ -104,15 +104,15 @@ index 149def3da0b92f64e4fc04630965dce44884f938..c9d753f37bd65e35f8a4e2eb5c6fe8f7
|
|||||||
byte[] bs = element.getAsByteArray();
|
byte[] bs = element.getAsByteArray();
|
||||||
+ if (bs.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors
|
+ if (bs.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors
|
||||||
|
|
||||||
for(int i = 0; i < bs.length; ++i) {
|
for (int i = 0; i < bs.length; i++) {
|
||||||
MutableComponent mutableComponent2 = Component.literal(String.valueOf((int)bs[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER);
|
MutableComponent mutableComponent2 = Component.literal(String.valueOf(bs[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER);
|
||||||
@@ -115,6 +116,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
@@ -115,6 +116,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
||||||
Component component = Component.literal("I").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
|
Component component = Component.literal("I").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
|
||||||
MutableComponent mutableComponent = Component.literal("[").append(component).append(";");
|
MutableComponent mutableComponent = Component.literal("[").append(component).append(";");
|
||||||
int[] is = element.getAsIntArray();
|
int[] is = element.getAsIntArray();
|
||||||
+ if (is.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors
|
+ if (is.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors
|
||||||
|
|
||||||
for(int i = 0; i < is.length; ++i) {
|
for (int i = 0; i < is.length; i++) {
|
||||||
mutableComponent.append(" ").append(Component.literal(String.valueOf(is[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER));
|
mutableComponent.append(" ").append(Component.literal(String.valueOf(is[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER));
|
||||||
@@ -132,6 +134,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
@@ -132,6 +134,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
||||||
Component component = Component.literal("L").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
|
Component component = Component.literal("L").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
|
||||||
@ -120,7 +120,7 @@ index 149def3da0b92f64e4fc04630965dce44884f938..c9d753f37bd65e35f8a4e2eb5c6fe8f7
|
|||||||
long[] ls = element.getAsLongArray();
|
long[] ls = element.getAsLongArray();
|
||||||
+ if (ls.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors
|
+ if (ls.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors
|
||||||
|
|
||||||
for(int i = 0; i < ls.length; ++i) {
|
for (int i = 0; i < ls.length; i++) {
|
||||||
Component component2 = Component.literal(String.valueOf(ls[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER);
|
Component component2 = Component.literal(String.valueOf(ls[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER);
|
||||||
@@ -147,7 +150,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
@@ -147,7 +150,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
||||||
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Fix negative death times
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index 23570a0b1227a840b9c1e6ae326827ea655bb5f7..b95ea8c0ef66b1f8fad0de0e005bf2cf95da5808 100644
|
index e9bb7feb591032904516d1b9374f486d8a7d066c..60961c54e870148b5c649045e7347ca1064b6bde 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
@@ -629,7 +629,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -629,7 +629,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Don't log invalid teams to console
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index b95ea8c0ef66b1f8fad0de0e005bf2cf95da5808..1e833374f4abd649074b2b42067317f42cf78df6 100644
|
index 60961c54e870148b5c649045e7347ca1064b6bde..0ce25857188029335d0afd0a9f0c22b79d4b0b69 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
@@ -869,7 +869,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -869,7 +869,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Fixes out of bounds HangingEntity crash exploit
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
index 2446d649225f96748e2fbb1a53a9e1902ac22aa1..76016cbbdff22592b76e827212b76021f3e39e13 100644
|
index eaad15a4d201356c34c1a09c7fbe5c35f76a2176..e166411e05287d97ea7c9d35b19d4ae3106401c3 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
@@ -280,6 +280,13 @@ public abstract class HangingEntity extends Entity {
|
@@ -280,6 +280,13 @@ public abstract class HangingEntity extends Entity {
|
@ -40,7 +40,7 @@ index 7ef14e4441a329c680a5dfe4bfb5033ffcb8f9d5..eff5bdf00b0aa7a9925ff59a62ead725
|
|||||||
executor.performCommand(world);
|
executor.performCommand(world);
|
||||||
} else {
|
} else {
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||||
index e2e31d6383c7de4f2eede46987d51978a5692639..9e5bb41c20e92cc39c99bfb3c801e9e432ba23cd 100644
|
index 447b0359922011fe12b1bb9628d23a47c9d7dc89..0d6be671e1512074ae1265fe93a5d5437f3929dd 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||||
@@ -2,6 +2,8 @@ package net.minecraft.world.level.block.entity;
|
@@ -2,6 +2,8 @@ package net.minecraft.world.level.block.entity;
|
||||||
@ -60,7 +60,7 @@ index e2e31d6383c7de4f2eede46987d51978a5692639..9e5bb41c20e92cc39c99bfb3c801e9e4
|
|||||||
|
|
||||||
public class JigsawBlockEntity extends BlockEntity {
|
public class JigsawBlockEntity extends BlockEntity {
|
||||||
public static final String TARGET = "target";
|
public static final String TARGET = "target";
|
||||||
@@ -131,6 +134,16 @@ public class JigsawBlockEntity extends BlockEntity {
|
@@ -134,6 +137,16 @@ public class JigsawBlockEntity extends BlockEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) {
|
public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) {
|
||||||
@ -78,7 +78,7 @@ index e2e31d6383c7de4f2eede46987d51978a5692639..9e5bb41c20e92cc39c99bfb3c801e9e4
|
|||||||
Registry<StructureTemplatePool> registry = world.registryAccess().registryOrThrow(Registries.TEMPLATE_POOL);
|
Registry<StructureTemplatePool> registry = world.registryAccess().registryOrThrow(Registries.TEMPLATE_POOL);
|
||||||
// Paper start - Replace getHolderOrThrow with a null check
|
// Paper start - Replace getHolderOrThrow with a null check
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
index 60c941bd67dc899ea923f8ee49412de01ce199db..9bcd07f8b5d266c39034e5c021da9ffb7262b474 100644
|
index 29c59e4a1283ac211b18b953ed6c03834a2587bd..fb385cd66226200ed0b8439cb6659dbac6c2b229 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
@@ -5,6 +5,8 @@ import java.util.Objects;
|
@@ -5,6 +5,8 @@ import java.util.Objects;
|
||||||
@ -98,7 +98,7 @@ index 60c941bd67dc899ea923f8ee49412de01ce199db..9bcd07f8b5d266c39034e5c021da9ffb
|
|||||||
|
|
||||||
public class StructureBlockEntity extends BlockEntity {
|
public class StructureBlockEntity extends BlockEntity {
|
||||||
private static final int SCAN_CORNER_BLOCKS_RANGE = 5;
|
private static final int SCAN_CORNER_BLOCKS_RANGE = 5;
|
||||||
@@ -261,7 +264,7 @@ public class StructureBlockEntity extends BlockEntity {
|
@@ -259,7 +262,7 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
BlockPos blockPos = this.getBlockPos();
|
BlockPos blockPos = this.getBlockPos();
|
||||||
@ -107,7 +107,7 @@ index 60c941bd67dc899ea923f8ee49412de01ce199db..9bcd07f8b5d266c39034e5c021da9ffb
|
|||||||
BlockPos blockPos2 = new BlockPos(blockPos.getX() - 80, this.level.getMinBuildHeight(), blockPos.getZ() - 80);
|
BlockPos blockPos2 = new BlockPos(blockPos.getX() - 80, this.level.getMinBuildHeight(), blockPos.getZ() - 80);
|
||||||
BlockPos blockPos3 = new BlockPos(blockPos.getX() + 80, this.level.getMaxBuildHeight() - 1, blockPos.getZ() + 80);
|
BlockPos blockPos3 = new BlockPos(blockPos.getX() + 80, this.level.getMaxBuildHeight() - 1, blockPos.getZ() + 80);
|
||||||
Stream<BlockPos> stream = this.getRelatedCorners(blockPos2, blockPos3);
|
Stream<BlockPos> stream = this.getRelatedCorners(blockPos2, blockPos3);
|
||||||
@@ -320,6 +323,16 @@ public class StructureBlockEntity extends BlockEntity {
|
@@ -316,6 +319,16 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
if (this.structureName == null) {
|
if (this.structureName == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -124,7 +124,7 @@ index 60c941bd67dc899ea923f8ee49412de01ce199db..9bcd07f8b5d266c39034e5c021da9ffb
|
|||||||
BlockPos blockPos = this.getBlockPos().offset(this.structurePos);
|
BlockPos blockPos = this.getBlockPos().offset(this.structurePos);
|
||||||
ServerLevel serverLevel = (ServerLevel)this.level;
|
ServerLevel serverLevel = (ServerLevel)this.level;
|
||||||
StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager();
|
StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager();
|
||||||
@@ -371,6 +384,16 @@ public class StructureBlockEntity extends BlockEntity {
|
@@ -367,6 +380,16 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
if (structureTemplate == null) {
|
if (structureTemplate == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
@ -1,313 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Allink <arclicious@vivaldi.net>
|
|
||||||
Date: Mon, 18 Apr 2022 03:56:09 +0100
|
|
||||||
Subject: [PATCH] Reset large tags
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/ContainerHelper.java b/src/main/java/net/minecraft/world/ContainerHelper.java
|
|
||||||
index 4092c7a8c2b0d9d26e6f4d97386735236300d132..04c47cf1a920ae6c356449df801227ee14f6dfb7 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/ContainerHelper.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/ContainerHelper.java
|
|
||||||
@@ -2,6 +2,7 @@ package net.minecraft.world;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.Predicate;
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
|
||||||
import net.minecraft.core.NonNullList;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.nbt.ListTag;
|
|
||||||
@@ -22,10 +23,12 @@ public class ContainerHelper {
|
|
||||||
|
|
||||||
public static CompoundTag saveAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks, boolean setIfEmpty) {
|
|
||||||
ListTag listTag = new ListTag();
|
|
||||||
+ long total = 0; // Scissors
|
|
||||||
|
|
||||||
for(int i = 0; i < stacks.size(); ++i) {
|
|
||||||
ItemStack itemStack = stacks.get(i);
|
|
||||||
if (!itemStack.isEmpty()) {
|
|
||||||
+ total += NbtUtility.getTagSize(itemStack.getTag()); // Scissors
|
|
||||||
CompoundTag compoundTag = new CompoundTag();
|
|
||||||
compoundTag.putByte("Slot", (byte)i);
|
|
||||||
itemStack.save(compoundTag);
|
|
||||||
@@ -33,7 +36,7 @@ public class ContainerHelper {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (!listTag.isEmpty() || setIfEmpty) {
|
|
||||||
+ if ((!listTag.isEmpty() || setIfEmpty) && !(total > NbtUtility.MAXIMUM_SIZE)) { // Scissors
|
|
||||||
nbt.put("Items", listTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -42,11 +45,19 @@ public class ContainerHelper {
|
|
||||||
|
|
||||||
public static void loadAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks) {
|
|
||||||
ListTag listTag = nbt.getList("Items", 10);
|
|
||||||
+ long total = 0; // Scissors - Account for items inside containers
|
|
||||||
|
|
||||||
for(int i = 0; i < listTag.size(); ++i) {
|
|
||||||
CompoundTag compoundTag = listTag.getCompound(i);
|
|
||||||
int j = compoundTag.getByte("Slot") & 255;
|
|
||||||
if (j >= 0 && j < stacks.size()) {
|
|
||||||
+ // Scissors start
|
|
||||||
+ total += NbtUtility.getTagSize(compoundTag);
|
|
||||||
+ if (total >= NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ stacks.clear();
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
stacks.set(j, ItemStack.of(compoundTag));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
||||||
index 1ad126d992d95062a3db08374db7a927f23a0cac..345fb9722f1dc8293809256d3bb87b8964b54164 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
||||||
@@ -23,6 +23,7 @@ import java.util.function.Predicate;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
|
||||||
import net.minecraft.ChatFormatting;
|
|
||||||
import net.minecraft.Util;
|
|
||||||
import net.minecraft.advancements.CriteriaTriggers;
|
|
||||||
@@ -278,6 +279,12 @@ public final class ItemStack {
|
|
||||||
|
|
||||||
// CraftBukkit - break into own method
|
|
||||||
private void load(CompoundTag nbttagcompound) {
|
|
||||||
+ // Scissors start - Reset large tags
|
|
||||||
+ if (NbtUtility.isTooLarge(nbttagcompound)) {
|
|
||||||
+ // Reset tag without destroying item
|
|
||||||
+ nbttagcompound = NbtUtility.Item.removeItemData(nbttagcompound);
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
this.item = (Item) BuiltInRegistries.ITEM.get(new ResourceLocation(nbttagcompound.getString("id")));
|
|
||||||
this.count = nbttagcompound.getByte("Count");
|
|
||||||
if (nbttagcompound.contains("tag", 10)) {
|
|
||||||
@@ -585,7 +592,11 @@ public final class ItemStack {
|
|
||||||
nbt.putString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString());
|
|
||||||
nbt.putByte("Count", (byte) this.count);
|
|
||||||
if (this.tag != null) {
|
|
||||||
- nbt.put("tag", this.tag.copy());
|
|
||||||
+ // Scissors start - Don't save large tags
|
|
||||||
+ if (!NbtUtility.isTooLarge(this.tag)) {
|
|
||||||
+ nbt.put("tag", this.tag.copy());
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
|
|
||||||
return nbt;
|
|
||||||
@@ -919,6 +930,7 @@ public final class ItemStack {
|
|
||||||
// Paper end
|
|
||||||
|
|
||||||
public void setTag(@Nullable CompoundTag nbt) {
|
|
||||||
+ if (NbtUtility.isTooLarge(nbt)) return; // Scissors - Ignore large tags
|
|
||||||
this.tag = nbt;
|
|
||||||
this.processEnchantOrder(this.tag); // Paper
|
|
||||||
if (this.getItem().canBeDepleted()) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
||||||
index 89d06253b00604114e543ebbe12a9993ae95dc41..2f17fa399dfff7e260fe552147fe88699ebff73e 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
||||||
@@ -9,6 +9,7 @@ import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
|
||||||
import net.minecraft.SharedConstants;
|
|
||||||
import net.minecraft.Util;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
@@ -213,6 +214,17 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
|
||||||
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
|
||||||
+ // Scissors start - Account for items inside containers
|
|
||||||
+ long total = 0;
|
|
||||||
+
|
|
||||||
+ for (ItemStack item : this.items) {
|
|
||||||
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ this.items.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
|
||||||
index 416aa989ebb18a8741cc9d605a1180ab830f6643..a9a8c9e68e5b767dec2c26495685da88e0caa627 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
package net.minecraft.world.level.block.entity;
|
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.Direction;
|
|
||||||
import net.minecraft.core.NonNullList;
|
|
||||||
@@ -34,6 +35,17 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ItemStack> getContents() {
|
|
||||||
+ // Scissors start - Account for items inside containers
|
|
||||||
+ long total = 0;
|
|
||||||
+
|
|
||||||
+ for (ItemStack item : this.items) {
|
|
||||||
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ this.items.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
|
||||||
index 9bb542ce3a8c52e1688bb1f66fc916dd23a5fd10..bdbe623ec5d3a5471e909c9933cf556a796354b6 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
|
||||||
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block.entity;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.Direction;
|
|
||||||
import net.minecraft.core.NonNullList;
|
|
||||||
@@ -73,6 +74,17 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
|
||||||
+ // Scissors start - Account for items inside containers
|
|
||||||
+ long total = 0;
|
|
||||||
+
|
|
||||||
+ for (ItemStack item : this.items) {
|
|
||||||
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ this.items.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
|
||||||
index 9b1243d96e0694c62fc9e82e9be540bce0d2b3ad..0f734147d0cb86ff6c8a4c28733cf4cb9b7856d4 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
package net.minecraft.world.level.block.entity;
|
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.Direction;
|
|
||||||
import net.minecraft.core.NonNullList;
|
|
||||||
@@ -40,6 +41,17 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
|
||||||
private int maxStack = MAX_STACK;
|
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
|
||||||
+ // Scissors start - Account for items inside containers
|
|
||||||
+ long total = 0;
|
|
||||||
+
|
|
||||||
+ for (ItemStack item : this.items) {
|
|
||||||
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ this.items.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
|
||||||
index 881379681c39230a00b3a1f11cd87498984396c7..d0513b72cdaec3b67b9341d251367b193bafa40c 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
package net.minecraft.world.level.block.entity;
|
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.NonNullList;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
@@ -28,6 +29,17 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
|
|
||||||
private int maxStack = MAX_STACK;
|
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
|
||||||
+ // Scissors start - Account for items inside containers
|
|
||||||
+ long total = 0;
|
|
||||||
+
|
|
||||||
+ for (ItemStack item : this.items) {
|
|
||||||
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ this.items.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
||||||
index 757edf74751dc7183454656fda9cecc4eb601e4c..005de26f9a8a67f29a474823515ee66730690b52 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
||||||
@@ -6,6 +6,7 @@ import java.util.function.BooleanSupplier;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.Direction;
|
|
||||||
import net.minecraft.core.NonNullList;
|
|
||||||
@@ -57,6 +58,17 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
||||||
private int maxStack = MAX_STACK;
|
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
|
||||||
+ // Scissors start - Account for items inside containers
|
|
||||||
+ long total = 0;
|
|
||||||
+
|
|
||||||
+ for (ItemStack item : this.items) {
|
|
||||||
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ this.items.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
|
||||||
index 1fa22445a4ecc8c08dbcf0cc6bd39dc5003604c4..9f12fbcd8d0c75de1d8c06bed2c64a0acdc877c9 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
|
||||||
@@ -4,6 +4,7 @@ import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.Direction;
|
|
||||||
import net.minecraft.core.NonNullList;
|
|
||||||
@@ -61,6 +62,17 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
|
||||||
public boolean opened;
|
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
|
||||||
+ // Scissors start - Account for items inside containers
|
|
||||||
+ long total = 0;
|
|
||||||
+
|
|
||||||
+ for (ItemStack item : this.itemStacks) {
|
|
||||||
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ this.itemStacks.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return this.itemStacks;
|
|
||||||
}
|
|
||||||
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add spectator teleport event
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index ab5b259d8f72022c875cae73be25fe2da346c6b3..1c2b3042b0d7b012876e3d4aab4521915d2cda18 100644
|
index 860d33ac56680babd87358b1d7d2216dac3f7865..a60f594b3d7c8c30344f5e888e4309b8f75fdeaf 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -1,5 +1,6 @@
|
@@ -1,5 +1,6 @@
|
@ -5,7 +5,7 @@ Subject: [PATCH] Prevent invalid container events
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index d0a7490c153e7968c657a525908de58f60f26c20..807117124668040121c5252a10c33ad100c0b0da 100644
|
index a60f594b3d7c8c30344f5e888e4309b8f75fdeaf..cfe4f98458c1b1fd311535552b99937d1f319c0e 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -29,6 +29,7 @@ import java.util.function.UnaryOperator;
|
@@ -29,6 +29,7 @@ import java.util.function.UnaryOperator;
|
@ -5,7 +5,7 @@ Subject: [PATCH] Disable running commands in books by default
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||||
index 258a636a59203c4e5415a89002c6a607338f9514..dbc2993a105214d945a49e1eb5b910d28c09ae41 100644
|
index 793ab8acd7445984cff2628e3f001661dc20c8e5..0e6e0d6a9c645db0121637262a6cf90172d3c385 100644
|
||||||
--- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
--- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||||
+++ b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
+++ b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||||
@@ -2,6 +2,7 @@ package net.minecraft.world.item;
|
@@ -2,6 +2,7 @@ package net.minecraft.world.item;
|
||||||
@ -26,7 +26,7 @@ index 258a636a59203c4e5415a89002c6a607338f9514..dbc2993a105214d945a49e1eb5b910d2
|
|||||||
import net.minecraft.stats.Stats;
|
import net.minecraft.stats.Stats;
|
||||||
import net.minecraft.util.StringUtil;
|
import net.minecraft.util.StringUtil;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
@@ -161,9 +161,43 @@ public class WrittenBookItem extends Item {
|
@@ -162,9 +162,43 @@ public class WrittenBookItem extends Item {
|
||||||
component2 = Component.literal(text);
|
component2 = Component.literal(text);
|
||||||
}
|
}
|
||||||
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Validate block entity/entity tag query positions
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index a66ec293947fc852104dce93a418771b2f44106d..b324e9ac6bbbe691c0b3c2994f326c0aa06d7dd7 100644
|
index cfe4f98458c1b1fd311535552b99937d1f319c0e..adbb1036913ba6299f2093c84480e4147a36b344 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -1278,7 +1278,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -1278,7 +1278,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@ -5,12 +5,12 @@ Subject: [PATCH] Patch large selector distance crash
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
diff --git a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
||||||
index d87ffb5ed4550757016c2fabaa2845a6aaac74d7..7e8cf65ac53f595292d161da0735bf97081e832a 100644
|
index f62640152027b874d4266d868574af062bd684d7..f94385837d5ed1ef52458b73410df5fd186d66e2 100644
|
||||||
--- a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
--- a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
||||||
+++ b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
+++ b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
||||||
@@ -123,11 +123,11 @@ public interface MinMaxBounds<T extends Number> {
|
@@ -123,11 +123,11 @@ public interface MinMaxBounds<T extends Number> {
|
||||||
|
public static record Doubles(@Override Optional<Double> min, @Override Optional<Double> max, Optional<Double> minSq, Optional<Double> maxSq)
|
||||||
public static record Doubles(Optional<Double> min, Optional<Double> max, Optional<Double> minSq, Optional<Double> maxSq) implements MinMaxBounds<Double> {
|
implements MinMaxBounds<Double> {
|
||||||
public static final MinMaxBounds.Doubles ANY = new MinMaxBounds.Doubles(Optional.empty(), Optional.empty());
|
public static final MinMaxBounds.Doubles ANY = new MinMaxBounds.Doubles(Optional.empty(), Optional.empty());
|
||||||
- public static final Codec<MinMaxBounds.Doubles> CODEC = MinMaxBounds.createCodec(Codec.DOUBLE, MinMaxBounds.Doubles::new);
|
- public static final Codec<MinMaxBounds.Doubles> CODEC = MinMaxBounds.createCodec(Codec.DOUBLE, MinMaxBounds.Doubles::new);
|
||||||
+ public static final Codec<MinMaxBounds.Doubles> CODEC = MinMaxBounds.<Double, MinMaxBounds.Doubles>createCodec(Codec.DOUBLE, MinMaxBounds.Doubles::new); // Scissors - compile fixes
|
+ public static final Codec<MinMaxBounds.Doubles> CODEC = MinMaxBounds.<Double, MinMaxBounds.Doubles>createCodec(Codec.DOUBLE, MinMaxBounds.Doubles::new); // Scissors - compile fixes
|
||||||
@ -23,15 +23,15 @@ index d87ffb5ed4550757016c2fabaa2845a6aaac74d7..7e8cf65ac53f595292d161da0735bf97
|
|||||||
|
|
||||||
private static MinMaxBounds.Doubles create(StringReader reader, Optional<Double> min, Optional<Double> max) throws CommandSyntaxException {
|
private static MinMaxBounds.Doubles create(StringReader reader, Optional<Double> min, Optional<Double> max) throws CommandSyntaxException {
|
||||||
if (min.isPresent() && max.isPresent() && min.get() > max.get()) {
|
if (min.isPresent() && max.isPresent() && min.get() > max.get()) {
|
||||||
@@ -188,7 +188,7 @@ public interface MinMaxBounds<T extends Number> {
|
@@ -179,7 +179,7 @@ public interface MinMaxBounds<T extends Number> {
|
||||||
|
public static record Ints(@Override Optional<Integer> min, @Override Optional<Integer> max, Optional<Long> minSq, Optional<Long> maxSq)
|
||||||
public static record Ints(Optional<Integer> min, Optional<Integer> max, Optional<Long> minSq, Optional<Long> maxSq) implements MinMaxBounds<Integer> {
|
implements MinMaxBounds<Integer> {
|
||||||
public static final MinMaxBounds.Ints ANY = new MinMaxBounds.Ints(Optional.empty(), Optional.empty());
|
public static final MinMaxBounds.Ints ANY = new MinMaxBounds.Ints(Optional.empty(), Optional.empty());
|
||||||
- public static final Codec<MinMaxBounds.Ints> CODEC = MinMaxBounds.createCodec(Codec.INT, MinMaxBounds.Ints::new);
|
- public static final Codec<MinMaxBounds.Ints> CODEC = MinMaxBounds.createCodec(Codec.INT, MinMaxBounds.Ints::new);
|
||||||
+ public static final Codec<MinMaxBounds.Ints> CODEC = MinMaxBounds.<Integer, MinMaxBounds.Ints>createCodec(Codec.INT, MinMaxBounds.Ints::new); // Scissors - compile fixes
|
+ public static final Codec<MinMaxBounds.Ints> CODEC = MinMaxBounds.<Integer, MinMaxBounds.Ints>createCodec(Codec.INT, MinMaxBounds.Ints::new); // Scissors - compile fixes
|
||||||
|
|
||||||
private Ints(Optional<Integer> min, Optional<Integer> max) {
|
private Ints(Optional<Integer> min, Optional<Integer> max) {
|
||||||
this(min, max, min.map((i) -> {
|
this(min, max, min.map(i -> i.longValue() * i.longValue()), squareOpt(max));
|
||||||
diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
|
diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||||
index 676a1499747b071515479130875157263d3a8352..6a65850101b8ea348a4bfeaeca805a39987b06fc 100644
|
index 676a1499747b071515479130875157263d3a8352..6a65850101b8ea348a4bfeaeca805a39987b06fc 100644
|
||||||
--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
|
--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
|
@ -5,10 +5,10 @@ Subject: [PATCH] Patch invalid entity rotation log spam
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index 79ef94350828bcf780ee65d9de7006730214a2c8..ed116878cf8525f4ab5b6656d6e40e8504a4f42b 100644
|
index 637478fd8a284e6833cf8f5fa17ccf9d73d1dd3f..aec4991e8bd75c0020029008951e4cc2a83ed2b2 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -4751,7 +4751,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -4755,7 +4755,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||||
|
|
||||||
public void setXRot(float pitch) {
|
public void setXRot(float pitch) {
|
||||||
if (!Float.isFinite(pitch)) {
|
if (!Float.isFinite(pitch)) {
|
@ -1,107 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Allink <arclicious@vivaldi.net>
|
|
||||||
Date: Sun, 10 Dec 2023 18:48:55 -0600
|
|
||||||
Subject: [PATCH] Add configuration option to disable chat signatures
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
|
||||||
index 74cf1c043beef03cfd5adf481414a5ee78bef2a6..939f4a0639c847b94cfc9acf1409a7a3fc5ae58f 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
package net.minecraft.network.chat;
|
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig;
|
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
|
|
||||||
public interface OutgoingChatMessage {
|
|
||||||
@@ -44,10 +45,22 @@ public interface OutgoingChatMessage {
|
|
||||||
// Paper end
|
|
||||||
PlayerChatMessage playerChatMessage = this.message.filter(filterMaskEnabled);
|
|
||||||
playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper
|
|
||||||
- if (!playerChatMessage.isFullyFiltered()) {
|
|
||||||
+ // Sccissors start
|
|
||||||
+ if (!playerChatMessage.isFullyFiltered() && ScissorsConfig.chatSignaturesEnabled) {
|
|
||||||
sender.connection.sendPlayerChatMessage(playerChatMessage, params);
|
|
||||||
+ return;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ sender.connection.sendPlayerChatMessage(new PlayerChatMessage(
|
|
||||||
+ SignedMessageLink.unsigned(playerChatMessage.sender()),
|
|
||||||
+ null,
|
|
||||||
+ SignedMessageBody.unsigned(playerChatMessage.signedContent()),
|
|
||||||
+ unsigned,
|
|
||||||
+ playerChatMessage.filterMask(),
|
|
||||||
+ playerChatMessage.result()
|
|
||||||
+ ), params);
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
|
||||||
index ba12919c3f9aec34a9e64993b143ae92be5eb172..bdfa4a7f5b50e80195e79a6dd1204cb73bebd79e 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
|
||||||
@@ -5,6 +5,8 @@ import java.time.Instant;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.function.BooleanSupplier;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+
|
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig;
|
|
||||||
import net.minecraft.util.SignatureUpdater;
|
|
||||||
import net.minecraft.util.SignatureValidator;
|
|
||||||
import net.minecraft.util.Signer;
|
|
||||||
@@ -46,7 +48,7 @@ public class SignedMessageChain {
|
|
||||||
if (!playerChatMessage.verify(signatureValidator)) {
|
|
||||||
throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.UNSIGNED_CHAT); // Paper - kick event causes
|
|
||||||
} else {
|
|
||||||
- if (playerChatMessage.hasExpiredServer(Instant.now())) {
|
|
||||||
+ if (playerChatMessage.hasExpiredServer(Instant.now()) && ScissorsConfig.chatSignaturesEnabled) { // Scissors
|
|
||||||
LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", (Object)body.content());
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
index 23f4fc3cc157830da18bf5905eb51f2ae2b452bd..29d230487b42150b8790685653e1ed24d435b417 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
package net.minecraft.server.network;
|
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig;
|
|
||||||
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.primitives.Floats;
|
|
||||||
@@ -2243,7 +2244,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
|
|
||||||
private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) {
|
|
||||||
ServerGamePacketListenerImpl.LOGGER.warn("Failed to update secure chat state for {}: '{}'", this.player.getGameProfile().getName(), exception.getComponent().getString());
|
|
||||||
- if (exception.shouldDisconnect()) {
|
|
||||||
+ if (exception.shouldDisconnect() && ScissorsConfig.chatSignaturesEnabled) { // Scissors - Do not kick when chat signatures are disabled
|
|
||||||
this.disconnect(exception.getComponent(), exception.kickCause); // Paper - kick event causes
|
|
||||||
} else {
|
|
||||||
this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED));
|
|
||||||
@@ -2291,6 +2292,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
Optional<LastSeenMessages> optional = this.lastSeenMessages.applyUpdate(acknowledgment);
|
|
||||||
|
|
||||||
if (optional.isEmpty()) {
|
|
||||||
+ if (!ScissorsConfig.chatSignaturesEnabled) return optional; // Scissors
|
|
||||||
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
|
|
||||||
this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes
|
|
||||||
}
|
|
||||||
@@ -2489,6 +2491,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
|
|
||||||
synchronized (this.lastSeenMessages) {
|
|
||||||
if (!this.lastSeenMessages.applyOffset(packet.offset())) {
|
|
||||||
+ if (!ScissorsConfig.chatSignaturesEnabled) return; // Scissors
|
|
||||||
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
|
|
||||||
this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes
|
|
||||||
}
|
|
||||||
@@ -3460,6 +3463,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
@Override
|
|
||||||
public void handleChatSessionUpdate(ServerboundChatSessionUpdatePacket packet) {
|
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
|
||||||
+ if (!ScissorsConfig.chatSignaturesEnabled) return; // Scissors
|
|
||||||
RemoteChatSession.Data remotechatsession_a = packet.chatSession();
|
|
||||||
ProfilePublicKey.Data profilepublickey_a = this.chatSession != null ? this.chatSession.profilePublicKey().data() : null;
|
|
||||||
ProfilePublicKey.Data profilepublickey_a1 = remotechatsession_a.profilePublicKey();
|
|
@ -5,19 +5,19 @@ 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
|
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 17343d515044f3678b4edf070ee7ca244adc4228..8ade519114bec879bed8e8e23707a85327da131b 100644
|
index 02e3d1c9c18952ba53507f7b6887fd3c81af33a9..61573844b236838fd219526ea35df8c7b0c94026 100644
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
|
||||||
@@ -65,7 +65,8 @@ public class ClientboundMapItemDataPacket implements Packet<ClientGamePacketList
|
@@ -63,7 +63,8 @@ public class ClientboundMapItemDataPacket implements Packet<ClientGamePacketList
|
||||||
b.writeByte(icon.x());
|
b.writeByte(icon.x());
|
||||||
b.writeByte(icon.y());
|
b.writeByte(icon.y());
|
||||||
b.writeByte(icon.rot() & 15);
|
b.writeByte(icon.rot() & 15);
|
||||||
- b.writeNullable(icon.name(), FriendlyByteBuf::writeComponent);
|
- b.writeNullable(icon.name(), FriendlyByteBuf::writeComponent);
|
||||||
+ final boolean passedNameCap = icon.name() == null || icon.name().getString().length() <= 32; // Scissors
|
+ final boolean passedNameCap = icon.name() == null || icon.name().getString().length() <= 32; // Scissors
|
||||||
+ b.writeNullable(passedNameCap ? icon.name() : null, FriendlyByteBuf::writeComponent); // Scissors
|
+ b.writeNullable(passedNameCap ? icon.name() : null, FriendlyByteBuf::writeComponent); // Scissors
|
||||||
});
|
}));
|
||||||
});
|
|
||||||
if (this.colorPatch != null) {
|
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
|
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
|
index 45269115e63cfc3bd7dc740a5694e2cc7c35bcb1..85ea95f55fd6177748edf921e2380142d93b8b06 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
@ -5,7 +5,7 @@ Subject: [PATCH] Prevent player banning using duplicate UUIDs
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 6907d1be36fbdf0856c0e11983218d2fd1f9cb46..298c8a9cd08425e9aa4f222b98d95d92b80951e6 100644
|
index 502bdc726b7890b00ee36871d905dea44e8719e3..1fbc8b372271bb4cd4375ca6b6b1d7e7961094fb 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -1667,7 +1667,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -1667,7 +1667,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Don't log on too many chained updates
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||||
index 87db9febbbf53702be0e1e89a95db99e823713e5..02160e69f4b6bee344943307ec7ddcb7c1489162 100644
|
index 106af2b2c7ff72c7549975aef75cdcff8d9a7d97..ecdcf4cf8650270ce7595905ce9d498eee520dcd 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||||
@@ -56,7 +56,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
|
@@ -58,7 +58,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
|
||||||
this.stack.push(entry);
|
this.stack.push(entry);
|
||||||
}
|
}
|
||||||
} else if (this.count - 1 == this.maxChainedNeighborUpdates) {
|
} else if (this.count - 1 == this.maxChainedNeighborUpdates) {
|
@ -5,10 +5,10 @@ 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
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index b69f7c74fe4e2ec6280ebee27f8b8fd0ec8ac361..1350b224b7321fe1aac3d3cf5ff1f7a089da53cc 100644
|
index adbb1036913ba6299f2093c84480e4147a36b344..b2971440e73dcce2beee936313568cbb06d32312 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -870,7 +870,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -864,7 +864,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
|
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
|
||||||
} else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission
|
} else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission
|
||||||
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
|
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
|
||||||
@ -17,7 +17,7 @@ index b69f7c74fe4e2ec6280ebee27f8b8fd0ec8ac361..1350b224b7321fe1aac3d3cf5ff1f7a0
|
|||||||
BaseCommandBlock commandblocklistenerabstract = null;
|
BaseCommandBlock commandblocklistenerabstract = null;
|
||||||
CommandBlockEntity tileentitycommand = null;
|
CommandBlockEntity tileentitycommand = null;
|
||||||
BlockPos blockposition = packet.getPos();
|
BlockPos blockposition = packet.getPos();
|
||||||
@@ -1039,7 +1039,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -1012,7 +1012,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
@Override
|
@Override
|
||||||
public void handleSetStructureBlock(ServerboundSetStructureBlockPacket packet) {
|
public void handleSetStructureBlock(ServerboundSetStructureBlockPacket packet) {
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||||
@ -26,7 +26,7 @@ index b69f7c74fe4e2ec6280ebee27f8b8fd0ec8ac361..1350b224b7321fe1aac3d3cf5ff1f7a0
|
|||||||
BlockPos blockposition = packet.getPos();
|
BlockPos blockposition = packet.getPos();
|
||||||
BlockState iblockdata = this.player.level().getBlockState(blockposition);
|
BlockState iblockdata = this.player.level().getBlockState(blockposition);
|
||||||
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
|
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
|
||||||
@@ -1097,7 +1097,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -1070,7 +1070,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
@Override
|
@Override
|
||||||
public void handleSetJigsawBlock(ServerboundSetJigsawBlockPacket packet) {
|
public void handleSetJigsawBlock(ServerboundSetJigsawBlockPacket packet) {
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||||
@ -35,7 +35,7 @@ index b69f7c74fe4e2ec6280ebee27f8b8fd0ec8ac361..1350b224b7321fe1aac3d3cf5ff1f7a0
|
|||||||
BlockPos blockposition = packet.getPos();
|
BlockPos blockposition = packet.getPos();
|
||||||
BlockState iblockdata = this.player.level().getBlockState(blockposition);
|
BlockState iblockdata = this.player.level().getBlockState(blockposition);
|
||||||
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
|
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
|
||||||
@@ -1122,7 +1122,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -1095,7 +1095,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
@Override
|
@Override
|
||||||
public void handleJigsawGenerate(ServerboundJigsawGeneratePacket packet) {
|
public void handleJigsawGenerate(ServerboundJigsawGeneratePacket packet) {
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
@ -1,86 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Allink <arclicious@vivaldi.net>
|
|
||||||
Date: Mon, 11 Dec 2023 12:27:44 -0600
|
|
||||||
Subject: [PATCH] Implement command block events
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java
|
|
||||||
index c99fc118013cb3d4043638e2001a8297e79ddf9c..cdaa81e1f2167b29ec01cc25e51a8400deb533d2 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java
|
|
||||||
@@ -9,7 +9,7 @@ import net.minecraft.world.level.BaseCommandBlock;
|
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
|
|
||||||
public class ServerboundSetCommandMinecartPacket implements Packet<ServerGamePacketListener> {
|
|
||||||
- private final int entity;
|
|
||||||
+ public final int entity; // Scissors - private -> public
|
|
||||||
private final String command;
|
|
||||||
private final boolean trackOutput;
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
index f2c3b81779bbd2c52068750e65e66e1ca6c4d492..b69f7c74fe4e2ec6280ebee27f8b8fd0ec8ac361 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
@@ -1,6 +1,8 @@
|
|
||||||
package net.minecraft.server.network;
|
|
||||||
|
|
||||||
import me.totalfreedom.scissors.ScissorsConfig;
|
|
||||||
+import me.totalfreedom.scissors.event.block.CommandBlockPlayerEditEvent;
|
|
||||||
+import me.totalfreedom.scissors.event.block.CommandMinecartPlayerEditEvent;
|
|
||||||
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.primitives.Floats;
|
|
||||||
@@ -155,6 +157,7 @@ import net.minecraft.world.entity.player.Inventory;
|
|
||||||
import net.minecraft.world.entity.player.ProfilePublicKey;
|
|
||||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
|
||||||
import net.minecraft.world.entity.vehicle.Boat;
|
|
||||||
+import net.minecraft.world.entity.vehicle.MinecartCommandBlock;
|
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
|
||||||
import net.minecraft.world.inventory.AnvilMenu;
|
|
||||||
import net.minecraft.world.inventory.BeaconMenu;
|
|
||||||
@@ -189,6 +192,8 @@ import net.minecraft.world.phys.Vec3;
|
|
||||||
import net.minecraft.world.phys.shapes.BooleanOp;
|
|
||||||
import net.minecraft.world.phys.shapes.Shapes;
|
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
|
||||||
+import org.bukkit.craftbukkit.block.CraftCommandBlock;
|
|
||||||
+import org.bukkit.craftbukkit.entity.CraftMinecartCommand;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
|
|
||||||
// CraftBukkit start
|
|
||||||
@@ -905,6 +910,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
this.player.level().getChunkAt(blockposition).setBlockEntity(tileentity);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ CommandBlockPlayerEditEvent event = new CommandBlockPlayerEditEvent(this.getCraftPlayer(), commandblocklistenerabstract.getCommand(), s, new CraftCommandBlock(this.player.level().getWorld(), tileentitycommand));
|
|
||||||
+
|
|
||||||
+ if (!event.callEvent()) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ s = event.getNewCommand();
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
commandblocklistenerabstract.setCommand(s);
|
|
||||||
commandblocklistenerabstract.setTrackOutput(flag);
|
|
||||||
if (!flag) {
|
|
||||||
@@ -936,7 +951,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level());
|
|
||||||
|
|
||||||
if (commandblocklistenerabstract != null) {
|
|
||||||
- commandblocklistenerabstract.setCommand(packet.getCommand());
|
|
||||||
+ // Scissors start - Implement command block events
|
|
||||||
+ String command = packet.getCommand();
|
|
||||||
+ CommandMinecartPlayerEditEvent event = new CommandMinecartPlayerEditEvent(this.getCraftPlayer(), commandblocklistenerabstract.getCommand(), command, new CraftMinecartCommand(this.cserver, (MinecartCommandBlock) this.player.level().getEntity(packet.entity)));
|
|
||||||
+
|
|
||||||
+ if (!event.callEvent()) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ command = event.getNewCommand();
|
|
||||||
+ commandblocklistenerabstract.setCommand(command);
|
|
||||||
+
|
|
||||||
+ // Scissors end
|
|
||||||
commandblocklistenerabstract.setTrackOutput(packet.isTrackOutput());
|
|
||||||
if (!packet.isTrackOutput()) {
|
|
||||||
commandblocklistenerabstract.setLastOutput((Component) null);
|
|
@ -1,110 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Allink <arclicious@vivaldi.net>
|
|
||||||
Date: Fri, 2 Jun 2023 22:13:54 +0100
|
|
||||||
Subject: [PATCH] Add depth limit to SNBT
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/TagParser.java b/src/main/java/net/minecraft/nbt/TagParser.java
|
|
||||||
index 94cb73e7f60171aa57bd1dbe7e91ef4db94e70b7..9ed1c477620b41317c4bf2b14ebc672c2fdd4656 100644
|
|
||||||
--- a/src/main/java/net/minecraft/nbt/TagParser.java
|
|
||||||
+++ b/src/main/java/net/minecraft/nbt/TagParser.java
|
|
||||||
@@ -182,9 +182,56 @@ public class TagParser {
|
|
||||||
|
|
||||||
this.expect('}');
|
|
||||||
this.depth--; // Paper
|
|
||||||
- return compoundTag;
|
|
||||||
+ return exceedsDepthLimit(compoundTag) ? new CompoundTag() : compoundTag; // Scissors - Add depth limit to SNBT
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Scissors start - Add depth limit to SNBT
|
|
||||||
+ private boolean exceedsDepthLimit(Tag tag) {
|
|
||||||
+ return this.exceedsDepthLimit(0, tag);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ private boolean exceedsDepthLimit(long depth, Tag tag)
|
|
||||||
+ {
|
|
||||||
+ if (depth > 256)
|
|
||||||
+ {
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (tag instanceof ListTag listTag)
|
|
||||||
+ {
|
|
||||||
+ for (Tag childTag : listTag)
|
|
||||||
+ {
|
|
||||||
+ boolean returnValue = this.exceedsDepthLimit(depth + 1, childTag);
|
|
||||||
+
|
|
||||||
+ if (returnValue)
|
|
||||||
+ {
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ } else if (tag instanceof CompoundTag compoundTag)
|
|
||||||
+ {
|
|
||||||
+ for (String key: compoundTag.getAllKeys())
|
|
||||||
+ {
|
|
||||||
+ Tag childTag = compoundTag.get(key);
|
|
||||||
+
|
|
||||||
+ if (childTag == null)
|
|
||||||
+ {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ boolean returnValue = this.exceedsDepthLimit(depth + 1, childTag);
|
|
||||||
+
|
|
||||||
+ if (returnValue)
|
|
||||||
+ {
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
private Tag readListTag() throws CommandSyntaxException {
|
|
||||||
this.expect('[');
|
|
||||||
this.reader.skipWhitespace();
|
|
||||||
@@ -218,7 +265,7 @@ public class TagParser {
|
|
||||||
|
|
||||||
this.expect(']');
|
|
||||||
this.depth--; // Paper
|
|
||||||
- return listTag;
|
|
||||||
+ return exceedsDepthLimit(listTag) ? new ListTag() : listTag; // Scissors - Add depth limit to SNBT
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -243,7 +290,7 @@ public class TagParser {
|
|
||||||
}
|
|
||||||
|
|
||||||
private <T extends Number> List<T> readArray(TagType<?> arrayTypeReader, TagType<?> typeReader) throws CommandSyntaxException {
|
|
||||||
- List<T> list = Lists.newArrayList();
|
|
||||||
+ List<Number> list = Lists.newArrayList(); // Scissors - List<T> -> List<Number>
|
|
||||||
|
|
||||||
while(true) {
|
|
||||||
if (this.reader.peek() != ']') {
|
|
||||||
@@ -256,11 +303,11 @@ public class TagParser {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeReader == ByteTag.TYPE) {
|
|
||||||
- list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix
|
|
||||||
+ list.add(((NumericTag)tag).getAsNumber()); // Scissors - Remove (T) cast
|
|
||||||
} else if (typeReader == LongTag.TYPE) {
|
|
||||||
- list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix
|
|
||||||
+ list.add(((NumericTag)tag).getAsNumber()); // Scissors - Remove (T) cast
|
|
||||||
} else {
|
|
||||||
- list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix
|
|
||||||
+ list.add(((NumericTag)tag).getAsNumber()); // Scissors - Remove (T) cast
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.hasElementSeparator()) {
|
|
||||||
@@ -272,7 +319,7 @@ public class TagParser {
|
|
||||||
}
|
|
||||||
|
|
||||||
this.expect(']');
|
|
||||||
- return list;
|
|
||||||
+ return (List<T>) list; // Scissors - Cast to List<T>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -5,28 +5,31 @@ Subject: [PATCH] Mute invalid attributes
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||||
index 897d7632ecfea40890433474870dd7a5e534d8ab..7c522cf74bd86a73a08ebd1b2de69b5b9da6559b 100644
|
index b99a080ab27e24d8131fda931ca70d6d271bb01c..f88b31d9bfc8b332230fa318ba2c1de14d5cc9be 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||||
@@ -147,7 +147,7 @@ public class AttributeMap {
|
@@ -135,7 +135,10 @@ public class AttributeMap {
|
||||||
|
if (attributeInstance != null) {
|
||||||
|
attributeInstance.load(compoundTag);
|
||||||
}
|
}
|
||||||
|
- }, () -> LOGGER.warn("Ignoring unknown attribute '{}'", string));
|
||||||
}, () -> {
|
+
|
||||||
- LOGGER.warn("Ignoring unknown attribute '{}'", (Object)string);
|
+ }, () -> {
|
||||||
+ // LOGGER.warn("Ignoring unknown attribute '{}'", (Object)string); // Scissors - Mute invalid attributes
|
+ // LOGGER.warn("Ignoring unknown attribute '{}'", (Object)string); // Scissors - Mute invalid attributes
|
||||||
});
|
+ });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
|
||||||
index 1b0db545f93b51368c2d384dd1ba45b93d9eff87..5c3633aa6a256a197502c8139cbf61c2f493bda7 100644
|
index a38e91552ead256bd8dd3b74794d742555681c2d..116af10e6e2467a3e3b0095c4968a79ebb4a19d6 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
|
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
|
||||||
@@ -86,7 +86,7 @@ public class AttributeModifier {
|
@@ -90,7 +90,7 @@ public class AttributeModifier {
|
||||||
AttributeModifier.Operation operation = AttributeModifier.Operation.fromValue(nbt.getInt("Operation"));
|
AttributeModifier.Operation operation = AttributeModifier.Operation.fromValue(nbt.getInt("Operation"));
|
||||||
return new AttributeModifier(uUID, nbt.getString("Name"), nbt.getDouble("Amount"), operation);
|
return new AttributeModifier(uUID, nbt.getString("Name"), nbt.getDouble("Amount"), operation);
|
||||||
} catch (Exception var3) {
|
} catch (Exception var3) {
|
||||||
- LOGGER.warn("Unable to create attribute: {}", (Object)var3.getMessage());
|
- LOGGER.warn("Unable to create attribute: {}", var3.getMessage());
|
||||||
+ // LOGGER.warn("Unable to create attribute: {}", (Object)var3.getMessage()); // Scissors - Mute invalid attributes
|
+ // LOGGER.warn("Unable to create attribute: {}", var3.getMessage()); // Scissors - Mute invalid attributes
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,7 +5,7 @@ Subject: [PATCH] Mute invalid Enderdragon phases
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
|
||||||
index bca131e9c428e2cb073ae2ef517dda12f73a5dcd..b9d603c82b12299e94c31928b36c9517834cff62 100644
|
index 1b1a210a86121049e507a497649727a99452c0a2..a8bcadbf64d5034b172427e16b1468b4c91c4518 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
|
||||||
@@ -20,7 +20,7 @@ public class DragonChargePlayerPhase extends AbstractDragonPhaseInstance {
|
@@ -20,7 +20,7 @@ public class DragonChargePlayerPhase extends AbstractDragonPhaseInstance {
|
||||||
@ -18,10 +18,10 @@ index bca131e9c428e2cb073ae2ef517dda12f73a5dcd..b9d603c82b12299e94c31928b36c9517
|
|||||||
} else if (this.timeSinceCharge > 0 && this.timeSinceCharge++ >= 10) {
|
} else if (this.timeSinceCharge > 0 && this.timeSinceCharge++ >= 10) {
|
||||||
this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN);
|
this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN);
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
|
||||||
index 9bf04f18d37356cdef1ef3a7f1e38a1801ad5713..7a8fd11245c801f1b869357c7244dc6dff8dd5de 100644
|
index 13f60a16f07c50a278b158d64180009020a4dca6..289361cbaad2ca6392ee66627becb8f973bb1e54 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
|
||||||
@@ -32,7 +32,7 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance {
|
@@ -31,7 +31,7 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance {
|
||||||
@Override
|
@Override
|
||||||
public void doServerTick() {
|
public void doServerTick() {
|
||||||
if (this.attackTarget == null) {
|
if (this.attackTarget == null) {
|
@ -75,7 +75,7 @@ index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..48dd50d0e443a59835e92616874c9856
|
|||||||
switch (distance) {
|
switch (distance) {
|
||||||
case -1:
|
case -1:
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
index 058819b39f0e2ba248e0a0c834f462a89263442b..f5363e289cdb0b0d71ff6d902acf5ee603ddcf98 100644
|
index c0538206a53f0e6d9b54bddde0259b89ac73d675..5ebb80ed81d9bbd4c69a14ccd0be6c67de2fcf0d 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
@@ -315,7 +315,7 @@ public class Main {
|
@@ -315,7 +315,7 @@ public class Main {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add depth limit to Component deserialization
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
index ba13650b52e39c9cc5cfa421f7720c7d4ba75678..df3c03aeaee5c12c5d57584535c9c7aa01be7dd3 100644
|
index d3a80d0a23be762c05931ae8001d98e43cab2b4a..e747eddff10e1be2b503cbbf503a21e1de4569ba 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
@@ -3,9 +3,11 @@ package net.minecraft.network.chat;
|
@@ -3,9 +3,11 @@ package net.minecraft.network.chat;
|
||||||
@ -28,15 +28,17 @@ index ba13650b52e39c9cc5cfa421f7720c7d4ba75678..df3c03aeaee5c12c5d57584535c9c7aa
|
|||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -24,6 +27,7 @@ import java.util.Optional;
|
@@ -23,6 +26,9 @@ import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
+
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
|
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
|
||||||
import net.minecraft.ChatFormatting;
|
+import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.network.chat.contents.DataSource;
|
import net.minecraft.network.chat.contents.DataSource;
|
||||||
@@ -35,8 +39,10 @@ import net.minecraft.network.chat.contents.SelectorContents;
|
import net.minecraft.network.chat.contents.KeybindContents;
|
||||||
|
@@ -33,8 +39,10 @@ import net.minecraft.network.chat.contents.SelectorContents;
|
||||||
import net.minecraft.network.chat.contents.TranslatableContents;
|
import net.minecraft.network.chat.contents.TranslatableContents;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.util.FormattedCharSequence;
|
import net.minecraft.util.FormattedCharSequence;
|
||||||
@ -47,7 +49,7 @@ index ba13650b52e39c9cc5cfa421f7720c7d4ba75678..df3c03aeaee5c12c5d57584535c9c7aa
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@@ -286,10 +292,65 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
@@ -284,10 +292,65 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
public static class Serializer {
|
public static class Serializer {
|
||||||
|
|
||||||
private static final Gson GSON = (new GsonBuilder()).disableHtmlEscaping().create();
|
private static final Gson GSON = (new GsonBuilder()).disableHtmlEscaping().create();
|
Loading…
Reference in New Issue
Block a user