Update Paper (#147)

* apply patches that i can

* add a few

* add rest of patches

* reorder patches

* reorder patches
This commit is contained in:
Telesphoreo 2024-04-16 00:12:25 -05:00 committed by GitHub
parent 43afa1c23f
commit 190be49a0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
37 changed files with 221 additions and 232 deletions

View File

@ -2,7 +2,7 @@ group=me.totalfreedom.scissors
version=1.20.4-R0.1-SNAPSHOT
mcVersion=1.20.4
paperRef=5436d44bf2509ff89129f8790ee4643f09c72871
paperRef=4445d23544e0801fb6f658de98815ce0d8c04f58
org.gradle.caching=true
org.gradle.parallel=true

View File

@ -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
index 7fd85ae2ebd7225f06d874aa7e37fbdb89e3ea92..b2cc15da40aa7bbcfc234b4e147ed0e53f359efa 100644
index 9067bab8ec695417d479393f07d9bc6432427d73..433e586bed53a8c17adec74b3088899c748d4be3 100644
--- a/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;
@ -16,7 +16,7 @@ index 7fd85ae2ebd7225f06d874aa7e37fbdb89e3ea92..b2cc15da40aa7bbcfc234b4e147ed0e5
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.entity.EntityType;
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());
Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
@ -31,4 +31,4 @@ index 7fd85ae2ebd7225f06d874aa7e37fbdb89e3ea92..b2cc15da40aa7bbcfc234b4e147ed0e5
+ // Scissors end
return DataResult.success(new HoverEvent.EntityTooltipInfo(entityType, uUID, component));
} catch (Exception var5) {
return DataResult.error(() -> {
return DataResult.error(() -> "Failed to parse tooltip: " + var5.getMessage());

View File

@ -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
index 37f37be56bab171df442b980ff46ff325daae283..deade19d16a7d6870171b9a60806a8cadb437db4 100644
index 5ebc309aed545a4c22970e617519fe916a29fa3c..14a35465e41c9ecb51bea5b084e2637ebd21d295 100644
--- a/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 {
for(int i = 0; i < listTag.size(); ++i) {
for (int i = 0; i < listTag.size(); i++) {
String string = listTag.getString(i);
- Optional<RecipeHolder<?>> optional = recipeManager.byKey(new ResourceLocation(string));
+ Optional<RecipeHolder<?>> optional = recipeManager.byKey(ResourceLocation.tryParse(string)); // Scissors - Validate resource locations
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
return InteractionResultHolder.fail(itemStack);
}
@ -25,7 +25,7 @@ index 37f37be56bab171df442b980ff46ff325daae283..deade19d16a7d6870171b9a60806a8ca
return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide());
} 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.
return InteractionResultHolder.fail(itemStack);
}

View File

@ -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
index e3a3f19a6e63fd42e29c418e5a7439972484d492..39866c58f9dbca9b4f0018922eac076c64ffbdae 100644
index fe4bea6af0d8734f3a5b972dce5f1e3914d6690e..0ee64be4288f59240beec26c470b78cc1aeac424 100644
--- a/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();
} else {
// Paper start - Validate resource location

View File

@ -1,24 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luna <lunahatesgogle@gmail.com>
Date: Sun, 10 Dec 2023 17:13:15 -0600
From: Telesphoreo <me@telesphoreo.me>
Date: Mon, 15 Apr 2024 22:26:14 -0500
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
index 433e586bed53a8c17adec74b3088899c748d4be3..a82b4e39c3160114aded3f33c85fad2e95065b72 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 {
@@ -261,7 +261,7 @@ public class HoverEvent {
CompoundTag compoundTag = TagParser.parseTag(text.getString());
return DataResult.success(new HoverEvent.ItemStackInfo(ItemStack.of(compoundTag)));
} catch (CommandSyntaxException var2) {
return DataResult.error(() -> {
- return "Failed to parse item tag: " + var2.getMessage();
- return DataResult.error(() -> "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
index c34701f95580e4cf45fe086115563127432a28c5..fc7547381a5dd7c0aae352c0cae72a980953b98f 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 {

View File

@ -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
index 57206594f305961a33542e1f8079c75bfa7c535f..ea4504be0eb115e563a4abd9dcbcedd57f9edcc2 100644
index 3365aed2b67ae0e4dd0410f5190ba474f146139b..43b62a07b040b1d7d76dc8f940f35b51d1d5f868 100644
--- a/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 {

View File

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com>
Date: Sun, 10 Dec 2023 17:26:11 -0600
From: Telesphoreo <me@telesphoreo.me>
Date: Mon, 15 Apr 2024 22:36:13 -0500
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
index e028353e0261310afc42ca0454b723d9f1ffc131..ed8810319db2ce754245193a62ea7a9a32ac13ec 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 {
@ -19,23 +19,14 @@ index e028353e0261310afc42ca0454b723d9f1ffc131..4e9366eee55236a08f1b8c56029c50e7
- }
-
- return null;
+ return net.minecraft.network.chat.Component.Serializer.fromJsonSafe(string);
+ return net.minecraft.network.chat.Component.Serializer.fromJsonSafe(string); // Scissors
}
}
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
index d3a80d0a23be762c05931ae8001d98e43cab2b4a..ae84d06564b2560e13404f6d89f88ad71dbc2cc6 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> {
@@ -315,6 +315,26 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
return json == null ? null : Serializer.deserialize(json);
}
@ -63,10 +54,10 @@ index d3a80d0a23be762c05931ae8001d98e43cab2b4a..ba13650b52e39c9cc5cfa421f7720c7d
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
index a82b4e39c3160114aded3f33c85fad2e95065b72..e1f15ac481ab598e420ad79bcf289251d9f1c99a 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 {
@@ -147,7 +147,7 @@ public class HoverEvent {
public static DataResult<HoverEvent.EntityTooltipInfo> legacyCreate(Component text) {
try {
CompoundTag compoundTag = TagParser.parseTag(text.getString());
@ -76,24 +67,24 @@ index dbe9f81e298a931c3e0e5b879dc13b493b3fdb52..6708290b6d096e8081c56d2e0da3c9ae
// 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
index c5673657ca6332147a5cbd2f4107fee13b9b7f47..3fec6f3e0adef6e2094157ef9040c7c6dc41a6c2 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) -> {
@@ -124,10 +124,10 @@ public class NbtContents implements ComponentContents {
);
return stream.flatMap(text -> {
try {
- MutableComponent mutableComponent = Component.Serializer.fromJson(text);
+ MutableComponent mutableComponent = Component.Serializer.fromJsonSafe(text);
+ MutableComponent mutableComponent = Component.Serializer.fromJsonSafe(text); // Scissors
return Stream.of(ComponentUtils.updateForEntity(source, mutableComponent, sender, depth));
} catch (Exception var5) {
- LOGGER.warn("Failed to parse component: {}", text, var5);
} catch (Exception var5x) {
- LOGGER.warn("Failed to parse component: {}", text, var5x);
+ // Scissors - don't log
return Stream.of();
}
}).reduce((accumulator, current) -> {
}).reduce((accumulator, current) -> accumulator.append(component).append(current)).orElseGet(Component::empty);
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
index 637478fd8a284e6833cf8f5fa17ccf9d73d1dd3f..2ecf2d8ff546ed097cb3b547db22d28a31d29ec4 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
@ -110,7 +101,7 @@ index 51097f1d04d981db2823e8647b546658b8fd27c1..2e32c600a04e0ad280a7ddcce23668af
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
index 7eb1c28886741bdfe7985d16b6824f3e85ffae50..a6b7ff2e50c9700589428cc7d61b5ef9f9082ea8 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 {
@ -139,7 +130,7 @@ index 6c3ed29e13ea78ceb1c9bb11ce0d9938bb8b4c62..ab2f9b9a021e05ad66a3701577862fa2
if (component3 != null) {
playerTeam.setPlayerSuffix(component3);
}
@@ -126,7 +126,7 @@ public class ScoreboardSaveData extends SavedData {
@@ -123,7 +123,7 @@ public class ScoreboardSaveData extends SavedData {
return ObjectiveCriteria.DUMMY;
});
String string2 = compoundTag.getString("Name");
@ -147,4 +138,4 @@ index 6c3ed29e13ea78ceb1c9bb11ce0d9938bb8b4c62..ab2f9b9a021e05ad66a3701577862fa2
+ 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);
NumberFormat numberFormat = NumberFormatTypes.CODEC.parse(NbtOps.INSTANCE, compoundTag.get("format")).result().orElse(null);

View File

@ -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
index 85b8be8ffac0fb40e9cae0528271ed41473811c8..d0cfc4fc00d45c91380d2d794ca816db74d40266 100644
index 96d5448019d53ac3575e209c1c5c223a62a2638d..d0cfc4fc00d45c91380d2d794ca816db74d40266 100644
--- a/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;
@ -50,7 +50,7 @@ index 85b8be8ffac0fb40e9cae0528271ed41473811c8..d0cfc4fc00d45c91380d2d794ca816db
protected void encode(ChannelHandlerContext channelHandlerContext, Packet<?> packet, ByteBuf byteBuf) throws Exception {
Attribute<ConnectionProtocol.CodecData<?>> attribute = channelHandlerContext.channel().attr(this.codecKey);
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");
} else {
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf);
@ -74,7 +74,10 @@ index 85b8be8ffac0fb40e9cae0528271ed41473811c8..d0cfc4fc00d45c91380d2d794ca816db
- String packetName = io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(packet.getClass().getName());
- if (packetName.contains(".")) {
- 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);
- // Paper end
@ -88,16 +91,12 @@ index 85b8be8ffac0fb40e9cae0528271ed41473811c8..d0cfc4fc00d45c91380d2d794ca816db
- int packetLength = friendlyByteBuf.readableBytes();
- if (packetLength > MAX_PACKET_SIZE) {
- 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
- ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet);
+ friendlyByteBuf.clear();
+ k = this.tryWrite(packet, friendlyByteBuf, channelHandlerContext, i);
}
-
+ JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k);
+ ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet);
+ // Scissors end
@ -154,7 +153,7 @@ index 3944852921335c78a04a9dc301882ab5b152b1ed..96ee53c7cc862e059328c5cdf5e07f30
this.type = blockEntityType;
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
index 998deae645b4497c3285bfba3260c636439f9ecf..f419d4330ea55c1ed91c539a7884ee6814a16ca3 100644
index 76bde683d193b37e563a67c1c7b9bdcf17d64524..185aa88ff28e6f3e3314abe19dff88609a47334e 100644
--- a/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 {
@ -174,7 +173,7 @@ index 998deae645b4497c3285bfba3260c636439f9ecf..f419d4330ea55c1ed91c539a7884ee68
@@ -58,6 +65,7 @@ public class ClientboundLevelChunkPacketData {
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
// Paper start - Handle oversized block entities in chunks
if (++totalTileEntities > TE_LIMIT) {

View File

@ -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
index 3bec895fecb3521653fb0b88d4a4854fd3766b46..5fd278ac13c02b9d511be22dba9719cb0cb0e17b 100644
index 2750702cff35762bc817ffbe5bf81631e86bc49b..8714c3be77490a87aa6df0ff36a87557c6b99e25 100644
--- a/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;
@ -23,7 +23,7 @@ index 3bec895fecb3521653fb0b88d4a4854fd3766b46..5fd278ac13c02b9d511be22dba9719cb
+import net.minecraft.world.entity.player.Player;
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
public Stream<CompoundTag> getData(CommandSourceStack source) throws CommandSyntaxException {
if (this.compiledSelector != null) {

View File

@ -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
index e07cc7970955ce240754cfe424d768c2bba0241a..a4f41bb4ec6cb20f782668c714229b61415cfdfb 100644
index b45bb4ddf6b586ba1285db230e0bc3d1b5e447e8..4a46935cac263325a87a1b0bf32302839a75516e 100644
--- a/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 {
public void visitByteArray(ByteArrayTag element) {
StringBuilder stringBuilder = (new StringBuilder("[")).append("B").append(";");
StringBuilder stringBuilder = new StringBuilder("[").append("B").append(";");
byte[] bs = element.getAsByteArray();
+ if (bs.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors
for(int i = 0; i < bs.length; ++i) {
stringBuilder.append(" ").append((int)bs[i]).append("B");
for (int i = 0; i < bs.length; i++) {
stringBuilder.append(" ").append(bs[i]).append("B");
@@ -105,6 +106,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
public void visitIntArray(IntArrayTag element) {
StringBuilder stringBuilder = (new StringBuilder("[")).append("I").append(";");
StringBuilder stringBuilder = new StringBuilder("[").append("I").append(";");
int[] is = element.getAsIntArray();
+ 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]);
@@ -122,6 +124,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
String string = "L";
StringBuilder stringBuilder = (new StringBuilder("[")).append("L").append(";");
StringBuilder stringBuilder = new StringBuilder("[").append("L").append(";");
long[] ls = element.getAsLongArray();
+ 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");
@@ -136,7 +139,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
@ -51,7 +51,7 @@ index e07cc7970955ce240754cfe424d768c2bba0241a..a4f41bb4ec6cb20f782668c714229b61
} else {
StringBuilder stringBuilder = new StringBuilder("{");
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
+++ b/src/main/java/net/minecraft/nbt/StringTagVisitor.java
@@ -53,6 +53,7 @@ public class StringTagVisitor implements TagVisitor {
@ -60,7 +60,7 @@ index a687a0f17df30126d53a1e3a669dc6d157c23ed5..2c50f41dd8034af16fcceca75eeb6c7a
byte[] bs = element.getAsByteArray();
+ 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) {
@@ -69,6 +70,7 @@ public class StringTagVisitor implements TagVisitor {
public void visitIntArray(IntArrayTag element) {
@ -68,7 +68,7 @@ index a687a0f17df30126d53a1e3a669dc6d157c23ed5..2c50f41dd8034af16fcceca75eeb6c7a
int[] is = element.getAsIntArray();
+ 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) {
@@ -85,6 +87,7 @@ public class StringTagVisitor implements TagVisitor {
public void visitLongArray(LongArrayTag element) {
@ -76,7 +76,7 @@ index a687a0f17df30126d53a1e3a669dc6d157c23ed5..2c50f41dd8034af16fcceca75eeb6c7a
long[] ls = element.getAsLongArray();
+ 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) {
@@ -100,6 +103,7 @@ public class StringTagVisitor implements TagVisitor {
@Override
@ -84,7 +84,7 @@ index a687a0f17df30126d53a1e3a669dc6d157c23ed5..2c50f41dd8034af16fcceca75eeb6c7a
this.builder.append('[');
+ 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) {
@@ -116,6 +120,7 @@ public class StringTagVisitor implements TagVisitor {
public void visitCompound(CompoundTag compound) {
@ -95,7 +95,7 @@ index a687a0f17df30126d53a1e3a669dc6d157c23ed5..2c50f41dd8034af16fcceca75eeb6c7a
for (String string : list) {
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
+++ b/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
@@ -97,6 +97,7 @@ public class TextComponentTagVisitor implements TagVisitor {
@ -104,15 +104,15 @@ index 149def3da0b92f64e4fc04630965dce44884f938..c9d753f37bd65e35f8a4e2eb5c6fe8f7
byte[] bs = element.getAsByteArray();
+ if (bs.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors
for(int i = 0; i < bs.length; ++i) {
MutableComponent mutableComponent2 = Component.literal(String.valueOf((int)bs[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER);
for (int i = 0; i < bs.length; i++) {
MutableComponent mutableComponent2 = Component.literal(String.valueOf(bs[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER);
@@ -115,6 +116,7 @@ public class TextComponentTagVisitor implements TagVisitor {
Component component = Component.literal("I").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
MutableComponent mutableComponent = Component.literal("[").append(component).append(";");
int[] is = element.getAsIntArray();
+ 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));
@@ -132,6 +134,7 @@ public class TextComponentTagVisitor implements TagVisitor {
Component component = Component.literal("L").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
@ -120,7 +120,7 @@ index 149def3da0b92f64e4fc04630965dce44884f938..c9d753f37bd65e35f8a4e2eb5c6fe8f7
long[] ls = element.getAsLongArray();
+ 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);
@@ -147,7 +150,7 @@ public class TextComponentTagVisitor implements TagVisitor {

View File

@ -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
index 23570a0b1227a840b9c1e6ae326827ea655bb5f7..b95ea8c0ef66b1f8fad0de0e005bf2cf95da5808 100644
index e9bb7feb591032904516d1b9374f486d8a7d066c..60961c54e870148b5c649045e7347ca1064b6bde 100644
--- a/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 {

View File

@ -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
index b95ea8c0ef66b1f8fad0de0e005bf2cf95da5808..1e833374f4abd649074b2b42067317f42cf78df6 100644
index 60961c54e870148b5c649045e7347ca1064b6bde..0ce25857188029335d0afd0a9f0c22b79d4b0b69 100644
--- a/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 {

View File

@ -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
index 2446d649225f96748e2fbb1a53a9e1902ac22aa1..76016cbbdff22592b76e827212b76021f3e39e13 100644
index eaad15a4d201356c34c1a09c7fbe5c35f76a2176..e166411e05287d97ea7c9d35b19d4ae3106401c3 100644
--- a/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 {

View File

@ -40,7 +40,7 @@ index 7ef14e4441a329c680a5dfe4bfb5033ffcb8f9d5..eff5bdf00b0aa7a9925ff59a62ead725
executor.performCommand(world);
} 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
index e2e31d6383c7de4f2eede46987d51978a5692639..9e5bb41c20e92cc39c99bfb3c801e9e432ba23cd 100644
index 447b0359922011fe12b1bb9628d23a47c9d7dc89..0d6be671e1512074ae1265fe93a5d5437f3929dd 100644
--- a/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;
@ -60,7 +60,7 @@ index e2e31d6383c7de4f2eede46987d51978a5692639..9e5bb41c20e92cc39c99bfb3c801e9e4
public class JigsawBlockEntity extends BlockEntity {
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) {
@ -78,7 +78,7 @@ index e2e31d6383c7de4f2eede46987d51978a5692639..9e5bb41c20e92cc39c99bfb3c801e9e4
Registry<StructureTemplatePool> registry = world.registryAccess().registryOrThrow(Registries.TEMPLATE_POOL);
// 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
index 60c941bd67dc899ea923f8ee49412de01ce199db..9bcd07f8b5d266c39034e5c021da9ffb7262b474 100644
index 29c59e4a1283ac211b18b953ed6c03834a2587bd..fb385cd66226200ed0b8439cb6659dbac6c2b229 100644
--- a/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;
@ -98,7 +98,7 @@ index 60c941bd67dc899ea923f8ee49412de01ce199db..9bcd07f8b5d266c39034e5c021da9ffb
public class StructureBlockEntity extends BlockEntity {
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;
} else {
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 blockPos3 = new BlockPos(blockPos.getX() + 80, this.level.getMaxBuildHeight() - 1, blockPos.getZ() + 80);
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) {
return false;
} else {
@ -124,7 +124,7 @@ index 60c941bd67dc899ea923f8ee49412de01ce199db..9bcd07f8b5d266c39034e5c021da9ffb
BlockPos blockPos = this.getBlockPos().offset(this.structurePos);
ServerLevel serverLevel = (ServerLevel)this.level;
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) {
return false;
} else {

View File

@ -1,35 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Allink <arclicious@vivaldi.net>
Date: Mon, 18 Apr 2022 03:56:09 +0100
From: Telesphoreo <me@telesphoreo.me>
Date: Mon, 15 Apr 2024 22:49:31 -0500
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
index 4105bb71b1f1614b3e91478b40b85add94a9257b..52d2a8fd6e16c8d85f2544ffdb9ed4d18b298e1c 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;
@@ -2,6 +2,8 @@ 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 {
@@ -22,10 +24,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) {
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 {
@@ -33,7 +37,7 @@ public class ContainerHelper {
}
}
@ -38,13 +39,13 @@ index 4092c7a8c2b0d9d26e6f4d97386735236300d132..04c47cf1a920ae6c356449df801227ee
nbt.put("Items", listTag);
}
@@ -42,11 +45,19 @@ public class ContainerHelper {
@@ -42,11 +46,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) {
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()) {
@ -59,18 +60,19 @@ index 4092c7a8c2b0d9d26e6f4d97386735236300d132..04c47cf1a920ae6c356449df801227ee
}
}
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
index 1ad126d992d95062a3db08374db7a927f23a0cac..6af963d383293a4a6f8d517e2dc179ab70744b31 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;
@@ -23,6 +23,8 @@ 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 me.totalfreedom.scissors.NbtUtility;
import net.minecraft.ChatFormatting;
import net.minecraft.Util;
import net.minecraft.advancements.CriteriaTriggers;
@@ -278,6 +279,12 @@ public final class ItemStack {
@@ -278,6 +280,12 @@ public final class ItemStack {
// CraftBukkit - break into own method
private void load(CompoundTag nbttagcompound) {
@ -83,7 +85,7 @@ index 1ad126d992d95062a3db08374db7a927f23a0cac..345fb9722f1dc8293809256d3bb87b89
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 {
@@ -585,7 +593,11 @@ public final class ItemStack {
nbt.putString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString());
nbt.putByte("Count", (byte) this.count);
if (this.tag != null) {
@ -96,7 +98,7 @@ index 1ad126d992d95062a3db08374db7a927f23a0cac..345fb9722f1dc8293809256d3bb87b89
}
return nbt;
@@ -919,6 +930,7 @@ public final class ItemStack {
@@ -919,6 +931,7 @@ public final class ItemStack {
// Paper end
public void setTag(@Nullable CompoundTag nbt) {
@ -105,18 +107,19 @@ index 1ad126d992d95062a3db08374db7a927f23a0cac..345fb9722f1dc8293809256d3bb87b89
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
index 89d06253b00604114e543ebbe12a9993ae95dc41..d0af3a9b956b37126811080d65474eacd76bc083 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;
@@ -9,6 +9,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
+import me.totalfreedom.scissors.NbtUtility; // Scissors
+
+import me.totalfreedom.scissors.NbtUtility;
import net.minecraft.SharedConstants;
import net.minecraft.Util;
import net.minecraft.core.BlockPos;
@@ -213,6 +214,17 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@@ -213,6 +215,17 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
public List<ItemStack> getContents() {
@ -135,13 +138,13 @@ index 89d06253b00604114e543ebbe12a9993ae95dc41..2f17fa399dfff7e260fe552147fe8869
}
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
index 416aa989ebb18a8741cc9d605a1180ab830f6643..af7ed06c083161212784f746290129a17523575a 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 me.totalfreedom.scissors.NbtUtility;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.NonNullList;
@ -164,18 +167,19 @@ index 416aa989ebb18a8741cc9d605a1180ab830f6643..a9a8c9e68e5b767dec2c26495685da88
}
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
index 9bb542ce3a8c52e1688bb1f66fc916dd23a5fd10..d8386aa10dc1616c4da87bc8078548d13bff5bdf 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;
@@ -3,6 +3,8 @@ 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 me.totalfreedom.scissors.NbtUtility;
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
@@ -73,6 +75,17 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
}
public List<ItemStack> getContents() {
@ -194,13 +198,13 @@ index 9bb542ce3a8c52e1688bb1f66fc916dd23a5fd10..bdbe623ec5d3a5471e909c9933cf556a
}
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
index 9b1243d96e0694c62fc9e82e9be540bce0d2b3ad..2cf4a854a40aabbfff2f6ee4fb9e36e8d466afd5 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 me.totalfreedom.scissors.NbtUtility;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.NonNullList;
@ -223,13 +227,13 @@ index 9b1243d96e0694c62fc9e82e9be540bce0d2b3ad..0f734147d0cb86ff6c8a4c28733cf4cb
}
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
index 881379681c39230a00b3a1f11cd87498984396c7..8e1ef455c1b563844c416021c478b2a34b90c418 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 me.totalfreedom.scissors.NbtUtility;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.nbt.CompoundTag;
@ -252,18 +256,19 @@ index 881379681c39230a00b3a1f11cd87498984396c7..d0513b72cdaec3b67b9341d251367b19
}
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
index cdb739df2a285032d25d84f4464f202a7a3fa578..69845474c207220c0146891be90e3232ac8a3547 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;
@@ -6,6 +6,8 @@ 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 me.totalfreedom.scissors.NbtUtility;
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
@@ -57,6 +59,17 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
private int maxStack = MAX_STACK;
public List<ItemStack> getContents() {
@ -282,18 +287,19 @@ index 757edf74751dc7183454656fda9cecc4eb601e4c..005de26f9a8a67f29a474823515ee667
}
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
index 1fa22445a4ecc8c08dbcf0cc6bd39dc5003604c4..c37f0f12283f528d16fd0450075eab1974ba5057 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;
@@ -4,6 +4,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.stream.IntStream;
import javax.annotation.Nullable;
+import me.totalfreedom.scissors.NbtUtility; // Scissors
+
+import me.totalfreedom.scissors.NbtUtility;
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
@@ -61,6 +63,17 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
public boolean opened;
public List<ItemStack> getContents() {

View File

@ -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
index ab5b259d8f72022c875cae73be25fe2da346c6b3..1c2b3042b0d7b012876e3d4aab4521915d2cda18 100644
index 860d33ac56680babd87358b1d7d2216dac3f7865..a60f594b3d7c8c30344f5e888e4309b8f75fdeaf 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 @@

View File

@ -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
index d0a7490c153e7968c657a525908de58f60f26c20..807117124668040121c5252a10c33ad100c0b0da 100644
index a60f594b3d7c8c30344f5e888e4309b8f75fdeaf..cfe4f98458c1b1fd311535552b99937d1f319c0e 100644
--- a/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;

View File

@ -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
index 258a636a59203c4e5415a89002c6a607338f9514..dbc2993a105214d945a49e1eb5b910d28c09ae41 100644
index 793ab8acd7445984cff2628e3f001661dc20c8e5..0e6e0d6a9c645db0121637262a6cf90172d3c385 100644
--- a/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;
@ -26,7 +26,7 @@ index 258a636a59203c4e5415a89002c6a607338f9514..dbc2993a105214d945a49e1eb5b910d2
import net.minecraft.stats.Stats;
import net.minecraft.util.StringUtil;
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);
}

View File

@ -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
index a66ec293947fc852104dce93a418771b2f44106d..b324e9ac6bbbe691c0b3c2994f326c0aa06d7dd7 100644
index cfe4f98458c1b1fd311535552b99937d1f319c0e..adbb1036913ba6299f2093c84480e4147a36b344 100644
--- a/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

View File

@ -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
index d87ffb5ed4550757016c2fabaa2845a6aaac74d7..7e8cf65ac53f595292d161da0735bf97081e832a 100644
index f62640152027b874d4266d868574af062bd684d7..f94385837d5ed1ef52458b73410df5fd186d66e2 100644
--- a/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> {
public static record Doubles(Optional<Double> min, Optional<Double> max, Optional<Double> minSq, Optional<Double> maxSq) implements MinMaxBounds<Double> {
public static record Doubles(@Override Optional<Double> min, @Override Optional<Double> max, Optional<Double> minSq, Optional<Double> maxSq)
implements MinMaxBounds<Double> {
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.<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 {
if (min.isPresent() && max.isPresent() && min.get() > max.get()) {
@@ -188,7 +188,7 @@ public interface MinMaxBounds<T extends Number> {
public static record Ints(Optional<Integer> min, Optional<Integer> max, Optional<Long> minSq, Optional<Long> maxSq) implements MinMaxBounds<Integer> {
@@ -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)
implements MinMaxBounds<Integer> {
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.<Integer, MinMaxBounds.Ints>createCodec(Codec.INT, MinMaxBounds.Ints::new); // Scissors - compile fixes
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
index 676a1499747b071515479130875157263d3a8352..6a65850101b8ea348a4bfeaeca805a39987b06fc 100644
--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java

View File

@ -5,7 +5,7 @@ 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
index 79ef94350828bcf780ee65d9de7006730214a2c8..ed116878cf8525f4ab5b6656d6e40e8504a4f42b 100644
index 2ecf2d8ff546ed097cb3b547db22d28a31d29ec4..36b1a1cc66b9852d3b10c09cbf39262f51996663 100644
--- a/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

View File

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Allink <arclicious@vivaldi.net>
Date: Sun, 10 Dec 2023 18:48:55 -0600
From: Telesphoreo <me@telesphoreo.me>
Date: Mon, 15 Apr 2024 23:01:26 -0500
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
index c87b708c368713a23a10ad97704575ee4df27891..a650bdccc7f8fe77abe2750c9939f5eb0ccfd57b 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 @@
@ -15,7 +15,7 @@ index 74cf1c043beef03cfd5adf481414a5ee78bef2a6..939f4a0639c847b94cfc9acf1409a7a3
import net.minecraft.server.level.ServerPlayer;
public interface OutgoingChatMessage {
@@ -44,10 +45,22 @@ public interface OutgoingChatMessage {
@@ -46,9 +47,20 @@ public interface OutgoingChatMessage {
// Paper end
PlayerChatMessage playerChatMessage = this.message.filter(filterMaskEnabled);
playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper
@ -25,7 +25,6 @@ index 74cf1c043beef03cfd5adf481414a5ee78bef2a6..939f4a0639c847b94cfc9acf1409a7a3
sender.connection.sendPlayerChatMessage(playerChatMessage, params);
+ return;
}
+ sender.connection.sendPlayerChatMessage(new PlayerChatMessage(
+ SignedMessageLink.unsigned(playerChatMessage.sender()),
+ null,
@ -35,12 +34,11 @@ index 74cf1c043beef03cfd5adf481414a5ee78bef2a6..939f4a0639c847b94cfc9acf1409a7a3
+ 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
index 0af9ed92824ccf30814eceb6a2c2e5c12661c991..c92374104b4aed2f952b250c5559ab9cc83532da 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;
@ -49,20 +47,20 @@ index ba12919c3f9aec34a9e64993b143ae92be5eb172..bdfa4a7f5b50e80195e79a6dd1204cb7
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 {
import net.minecraft.world.entity.player.ProfilePublicKey;
@@ -45,7 +47,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());
LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", 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
index adbb1036913ba6299f2093c84480e4147a36b344..8d5f4f2a0589c9c34dcff0ca95b6222b90f7d09a 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 @@

View File

@ -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
index 17343d515044f3678b4edf070ee7ca244adc4228..8ade519114bec879bed8e8e23707a85327da131b 100644
index 02e3d1c9c18952ba53507f7b6887fd3c81af33a9..61573844b236838fd219526ea35df8c7b0c94026 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
@@ -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.y());
b.writeByte(icon.rot() & 15);
- b.writeNullable(icon.name(), FriendlyByteBuf::writeComponent);
+ final boolean passedNameCap = icon.name() == null || icon.name().getString().length() <= 32; // Scissors
+ b.writeNullable(passedNameCap ? icon.name() : null, FriendlyByteBuf::writeComponent); // Scissors
});
});
}));
if (this.colorPatch != null) {
buf.writeByte(this.colorPatch.width);
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
index 45269115e63cfc3bd7dc740a5694e2cc7c35bcb1..85ea95f55fd6177748edf921e2380142d93b8b06 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java

View File

@ -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
index 6907d1be36fbdf0856c0e11983218d2fd1f9cb46..298c8a9cd08425e9aa4f222b98d95d92b80951e6 100644
index 502bdc726b7890b00ee36871d905dea44e8719e3..1fbc8b372271bb4cd4375ca6b6b1d7e7961094fb 100644
--- a/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 {

View File

@ -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
index 87db9febbbf53702be0e1e89a95db99e823713e5..02160e69f4b6bee344943307ec7ddcb7c1489162 100644
index 106af2b2c7ff72c7549975aef75cdcff8d9a7d97..ecdcf4cf8650270ce7595905ce9d498eee520dcd 100644
--- a/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);
}
} else if (this.count - 1 == this.maxChainedNeighborUpdates) {

View File

@ -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
index b69f7c74fe4e2ec6280ebee27f8b8fd0ec8ac361..1350b224b7321fe1aac3d3cf5ff1f7a089da53cc 100644
index 8d5f4f2a0589c9c34dcff0ca95b6222b90f7d09a..88c98ba7673808819b8f85876f22743bc3a4f471 100644
--- a/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
@@ -865,7 +865,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
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
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
@ -17,7 +17,7 @@ index b69f7c74fe4e2ec6280ebee27f8b8fd0ec8ac361..1350b224b7321fe1aac3d3cf5ff1f7a0
BaseCommandBlock commandblocklistenerabstract = null;
CommandBlockEntity tileentitycommand = null;
BlockPos blockposition = packet.getPos();
@@ -1039,7 +1039,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1013,7 +1013,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handleSetStructureBlock(ServerboundSetStructureBlockPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@ -26,7 +26,7 @@ index b69f7c74fe4e2ec6280ebee27f8b8fd0ec8ac361..1350b224b7321fe1aac3d3cf5ff1f7a0
BlockPos blockposition = packet.getPos();
BlockState iblockdata = this.player.level().getBlockState(blockposition);
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
@@ -1097,7 +1097,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1071,7 +1071,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handleSetJigsawBlock(ServerboundSetJigsawBlockPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@ -35,7 +35,7 @@ index b69f7c74fe4e2ec6280ebee27f8b8fd0ec8ac361..1350b224b7321fe1aac3d3cf5ff1f7a0
BlockPos blockposition = packet.getPos();
BlockState iblockdata = this.player.level().getBlockState(blockposition);
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
@@ -1122,7 +1122,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1096,7 +1096,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handleJigsawGenerate(ServerboundJigsawGeneratePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Allink <arclicious@vivaldi.net>
Date: Mon, 11 Dec 2023 12:27:44 -0600
From: Telesphoreo <me@telesphoreo.me>
Date: Mon, 15 Apr 2024 23:27:16 -0500
Subject: [PATCH] Implement command block events
@ -18,7 +18,7 @@ index c99fc118013cb3d4043638e2001a8297e79ddf9c..cdaa81e1f2167b29ec01cc25e51a8400
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
index 88c98ba7673808819b8f85876f22743bc3a4f471..f96c0c5007d9e1d86bfe27518815dc798e431c6a 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 @@
@ -64,7 +64,7 @@ index f2c3b81779bbd2c52068750e65e66e1ca6c4d492..b69f7c74fe4e2ec6280ebee27f8b8fd0
commandblocklistenerabstract.setCommand(s);
commandblocklistenerabstract.setTrackOutput(flag);
if (!flag) {
@@ -936,7 +951,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -936,7 +951,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level());
if (commandblocklistenerabstract != null) {
@ -79,7 +79,6 @@ index f2c3b81779bbd2c52068750e65e66e1ca6c4d492..b69f7c74fe4e2ec6280ebee27f8b8fd0
+
+ command = event.getNewCommand();
+ commandblocklistenerabstract.setCommand(command);
+
+ // Scissors end
commandblocklistenerabstract.setTrackOutput(packet.isTrackOutput());
if (!packet.isTrackOutput()) {

View File

@ -1,14 +1,14 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Allink <arclicious@vivaldi.net>
Date: Fri, 2 Jun 2023 22:13:54 +0100
From: Telesphoreo <me@telesphoreo.me>
Date: Mon, 15 Apr 2024 23:40:27 -0500
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
index c77860a141064aea6a0b510bb44d35fea90aee42..3be3dd61b8a27b3a8ca3c72ae5ffa2ea8fa00231 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 {
@@ -184,9 +184,47 @@ public class TagParser {
this.expect('}');
this.depth--; // Paper
@ -21,39 +21,30 @@ index 94cb73e7f60171aa57bd1dbe7e91ef4db94e70b7..9ed1c477620b41317c4bf2b14ebc672c
+ return this.exceedsDepthLimit(0, tag);
+ }
+
+ private boolean exceedsDepthLimit(long depth, Tag tag)
+ {
+ if (depth > 256)
+ {
+ private boolean exceedsDepthLimit(long depth, Tag tag) {
+ if (depth > 256) {
+ return true;
+ }
+
+ if (tag instanceof ListTag listTag)
+ {
+ for (Tag childTag : listTag)
+ {
+ if (tag instanceof ListTag listTag) {
+ for (Tag childTag : listTag) {
+ boolean returnValue = this.exceedsDepthLimit(depth + 1, childTag);
+
+ if (returnValue)
+ {
+ if (returnValue) {
+ return true;
+ }
+ }
+ } else if (tag instanceof CompoundTag compoundTag)
+ {
+ for (String key: compoundTag.getAllKeys())
+ {
+ } else if (tag instanceof CompoundTag compoundTag) {
+ for (String key : compoundTag.getAllKeys()) {
+ Tag childTag = compoundTag.get(key);
+
+ if (childTag == null)
+ {
+ if (childTag == null) {
+ continue;
+ }
+
+ boolean returnValue = this.exceedsDepthLimit(depth + 1, childTag);
+
+ if (returnValue)
+ {
+ if (returnValue) {
+ return true;
+ }
+ }
@ -66,7 +57,7 @@ index 94cb73e7f60171aa57bd1dbe7e91ef4db94e70b7..9ed1c477620b41317c4bf2b14ebc672c
private Tag readListTag() throws CommandSyntaxException {
this.expect('[');
this.reader.skipWhitespace();
@@ -218,7 +265,7 @@ public class TagParser {
@@ -220,7 +258,7 @@ public class TagParser {
this.expect(']');
this.depth--; // Paper
@ -75,36 +66,36 @@ index 94cb73e7f60171aa57bd1dbe7e91ef4db94e70b7..9ed1c477620b41317c4bf2b14ebc672c
}
}
@@ -243,7 +290,7 @@ public class TagParser {
@@ -245,7 +283,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 {
while (this.reader.peek() != ']') {
int i = this.reader.getCursor();
@@ -257,11 +295,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
- list.add((T)(Byte)((NumericTag)tag).getAsByte()); // Paper - decompile fix
+ list.add(((NumericTag)tag).getAsByte()); // 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
- list.add((T)(Long)((NumericTag)tag).getAsLong()); // Paper - decompile fix
+ list.add(((NumericTag)tag).getAsLong()); // Scissors - Remove (T) cast
} else {
- list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix
+ list.add(((NumericTag)tag).getAsNumber()); // Scissors - Remove (T) cast
- list.add((T)(Integer)((NumericTag)tag).getAsInt()); // Paper - decompile fix
+ list.add(((NumericTag)tag).getAsInt()); // Scissors - Remove (T) cast
}
if (this.hasElementSeparator()) {
@@ -272,7 +319,7 @@ public class TagParser {
if (!this.hasElementSeparator()) {
@@ -274,7 +312,7 @@ public class TagParser {
}
this.expect(']');
- return list;
+ return (List<T>) list; // Scissors - Cast to List<T>
}
}
private boolean hasElementSeparator() {

View File

@ -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
index 897d7632ecfea40890433474870dd7a5e534d8ab..7c522cf74bd86a73a08ebd1b2de69b5b9da6559b 100644
index b99a080ab27e24d8131fda931ca70d6d271bb01c..f88b31d9bfc8b332230fa318ba2c1de14d5cc9be 100644
--- a/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 '{}'", (Object)string);
- }, () -> LOGGER.warn("Ignoring unknown attribute '{}'", string));
+
+ }, () -> {
+ // 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
index 1b0db545f93b51368c2d384dd1ba45b93d9eff87..5c3633aa6a256a197502c8139cbf61c2f493bda7 100644
index a38e91552ead256bd8dd3b74794d742555681c2d..116af10e6e2467a3e3b0095c4968a79ebb4a19d6 100644
--- a/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"));
return new AttributeModifier(uUID, nbt.getString("Name"), nbt.getDouble("Amount"), operation);
} catch (Exception var3) {
- LOGGER.warn("Unable to create attribute: {}", (Object)var3.getMessage());
+ // LOGGER.warn("Unable to create attribute: {}", (Object)var3.getMessage()); // Scissors - Mute invalid attributes
- LOGGER.warn("Unable to create attribute: {}", var3.getMessage());
+ // LOGGER.warn("Unable to create attribute: {}", var3.getMessage()); // Scissors - Mute invalid attributes
return null;
}
}

View File

@ -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
index bca131e9c428e2cb073ae2ef517dda12f73a5dcd..b9d603c82b12299e94c31928b36c9517834cff62 100644
index 1b1a210a86121049e507a497649727a99452c0a2..a8bcadbf64d5034b172427e16b1468b4c91c4518 100644
--- 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
@@ -20,7 +20,7 @@ public class DragonChargePlayerPhase extends AbstractDragonPhaseInstance {
@ -18,10 +18,10 @@ index bca131e9c428e2cb073ae2ef517dda12f73a5dcd..b9d603c82b12299e94c31928b36c9517
} else if (this.timeSinceCharge > 0 && this.timeSinceCharge++ >= 10) {
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
index 9bf04f18d37356cdef1ef3a7f1e38a1801ad5713..7a8fd11245c801f1b869357c7244dc6dff8dd5de 100644
index 13f60a16f07c50a278b158d64180009020a4dca6..289361cbaad2ca6392ee66627becb8f973bb1e54 100644
--- 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
@@ -32,7 +32,7 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance {
@@ -31,7 +31,7 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance {
@Override
public void doServerTick() {
if (this.attackTarget == null) {

View File

@ -75,7 +75,7 @@ index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..48dd50d0e443a59835e92616874c9856
switch (distance) {
case -1:
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
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -315,7 +315,7 @@ public class Main {

View File

@ -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
index ba13650b52e39c9cc5cfa421f7720c7d4ba75678..df3c03aeaee5c12c5d57584535c9c7aa01be7dd3 100644
index ae84d06564b2560e13404f6d89f88ad71dbc2cc6..df3c03aeaee5c12c5d57584535c9c7aa01be7dd3 100644
--- a/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;
@ -28,15 +28,17 @@ index ba13650b52e39c9cc5cfa421f7720c7d4ba75678..df3c03aeaee5c12c5d57584535c9c7aa
import java.io.StringReader;
import java.lang.reflect.Type;
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 javax.annotation.Nullable;
+
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
import net.minecraft.ChatFormatting;
+import net.minecraft.ChatFormatting;
import net.minecraft.Util;
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.resources.ResourceLocation;
import net.minecraft.util.FormattedCharSequence;
@ -47,7 +49,7 @@ index ba13650b52e39c9cc5cfa421f7720c7d4ba75678..df3c03aeaee5c12c5d57584535c9c7aa
import java.util.stream.Stream;
// 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 {
private static final Gson GSON = (new GsonBuilder()).disableHtmlEscaping().create();