From 4558b84e30cb6d1ce216a4ad251f5b93d4d0d66b Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Thu, 12 Dec 2024 14:17:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E8=83=BD=E6=92=9E?= =?UTF-8?q?=E6=8E=89=E8=8D=B7=E5=8F=B6=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/entity/SpeedboatEntity.java | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java index 44f3d69fc..b4bd4781f 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java @@ -109,14 +109,13 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, } //TODO 创飞碰到的碰撞箱小于该船的实体,且本体速度不会减少太多 - public static boolean canVehicleCollide(Entity pVehicle, Entity pEntity) { return (pEntity.canBeCollidedWith() || pEntity.isPushable()) && !pVehicle.isPassengerOfSameVehicle(pEntity); } @Override public boolean canBeCollidedWith() { - return false; + return super.canBeCollidedWith(); } @Override @@ -256,7 +255,7 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, crushEntities(this.getDeltaMovement()); } - collBlock(); + collideBlock(); this.refreshDimensions(); } @@ -268,8 +267,8 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, double entitySize = entity.getBbWidth() * entity.getBbHeight(); double thisSize = this.getBbWidth() * this.getBbHeight(); - double f = Math.min(entitySize / thisSize, 2); - double f1 = thisSize / entitySize; + double f = Math.min(entitySize / thisSize, 2); + double f1 = thisSize / entitySize; entity.push(f1 * velAdd.x, f1 * velAdd.y, f1 * velAdd.z); this.push(-f * velAdd.x, -f * velAdd.y, -f * velAdd.z); @@ -277,15 +276,13 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, } } - public void collBlock() { + public void collideBlock() { AABB aabb = AABB.ofSize(new Vec3(this.getX(), this.getY() + this.getBbHeight() * 0.5, this.getZ()), 5, 2.6, 5); - BlockPos.betweenClosedStream(aabb).forEach((block) -> { - BlockState blockstate = this.level().getBlockState(block); + BlockPos.betweenClosedStream(aabb).forEach((pos) -> { + BlockState blockstate = this.level().getBlockState(pos); if (blockstate.is(Blocks.LILY_PAD)) { - BlockPos blockPos = BlockPos.containing(new Vec3(block.getX(), block.getY(), block.getY())); - this.level().destroyBlock(blockPos, true); + this.level().destroyBlock(pos, true); } - }); } @@ -336,7 +333,7 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, } private void handleSetDiffY(float diffY) { - this.entityData.set(DELTA_ROT, (float) Mth.clamp(diffY * 1.3 * Math.max(4 * this.getDeltaMovement().length(), 0.5), -2 ,2)); + this.entityData.set(DELTA_ROT, (float) Mth.clamp(diffY * 1.3 * Math.max(4 * this.getDeltaMovement().length(), 0.5), -2, 2)); } private void handleClientSync() { @@ -443,7 +440,6 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, this.clampRotation(entity); } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar data) {