调整快艇的乘客方法
This commit is contained in:
parent
40ba71674a
commit
8ff78be2cc
1 changed files with 8 additions and 5 deletions
|
@ -332,7 +332,7 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity,
|
||||||
gunnerAngle();
|
gunnerAngle();
|
||||||
gunnerFire();
|
gunnerFire();
|
||||||
|
|
||||||
testRiding();
|
attractEntity();
|
||||||
|
|
||||||
this.refreshDimensions();
|
this.refreshDimensions();
|
||||||
}
|
}
|
||||||
|
@ -575,15 +575,18 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 移除此方法
|
public boolean hasEnoughSpaceFor(Entity pEntity) {
|
||||||
public void testRiding() {
|
return pEntity.getBbWidth() < this.getBbWidth();
|
||||||
List<Entity> list = this.level().getEntities(this, this.getBoundingBox().inflate((double) 0.2F, (double) -0.01F, (double) 0.2F), EntitySelector.pushableBy(this));
|
}
|
||||||
|
|
||||||
|
public void attractEntity() {
|
||||||
|
List<Entity> list = this.level().getEntities(this, this.getBoundingBox().inflate(0.2F, -0.01F, 0.2F), EntitySelector.pushableBy(this));
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
boolean flag = !this.level().isClientSide && !(this.getControllingPassenger() instanceof Player);
|
boolean flag = !this.level().isClientSide && !(this.getControllingPassenger() instanceof Player);
|
||||||
|
|
||||||
for (Entity entity : list) {
|
for (Entity entity : list) {
|
||||||
if (!entity.hasPassenger(this)) {
|
if (!entity.hasPassenger(this)) {
|
||||||
if (flag && this.getPassengers().size() < this.getMaxPassengers() && !entity.isPassenger() && entity instanceof LivingEntity && !(entity instanceof WaterAnimal) && !(entity instanceof Player)) {
|
if (flag && this.getPassengers().size() < this.getMaxPassengers() && !entity.isPassenger() && this.hasEnoughSpaceFor(entity) && entity instanceof LivingEntity && !(entity instanceof WaterAnimal) && !(entity instanceof Player)) {
|
||||||
entity.startRiding(this);
|
entity.startRiding(this);
|
||||||
} else {
|
} else {
|
||||||
this.push(entity);
|
this.push(entity);
|
||||||
|
|
Loading…
Add table
Reference in a new issue