From 409504ac6d049d737f544c5585da2e09366fcf3d Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Fri, 3 Jan 2025 21:27:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D=E8=BD=BD?= =?UTF-8?q?=E5=85=B7=E4=B9=98=E5=9D=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/entity/SpeedboatEntity.java | 4 ---- .../superbwarfare/entity/VehicleEntity.java | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java index 751ac2bf5..70ef3b51b 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java @@ -542,10 +542,6 @@ public class SpeedboatEntity extends MobileVehicleEntity implements GeoEntity, I } @Override - protected boolean canAddPassenger(Entity pPassenger) { - return this.getPassengers().size() < this.getMaxPassengers(); - } - public int getMaxPassengers() { return 5; } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/VehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/VehicleEntity.java index 5e006d059..4b1eb8f7e 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/VehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/VehicleEntity.java @@ -117,6 +117,11 @@ public class VehicleEntity extends Entity { player.setYRot(this.getYRot()); return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS; } + if (this.getPassengers().size() < this.getMaxPassengers()) { + player.setXRot(this.getXRot()); + player.setYRot(this.getYRot()); + return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS; + } } } else if (!this.level().isClientSide) { if (this.getFirstPassenger() == null) { @@ -129,6 +134,11 @@ public class VehicleEntity extends Entity { player.setYRot(this.getYRot()); return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS; } + if (this.getPassengers().size() < this.getMaxPassengers()) { + player.setXRot(this.getXRot()); + player.setYRot(this.getYRot()); + return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS; + } } return InteractionResult.PASS; } @@ -208,6 +218,15 @@ public class VehicleEntity extends Entity { return hasPassenger(attacker) || super.skipAttackInteraction(attacker); } + @Override + protected boolean canAddPassenger(Entity pPassenger) { + return this.getPassengers().size() < this.getMaxPassengers(); + } + + public int getMaxPassengers() { + return 1; + } + @Override public void baseTick() { super.baseTick();