Fix phantom high speed by modifying the speed: Part 2 (#1682)

Co-authored-by: granny <contact@granny.dev>
This commit is contained in:
MXU
2025-06-30 03:05:11 +01:00
committed by GitHub
parent dfd8a7ad14
commit 04a9045d98
3 changed files with 37 additions and 10 deletions

View File

@@ -177,7 +177,7 @@ index f0c452ddc4b299a930de261722cc41a89aa78eeb..8e8ddab59de508c84c4182e105a11554
protected ParticleOptions getInkParticle() {
return ParticleTypes.GLOW_SQUID_INK;
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 96e47e6145a4cce8c154a05f9b155c1ba74bfa6a..d272f5e789cb6c03ede0bece14fc3fe976a02ff3 100644
index 96e47e6145a4cce8c154a05f9b155c1ba74bfa6a..388d2e87696d9d3ec265355ec3602a03aa3151bb 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -238,9 +238,9 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -210,7 +210,34 @@ index 96e47e6145a4cce8c154a05f9b155c1ba74bfa6a..d272f5e789cb6c03ede0bece14fc3fe9
@Override
protected void checkFallDamage(double y, boolean onGround, BlockState state, BlockPos pos) {
@@ -3629,8 +3630,10 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3026,6 +3027,26 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.move(MoverType.SELF, this.getDeltaMovement());
this.setDeltaMovement(this.getDeltaMovement().scale(0.5));
} else {
+ // Purpur start - Ridables
+ if (this.getRider() != null && this.isControllable()) {
+ float f = 0.91F;
+ if (this.onGround()) {
+ f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.91F;
+ }
+
+ float f1 = 0.16277137F / (f * f * f);
+ f = 0.91F;
+ if (this.onGround()) {
+ f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.91F;
+ }
+
+ this.moveRelative(this.onGround() ? 0.1F * f1 : 0.02F, relative);
+ this.move(MoverType.SELF, this.getDeltaMovement());
+ this.setDeltaMovement(this.getDeltaMovement().scale(f));
+ return;
+ }
+ // Purpur end - Ridables
+
this.moveRelative(amount, relative);
this.move(MoverType.SELF, this.getDeltaMovement());
this.setDeltaMovement(this.getDeltaMovement().scale(0.91F));
@@ -3629,8 +3650,10 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.pushEntities();
profilerFiller.pop();
// Paper start - Add EntityMoveEvent
@@ -223,7 +250,7 @@ index 96e47e6145a4cce8c154a05f9b155c1ba74bfa6a..d272f5e789cb6c03ede0bece14fc3fe9
Location from = new Location(this.level().getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
Location to = new Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
@@ -3640,6 +3643,21 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3640,6 +3663,21 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.absSnapTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
}
}
@@ -3813,7 +3840,7 @@ index 889c31cc9257fbbd5df8325ccee9ce39b026ec4b..4a1299d6cee2807522de0c2d0d4745c5
@Override
diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java
index 2abb55d84507fd29817760cb0068dd083f7f1c37..3b343c29b86292f5965a84bd180a7866e76bcac1 100644
index 2abb55d84507fd29817760cb0068dd083f7f1c37..855ec37a7e4110e37823ecf62f67f5cb3714f4bf 100644
--- a/net/minecraft/world/entity/monster/Phantom.java
+++ b/net/minecraft/world/entity/monster/Phantom.java
@@ -62,6 +62,52 @@ public class Phantom extends Mob implements Enemy {
@@ -3907,7 +3934,7 @@ index 2abb55d84507fd29817760cb0068dd083f7f1c37..3b343c29b86292f5965a84bd180a7866
+ this.setSpeed(speed);
+ Vec3 mot = this.getDeltaMovement();
+ this.move(net.minecraft.world.entity.MoverType.SELF, mot.multiply(speed, speed, speed));
+ this.setDeltaMovement(net.minecraft.world.phys.Vec3.ZERO);
+ this.setDeltaMovement(mot.scale(0.9D));
+ }
+ // Purpur end - Ridables
}