NPE nmsl
This commit is contained in:
parent
99a2482f7f
commit
e1273d2cc2
1 changed files with 9 additions and 6 deletions
|
@ -483,6 +483,8 @@ public abstract class VehicleEntity extends Entity {
|
||||||
if (source.getDirectEntity() instanceof Projectile projectile && this instanceof OBBEntity) {
|
if (source.getDirectEntity() instanceof Projectile projectile && this instanceof OBBEntity) {
|
||||||
OBBHitter accessor = OBBHitter.getInstance(projectile);
|
OBBHitter accessor = OBBHitter.getInstance(projectile);
|
||||||
var part = accessor.sbw$getCurrentHitPart();
|
var part = accessor.sbw$getCurrentHitPart();
|
||||||
|
|
||||||
|
if (part != null) {
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case TURRET -> entityData.set(TURRET_HEALTH, entityData.get(TURRET_HEALTH) - computedAmount);
|
case TURRET -> entityData.set(TURRET_HEALTH, entityData.get(TURRET_HEALTH) - computedAmount);
|
||||||
case WHEEL_LEFT -> entityData.set(L_WHEEL_HEALTH, entityData.get(L_WHEEL_HEALTH) - computedAmount);
|
case WHEEL_LEFT -> entityData.set(L_WHEEL_HEALTH, entityData.get(L_WHEEL_HEALTH) - computedAmount);
|
||||||
|
@ -491,6 +493,7 @@ public abstract class VehicleEntity extends Entity {
|
||||||
case ENGINE2 -> entityData.set(L_ENGINE_HEALTH, entityData.get(L_ENGINE_HEALTH) - computedAmount);
|
case ENGINE2 -> entityData.set(L_ENGINE_HEALTH, entityData.get(L_ENGINE_HEALTH) - computedAmount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.onHurt(computedAmount, source.getEntity(), true);
|
this.onHurt(computedAmount, source.getEntity(), true);
|
||||||
return super.hurt(source, computedAmount);
|
return super.hurt(source, computedAmount);
|
||||||
|
|
Loading…
Add table
Reference in a new issue