mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-25 09:59:20 +00:00
fix: 修复异常弹跳
This commit is contained in:
@@ -52,13 +52,15 @@ public class BouncingBlockBehavior extends BukkitBlockBehavior {
|
||||
Object deltaMovement = FastNMS.INSTANCE.method$Entity$getDeltaMovement(entity);
|
||||
if (FastNMS.INSTANCE.field$Vec3$y(deltaMovement) < 0.0) {
|
||||
double d = CoreReflections.clazz$LivingEntity.isInstance(entity) ? 1.0 : 0.8;
|
||||
double y = -FastNMS.INSTANCE.field$Vec3$y(deltaMovement) * this.bounceHeight * d;
|
||||
System.out.println("deltaMovement=" + deltaMovement + ", d=" + d + ", y=" + y);
|
||||
FastNMS.INSTANCE.method$Entity$setDeltaMovement(
|
||||
entity,
|
||||
FastNMS.INSTANCE.field$Vec3$x(deltaMovement),
|
||||
-FastNMS.INSTANCE.field$Vec3$y(deltaMovement) * this.bounceHeight * d,
|
||||
y,
|
||||
FastNMS.INSTANCE.field$Vec3$z(deltaMovement)
|
||||
);
|
||||
if (this.syncPlayerSelf) {
|
||||
if (this.syncPlayerSelf && y > 0.06271) { // 不知道为什么会抖
|
||||
FastNMS.INSTANCE.field$Entity$hurtMarked(entity, true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user