diff --git a/leaves-server/minecraft-patches/features/0132-Old-Throwable-Projectile-tick-order.patch b/leaves-server/minecraft-patches/features/0132-Old-Throwable-Projectile-tick-order.patch new file mode 100644 index 00000000..0bdab2cd --- /dev/null +++ b/leaves-server/minecraft-patches/features/0132-Old-Throwable-Projectile-tick-order.patch @@ -0,0 +1,68 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: violetc <58360096+s-yh-china@users.noreply.github.com> +Date: Tue, 1 Jul 2025 01:29:07 +0800 +Subject: [PATCH] Old Throwable Projectile tick order + + +diff --git a/net/minecraft/world/entity/projectile/ThrowableProjectile.java b/net/minecraft/world/entity/projectile/ThrowableProjectile.java +index 5104636be1de4bf1dc491673cad55854a106da53..5e45ce80ee2fcdba915e9be29fe2c6325dd338b3 100644 +--- a/net/minecraft/world/entity/projectile/ThrowableProjectile.java ++++ b/net/minecraft/world/entity/projectile/ThrowableProjectile.java +@@ -45,23 +45,43 @@ public abstract class ThrowableProjectile extends Projectile { + @Override + public void tick() { + this.handleFirstTickBubbleColumn(); +- this.applyGravity(); +- this.applyInertia(); +- HitResult hitResultOnMoveVector = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); +- Vec3 location; +- if (hitResultOnMoveVector.getType() != HitResult.Type.MISS) { +- location = hitResultOnMoveVector.getLocation(); ++ // Leaves start - old-throwable-projectile-tick-order // TODO - ? ++ if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.oldThrowableProjectileTickOrder) { ++ super.tick(); ++ HitResult hitResultOnMoveVector = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); ++ if (hitResultOnMoveVector.getType() != HitResult.Type.MISS) { ++ this.preHitTargetOrDeflectSelf(hitResultOnMoveVector); // CraftBukkit - projectile hit event ++ } ++ ++ Vec3 vec3 = this.getDeltaMovement(); ++ double d = this.getX() + vec3.x; ++ double e = this.getY() + vec3.y; ++ double f = this.getZ() + vec3.z; ++ this.updateRotation(); ++ this.applyInertia(); ++ this.applyGravity(); ++ this.setPos(d, e, f); ++ this.applyEffectsFromBlocks(); + } else { +- location = this.position().add(this.getDeltaMovement()); +- } ++ this.applyGravity(); ++ this.applyInertia(); ++ HitResult hitResultOnMoveVector = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); ++ Vec3 location; ++ if (hitResultOnMoveVector.getType() != HitResult.Type.MISS) { ++ location = hitResultOnMoveVector.getLocation(); ++ } else { ++ location = this.position().add(this.getDeltaMovement()); ++ } + +- this.setPos(location); +- this.updateRotation(); +- this.applyEffectsFromBlocks(); +- super.tick(); +- if (hitResultOnMoveVector.getType() != HitResult.Type.MISS && this.isAlive()) { +- this.preHitTargetOrDeflectSelf(hitResultOnMoveVector); // CraftBukkit - projectile hit event ++ this.setPos(location); ++ this.updateRotation(); ++ this.applyEffectsFromBlocks(); ++ super.tick(); ++ if (hitResultOnMoveVector.getType() != HitResult.Type.MISS && this.isAlive()) { ++ this.preHitTargetOrDeflectSelf(hitResultOnMoveVector); // CraftBukkit - projectile hit event ++ } + } ++ // Leaves end - old-throwable-projectile-tick-order + } + + private void applyInertia() { diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/LeavesConfig.java b/leaves-server/src/main/java/org/leavesmc/leaves/LeavesConfig.java index 8f7038af..fc73a01e 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/LeavesConfig.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/LeavesConfig.java @@ -351,6 +351,9 @@ public final class LeavesConfig { @GlobalConfig("disable-item-damage-check") public boolean disableItemDamageCheck = false; + + @GlobalConfig("old-throwable-projectile-tick-order") + public boolean oldThrowableProjectileTickOrder = false; } public ElytraAeronauticsConfig elytraAeronautics = new ElytraAeronauticsConfig();