Fix continueServerUpdate with 2-line subjects

This commit is contained in:
Jason Penilla 2024-04-23 14:26:28 -07:00
parent eb41348d39
commit 9cac5b6f4f
No known key found for this signature in database
GPG key ID: 0E75A301420E48F8
4 changed files with 26 additions and 14 deletions

View file

@ -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<String>()
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)
}
}

View file

@ -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);

View file

@ -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

View file

@ -6,12 +6,12 @@ Subject: [PATCH] Drop falling block and tnt entities at the specified height
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
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 {