From d4884cefc7bb9050f350ed5baf61bae08a0f43da Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Sun, 7 Jan 2024 15:15:59 -0600 Subject: [PATCH] Update Paper --- gradle.properties | 2 +- ...01-AdvancedSlimePaper-Server-Changes.patch | 8 +++--- patches/server/0003-UUID-validation.patch | 17 ----------- .../0004-ResourceLocation-validation.patch | 28 ++----------------- ...Removes-useless-spammy-error-logging.patch | 4 +-- ...ate-BlockState-and-SoundEvent-values.patch | 23 ++++----------- ...-handling-of-invalid-JSON-components.patch | 4 +-- ...tch-invalid-entity-rotation-log-spam.patch | 4 +-- 8 files changed, 19 insertions(+), 71 deletions(-) diff --git a/gradle.properties b/gradle.properties index 62c19b4..057c665 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ group=me.totalfreedom.scissors version=1.20.4-R0.1-SNAPSHOT mcVersion=1.20.4 -paperRef=1fa48d140c5469d894b436a7ba0cb5cb6f819ee0 +paperRef=07b956e3a30d9cd192111829b59bdf4372f128b1 org.gradle.caching=true org.gradle.parallel=true diff --git a/patches/server/0001-AdvancedSlimePaper-Server-Changes.patch b/patches/server/0001-AdvancedSlimePaper-Server-Changes.patch index dfcc4b3..073160f 100644 --- a/patches/server/0001-AdvancedSlimePaper-Server-Changes.patch +++ b/patches/server/0001-AdvancedSlimePaper-Server-Changes.patch @@ -1910,7 +1910,7 @@ index 6bc7c6f16a1649fc9e24e7cf90fca401e5bd4875..8bad563d6ff3ae3a41e7ff3170e4bce3 } diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkLoadTask.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkLoadTask.java -index e7fb084ddb88ab62f1d493a999cc82b9258d275e..943cdd570c9e5c87ee9f3984404e08b4cdffeca0 100644 +index 310e61db5d845f904119dcb84d981e7c608bf1a8..1ab142554a6593dac816c73d21f3757af6a23bf2 100644 --- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkLoadTask.java +++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkLoadTask.java @@ -6,6 +6,7 @@ import ca.spottedleaf.concurrentutil.lock.ReentrantAreaLock; @@ -2232,7 +2232,7 @@ index 44ada45d9bf2d9b48e5de1c3cb1a855902f3884b..869bb52fbdc4a5a96324e3cf5b6a3cd5 gameprofilerfiller.pop(); gameprofilerfiller.pop(); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 676087c3addd712939c865b39ddb5d9f0bc7ce25..ca309311928654ca7e971e98114d7c16d8341a55 100644 +index 7c31f619a6e8e3539c547fc43d821d2cce7df7e7..46f1793d86310036ed816487f7a1ad4e41d2f7c5 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -319,7 +319,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2494,7 +2494,7 @@ index 676087c3addd712939c865b39ddb5d9f0bc7ce25..ca309311928654ca7e971e98114d7c16 timings.worldSaveChunks.stopTiming(); // Paper }// Paper // Paper - rewrite chunk system - entity saving moved into ChunkHolder -@@ -1863,47 +1883,47 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1864,47 +1884,47 @@ public class ServerLevel extends Level implements WorldGenLevel { this.getChunkSource().blockChanged(pos); if(this.paperConfig().misc.updatePathfindingOnBlockUpdate) { // Paper - option to disable pathfinding updates @@ -2598,7 +2598,7 @@ index 16fbc633de3a1d9e5e8c65ae107397a6f0e50811..d04c0147a87d4b31e6b5b090abeec316 for(int i = 0; i < storage.getSize(); ++i) { T object = palette.valueFor(storage.get(i)); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 1379084a80ce25644f13736b4a5ee5fabbd9ec1f..464e1c7970af5aa06ef563b823d7fd8b2776f8f5 100644 +index daa7525074facfbf31c1183e872f083a02697700..71773432c4895a3893d6f7076328e1224404f6f1 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java @@ -1,6 +1,9 @@ diff --git a/patches/server/0003-UUID-validation.patch b/patches/server/0003-UUID-validation.patch index 6b7d031..58db905 100644 --- a/patches/server/0003-UUID-validation.patch +++ b/patches/server/0003-UUID-validation.patch @@ -4,23 +4,6 @@ Date: Sun, 10 Dec 2023 13:11:22 -0600 Subject: [PATCH] UUID validation -diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java -index b65dcff9812dbc3256c080ac264c4aafd83ce276..82b53a7bfb37bfa1752a016a8a454c0b994b9108 100644 ---- a/src/main/java/net/minecraft/nbt/NbtUtils.java -+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java -@@ -74,7 +74,11 @@ public final class NbtUtils { - UUID uUID = nbt.hasUUID("Id") ? nbt.getUUID("Id") : Util.NIL_UUID; - // Paper start - support string UUID's - if (nbt.contains("Id", Tag.TAG_STRING)) { -- uUID = UUID.fromString(nbt.getString("Id")); -+ // Scissors start - Validate String UUIDs in game profiles -+ try { -+ uUID = UUID.fromString(nbt.getString("Id")); -+ } catch (Exception ignored) {} -+ // Scissors end - } - // Paper end - String string = nbt.getString("Name"); 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 --- a/src/main/java/net/minecraft/network/chat/HoverEvent.java diff --git a/patches/server/0004-ResourceLocation-validation.patch b/patches/server/0004-ResourceLocation-validation.patch index 4d47c09..e9ba273 100644 --- a/patches/server/0004-ResourceLocation-validation.patch +++ b/patches/server/0004-ResourceLocation-validation.patch @@ -44,11 +44,11 @@ index 1f55185814125c691288294d18bf1580461c8066..259d65f8e21f9cf99585d416eafdc967 } diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index 940b8d0b89d7e55c938aefbe80ee71b0db3dacb8..297a214a7833fd67640c94352671483bc4fc8dd5 100644 +index 6cfce9755dd464a7afb01f9032e567ce3bcd5bc5..264c94f49035236e3584a3577f2516f0f430a552 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -593,7 +593,7 @@ public class EntityType implements FeatureElement, EntityTypeT - }), (entity) -> { +@@ -599,7 +599,7 @@ public class EntityType implements FeatureElement, EntityTypeT + if (generation) entity.generation = true; // Paper - add generation bool param entity.load(nbt); }, () -> { - EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id")); @@ -56,28 +56,6 @@ index 940b8d0b89d7e55c938aefbe80ee71b0db3dacb8..297a214a7833fd67640c94352671483b }); } -@@ -612,7 +612,7 @@ public class EntityType implements FeatureElement, EntityTypeT - } - - public static Optional> by(CompoundTag nbt) { -- return BuiltInRegistries.ENTITY_TYPE.getOptional(new ResourceLocation(nbt.getString("id"))); -+ return BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(nbt.getString("id"))); // Scissors - } - - @Nullable -diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index e0cf7771488ab0065708d68b4e8550b865af0ed4..0dbfa66c41ba8242b6389296d175d7d738aac3ca 100644 ---- a/src/main/java/net/minecraft/world/entity/Mob.java -+++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -620,7 +620,7 @@ public abstract class Mob extends LivingEntity implements Targeting { - - this.setLeftHanded(nbt.getBoolean("LeftHanded")); - if (nbt.contains("DeathLootTable", 8)) { -- this.lootTable = new ResourceLocation(nbt.getString("DeathLootTable")); -+ this.lootTable = ResourceLocation.tryParse(nbt.getString("DeathLootTable")); // Scissors - this.lootTableSeed = nbt.getLong("DeathLootTableSeed"); - } - 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 a18aadbf7ae83713e1f2b21553185d8000bc7699..f5ad7ddf13cbb6452c2927aef9b54eae3335b4c6 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/patches/server/0006-Removes-useless-spammy-error-logging.patch b/patches/server/0006-Removes-useless-spammy-error-logging.patch index 40bab92..4f2da2b 100644 --- a/patches/server/0006-Removes-useless-spammy-error-logging.patch +++ b/patches/server/0006-Removes-useless-spammy-error-logging.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Removes useless spammy error logging diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 182bc05a839781794188352120968fdf67e794e7..98118cadae93000192003b40e9051a6df216d197 100644 +index 91bbea5cb169f96910cc8661151c04dbff057091..84c9f2b09576046c138a11a835c9192a6e347c1d 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -1812,8 +1812,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1805,8 +1805,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { resource = CraftNamespacedKey.fromMinecraft(key); } } catch (IllegalArgumentException ex) { diff --git a/patches/server/0010-Validate-BlockState-and-SoundEvent-values.patch b/patches/server/0010-Validate-BlockState-and-SoundEvent-values.patch index c8fc971..f2e62be 100644 --- a/patches/server/0010-Validate-BlockState-and-SoundEvent-values.patch +++ b/patches/server/0010-Validate-BlockState-and-SoundEvent-values.patch @@ -5,28 +5,15 @@ 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 82b53a7bfb37bfa1752a016a8a454c0b994b9108..b8720020f98ea26da7d3225ddfbb1d9e80be4eb1 100644 +index 80083fed4b44b9d433925f09db83e559582109a1..032fc2add6c25780a3663fd1d2e429fcfd37dc4a 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 { - if (!nbt.contains("Name", 8)) { return Blocks.AIR.defaultBlockState(); } else { -- ResourceLocation resourceLocation = new ResourceLocation(nbt.getString("Name")); + // Paper start - Validate resource location +- ResourceLocation resourceLocation = ResourceLocation.tryParse(nbt.getString("Name")); + ResourceLocation resourceLocation = ResourceLocation.tryParse(nbt.getString("Name")); // Scissors - Validate BlockState - Optional> optional = blockLookup.get(ResourceKey.create(Registries.BLOCK, resourceLocation)); + Optional> optional = resourceLocation != null ? blockLookup.get(ResourceKey.create(Registries.BLOCK, resourceLocation)) : Optional.empty(); + // Paper end if (optional.isEmpty()) { - return Blocks.AIR.defaultBlockState(); -diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -index 42ebd91196ae420eee57f4380abc558555457163..8e81f50b52bc1d3eb25a842d1c41a7a18f53bf27 100644 ---- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -@@ -560,7 +560,7 @@ public abstract class AbstractArrow extends Projectile { - this.setCritArrow(nbt.getBoolean("crit")); - this.setPierceLevel(nbt.getByte("PierceLevel")); - if (nbt.contains("SoundEvent", 8)) { -- this.soundEvent = (SoundEvent) BuiltInRegistries.SOUND_EVENT.getOptional(new ResourceLocation(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent()); -+ this.soundEvent = (SoundEvent) BuiltInRegistries.SOUND_EVENT.getOptional(ResourceLocation.tryParse(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent()); // Scissors - Validate SoundEvents before trying to play them - } - - this.setShotFromCrossbow(nbt.getBoolean("ShotFromCrossbow")); diff --git a/patches/server/0013-Better-handling-of-invalid-JSON-components.patch b/patches/server/0013-Better-handling-of-invalid-JSON-components.patch index 0b7c484..4b8430e 100644 --- a/patches/server/0013-Better-handling-of-invalid-JSON-components.patch +++ b/patches/server/0013-Better-handling-of-invalid-JSON-components.patch @@ -93,10 +93,10 @@ index 186547674894fd084bceb478bb6017b747df4173..74c880425964da042ca57c097eb93273 } }).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 0c46a4aeafd03fbbfd590b0362d41bf2b1d5ca74..a8ae232f9ef204e6dd2f14c1e92008ceb7af7ab2 100644 +index 1be10c57e374ad4018c08d96cfb69397a2f541d3..2e11d0f17fc8fa4ed84c40dd9747e136675030a4 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2522,11 +2522,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -2526,11 +2526,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S if (nbt.contains("CustomName", 8)) { String s = nbt.getString("CustomName"); diff --git a/patches/server/0037-Patch-invalid-entity-rotation-log-spam.patch b/patches/server/0037-Patch-invalid-entity-rotation-log-spam.patch index 72fa154..e5fb78c 100644 --- a/patches/server/0037-Patch-invalid-entity-rotation-log-spam.patch +++ b/patches/server/0037-Patch-invalid-entity-rotation-log-spam.patch @@ -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 -index a8ae232f9ef204e6dd2f14c1e92008ceb7af7ab2..4f032b8303c6c1dc3c829c3c09009aaa0a5209fa 100644 +index 2e11d0f17fc8fa4ed84c40dd9747e136675030a4..acd0dcf69a23ec6dda8e58621b8634076ba8eec1 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -4734,7 +4734,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -4745,7 +4745,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S public void setXRot(float pitch) { if (!Float.isFinite(pitch)) {