尝试修复载具乘坐问题
This commit is contained in:
parent
8b1f04537c
commit
409504ac6d
2 changed files with 19 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue