From 9cac5b6f4f1db5165a50b1bbdc00d51172213695 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Tue, 23 Apr 2024 14:26:28 -0700 Subject: [PATCH] Fix continueServerUpdate with 2-line subjects --- build.gradle.kts | 16 ++++++++++++++-- ...d-configurable-entity-despawn-distances.patch | 4 ++-- ...0035-Allow-for-toggling-of-spawn-chunks.patch | 4 ++-- ...block-and-tnt-entities-at-the-specified.patch | 16 ++++++++-------- 4 files changed, 26 insertions(+), 14 deletions(-) rename patches/{unapplied => }/server/0034-Add-configurable-entity-despawn-distances.patch (87%) rename patches/{unapplied => }/server/0035-Allow-for-toggling-of-spawn-chunks.patch (85%) rename patches/{unapplied => }/server/0036-Drop-falling-block-and-tnt-entities-at-the-specified.patch (83%) diff --git a/build.gradle.kts b/build.gradle.kts index 1c49486c94..ecfc0abe25 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -194,6 +194,7 @@ abstract class RebasePatches : BaseTask() { companion object { val regex = Pattern.compile("Patch failed at ([0-9]{4}) (.*)") + val continuationRegex = Pattern.compile("^\\s{1}.+\$") const val subjectPrefix = "Subject: [PATCH] " } @@ -223,8 +224,19 @@ abstract class RebasePatches : BaseTask() { val failedSubjectFragment = matcher.group(2) val failed = unapplied.single { p -> p.useLines { lines -> - val subjectLine = lines.single { it.startsWith(subjectPrefix) } - .substringAfter(subjectPrefix) + val collect = mutableListOf() + for (line in lines) { + if (line.startsWith(subjectPrefix)) { + collect += line + } else if (collect.size == 1) { + if (continuationRegex.matcher(line).matches()) { + collect += line + } else { + break + } + } + } + val subjectLine = collect.joinToString("").substringAfter(subjectPrefix) subjectLine.startsWith(failedSubjectFragment) } } diff --git a/patches/unapplied/server/0034-Add-configurable-entity-despawn-distances.patch b/patches/server/0034-Add-configurable-entity-despawn-distances.patch similarity index 87% rename from patches/unapplied/server/0034-Add-configurable-entity-despawn-distances.patch rename to patches/server/0034-Add-configurable-entity-despawn-distances.patch index e43e0a2d4c..0f39ee59b9 100644 --- a/patches/unapplied/server/0034-Add-configurable-entity-despawn-distances.patch +++ b/patches/server/0034-Add-configurable-entity-despawn-distances.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add configurable entity despawn distances diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 8395130fcc148ed1500342ead78b20a1387f23e9..1ab169b362cc18d2467e5ed6a4af325d7f6dd247 100644 +index af1d4cab8ffa3b20dc7aa3af5d1cf8039ef9736f..9dcd90b8e027075ccec0902bd1b13f82f6fe1bcd 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -854,14 +854,14 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -908,14 +908,14 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti if (entityhuman != null) { double d0 = entityhuman.distanceToSqr((Entity) this); diff --git a/patches/unapplied/server/0035-Allow-for-toggling-of-spawn-chunks.patch b/patches/server/0035-Allow-for-toggling-of-spawn-chunks.patch similarity index 85% rename from patches/unapplied/server/0035-Allow-for-toggling-of-spawn-chunks.patch rename to patches/server/0035-Allow-for-toggling-of-spawn-chunks.patch index 092af27d5c..3a1d7f94a7 100644 --- a/patches/unapplied/server/0035-Allow-for-toggling-of-spawn-chunks.patch +++ b/patches/server/0035-Allow-for-toggling-of-spawn-chunks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow for toggling of spawn chunks diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index d02cc220c8bd59a1289f34fd9fb70a00b0fbc07a..953ff52b6e6397a8f81b0935fc2fb8cfadf5cf40 100644 +index 5f881af95bd5ee94daadfd9e5d64ee6d411255c4..10e0630d30864f8d38434e58f43c63a6984b974b 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -264,6 +264,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -258,6 +258,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { }); // CraftBukkit end this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings diff --git a/patches/unapplied/server/0036-Drop-falling-block-and-tnt-entities-at-the-specified.patch b/patches/server/0036-Drop-falling-block-and-tnt-entities-at-the-specified.patch similarity index 83% rename from patches/unapplied/server/0036-Drop-falling-block-and-tnt-entities-at-the-specified.patch rename to patches/server/0036-Drop-falling-block-and-tnt-entities-at-the-specified.patch index e81eb5fef1..70612c5eb7 100644 --- a/patches/unapplied/server/0036-Drop-falling-block-and-tnt-entities-at-the-specified.patch +++ b/patches/server/0036-Drop-falling-block-and-tnt-entities-at-the-specified.patch @@ -6,12 +6,12 @@ Subject: [PATCH] Drop falling block and tnt entities at the specified height Co-authored-by: Jake Potrebic diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index 4d0fa6caf55605f2f53a374ce6bad0081213f248..9136b0c907d331e100d47e1a800ae2e2c2ec6dad 100644 +index 4ac7f43b834a2c761ad538f9d00afb2263ed7e4f..37dfd08621d402a339f36bb70f1b39de010e8669 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -143,6 +143,16 @@ public class FallingBlockEntity extends Entity { - } - +@@ -145,6 +145,16 @@ public class FallingBlockEntity extends Entity { + ++this.time; + this.applyGravity(); this.move(MoverType.SELF, this.getDeltaMovement()); + // Paper start - Configurable falling blocks height nerf + if (this.level().paperConfig().fixes.fallingBlockHeightNerf.test(v -> this.getY() > v)) { @@ -27,12 +27,12 @@ index 4d0fa6caf55605f2f53a374ce6bad0081213f248..9136b0c907d331e100d47e1a800ae2e2 BlockPos blockposition = this.blockPosition(); boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock; diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java -index 8d512e43cdae52c16d1bb7c4ad8b91a947fa367f..f068b57167b183e68db897c70036cdc366a83c98 100644 +index e4a7d4cda22106716897df964cd74d0bbccd6092..f127cac376cf4d0e585d12cd5976a3aee567403a 100644 --- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java @@ -78,6 +78,12 @@ public class PrimedTnt extends Entity implements TraceableEntity { - } - + if (this.level().spigotConfig.maxTntTicksPerTick > 0 && ++this.level().spigotConfig.currentPrimedTnt > this.level().spigotConfig.maxTntTicksPerTick) { return; } // Spigot + this.applyGravity(); this.move(MoverType.SELF, this.getDeltaMovement()); + // Paper start - Configurable TNT height nerf + if (this.level().paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) { @@ -44,7 +44,7 @@ index 8d512e43cdae52c16d1bb7c4ad8b91a947fa367f..f068b57167b183e68db897c70036cdc3 if (this.onGround()) { this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, -0.5D, 0.7D)); diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java -index 6e127279c78b490c5b6c87eb75f3cb991a1afee2..5e17947b256ea6622f9a9b3e51fa8e473fc909ed 100644 +index c112c4b103c34e05f4de973eec94a969f60b085e..b7036f8399e2500ba01736c6006b972f7ca4838e 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java @@ -54,6 +54,12 @@ public class MinecartTNT extends AbstractMinecart {