9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00

Old Throwable Projectile tick order (#520)

This commit is contained in:
violetc
2025-07-01 01:32:30 +08:00
parent 550dba491b
commit cb64df44fa
2 changed files with 71 additions and 0 deletions

View File

@@ -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() {

View File

@@ -351,6 +351,9 @@ public final class LeavesConfig {
@GlobalConfig("disable-item-damage-check") @GlobalConfig("disable-item-damage-check")
public boolean disableItemDamageCheck = false; public boolean disableItemDamageCheck = false;
@GlobalConfig("old-throwable-projectile-tick-order")
public boolean oldThrowableProjectileTickOrder = false;
} }
public ElytraAeronauticsConfig elytraAeronautics = new ElytraAeronauticsConfig(); public ElytraAeronauticsConfig elytraAeronautics = new ElytraAeronauticsConfig();