修复一个可能导致玩家卡在载具上的问题
This commit is contained in:
parent
7516a365a6
commit
3a36293ae6
17 changed files with 54 additions and 17 deletions
|
@ -264,8 +264,8 @@ public class MortarEntity extends VehicleEntity implements GeoEntity {
|
|||
ItemEntity mortar = new ItemEntity(level, x, (y + 1), z, new ItemStack(ModItems.MORTAR_DEPLOYER.get()));
|
||||
mortar.setPickUpDelay(10);
|
||||
level.addFreshEntity(mortar);
|
||||
this.discard();
|
||||
}
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -603,7 +603,7 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
|||
explosion.finalizeExplosion(false);
|
||||
ParticleTool.spawnHugeExplosionParticles(this.level(), this.position());
|
||||
}
|
||||
this.discard();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -491,7 +491,7 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
|||
explosion.finalizeExplosion(false);
|
||||
ParticleTool.spawnHugeExplosionParticles(this.level(), this.position());
|
||||
}
|
||||
this.discard();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -452,7 +452,7 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
|||
}
|
||||
|
||||
explodePassengers();
|
||||
this.discard();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -616,7 +616,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
|||
}
|
||||
|
||||
explodePassengers();
|
||||
this.discard();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
protected void clampRotation(Entity entity) {
|
||||
|
|
|
@ -576,7 +576,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
|||
});
|
||||
}
|
||||
|
||||
this.discard();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
private void kamikazeExplosion(int mode) {
|
||||
|
|
|
@ -429,7 +429,7 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
|||
}
|
||||
|
||||
explodePassengers();
|
||||
this.discard();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -231,7 +231,7 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
|
|||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||
}
|
||||
|
||||
this.discard();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
public void autoAim() {
|
||||
|
|
|
@ -488,7 +488,7 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
|||
}
|
||||
|
||||
explodePassengers();
|
||||
this.discard();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
protected void clampRotation(Entity entity) {
|
||||
|
|
|
@ -264,7 +264,7 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
|||
}
|
||||
|
||||
explodePassengers();
|
||||
this.discard();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -291,7 +291,7 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
|||
}
|
||||
|
||||
explodePassengers();
|
||||
this.discard();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -664,7 +664,7 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
|
|||
}
|
||||
|
||||
explodePassengers();
|
||||
this.discard();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
protected void clampRotation(Entity entity) {
|
||||
|
|
|
@ -390,7 +390,7 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo
|
|||
}
|
||||
|
||||
explodePassengers();
|
||||
this.discard();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
protected void clampRotation(Entity entity) {
|
||||
|
|
|
@ -308,7 +308,6 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
|||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
if (this.crash) {
|
||||
crashPassengers();
|
||||
} else {
|
||||
|
@ -335,7 +334,7 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
|||
}
|
||||
}
|
||||
|
||||
this.discard();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -290,7 +290,7 @@ public class WheelChairEntity extends MobileVehicleEntity implements GeoEntity {
|
|||
ParticleTool.spawnSmallExplosionParticles(this.level(), this.position());
|
||||
}
|
||||
|
||||
this.discard();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -942,7 +942,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
|||
}
|
||||
|
||||
explodePassengers();
|
||||
this.discard();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
protected void clampRotation(Entity entity) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.atsuishio.superbwarfare.entity.vehicle.base;
|
|||
|
||||
import com.atsuishio.superbwarfare.Mod;
|
||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
import com.atsuishio.superbwarfare.entity.mixin.CustomStopRiding;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
||||
|
@ -718,6 +719,15 @@ public abstract class VehicleEntity extends Entity {
|
|||
}
|
||||
|
||||
public void destroy() {
|
||||
this.getPassengers().forEach(p -> {
|
||||
if (p instanceof Player player) {
|
||||
CustomStopRiding customStopRiding = CustomStopRiding.getInstance(player);
|
||||
customStopRiding.superbwarfare$stopRiding();
|
||||
} else {
|
||||
p.stopRiding();
|
||||
}
|
||||
});
|
||||
this.discard();
|
||||
}
|
||||
|
||||
protected Entity getAttacker() {
|
||||
|
@ -970,6 +980,34 @@ public abstract class VehicleEntity extends Entity {
|
|||
return getEyePosition();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ejectPassengers() {
|
||||
for(int i = this.passengers.size() - 1; i >= 0; --i) {
|
||||
var passenger = this.passengers.get(i);
|
||||
if (passenger instanceof Player player) {
|
||||
CustomStopRiding stopRiding = CustomStopRiding.getInstance(player);
|
||||
stopRiding.superbwarfare$stopRiding();
|
||||
} else {
|
||||
passenger.stopRiding();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void remove(RemovalReason pReason) {
|
||||
// if (this.getRemovalReason() == null) {
|
||||
// this.removalReason = pReason;
|
||||
// }
|
||||
//
|
||||
// if (this.getRemovalReason().shouldDestroy()) {
|
||||
// this.stopRiding();
|
||||
// }
|
||||
//
|
||||
// this.getPassengers().forEach(Entity::stopRiding);
|
||||
// this.levelCallback.onRemove(pReason);
|
||||
// this.invalidateCaps();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 渲染载具的第一人称UI
|
||||
* 务必标记 @OnlyIn(Dist.CLIENT) !
|
||||
|
|
Loading…
Add table
Reference in a new issue