修复getUUID各种可能的NPE情况
This commit is contained in:
parent
661dd7e106
commit
81582c4e16
5 changed files with 16 additions and 7 deletions
|
@ -54,7 +54,9 @@ public class Blu43Entity extends Entity implements GeoEntity, OwnableEntity {
|
|||
|
||||
public Blu43Entity(LivingEntity owner, Level level) {
|
||||
super(ModEntities.BLU_43.get(), level);
|
||||
this.setOwnerUUID(owner.getUUID());
|
||||
if (owner != null) {
|
||||
this.setOwnerUUID(owner.getUUID());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -55,7 +55,9 @@ public class ClaymoreEntity extends Entity implements GeoEntity, OwnableEntity {
|
|||
|
||||
public ClaymoreEntity(LivingEntity owner, Level level) {
|
||||
super(ModEntities.CLAYMORE.get(), level);
|
||||
this.setOwnerUUID(owner.getUUID());
|
||||
if (owner != null) {
|
||||
this.setOwnerUUID(owner.getUUID());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -55,7 +55,9 @@ public class Tm62Entity extends Entity implements GeoEntity, OwnableEntity {
|
|||
|
||||
public Tm62Entity(LivingEntity owner, Level level, boolean fuse) {
|
||||
super(ModEntities.TM_62.get(), level);
|
||||
this.setOwnerUUID(owner.getUUID());
|
||||
if (owner != null) {
|
||||
this.setOwnerUUID(owner.getUUID());
|
||||
}
|
||||
this.entityData.set(FUSE, fuse);
|
||||
}
|
||||
|
||||
|
|
|
@ -70,13 +70,14 @@ public class C4Entity extends Entity implements GeoEntity, OwnableEntity {
|
|||
}
|
||||
|
||||
public C4Entity(LivingEntity owner, Level level) {
|
||||
super(ModEntities.C_4.get(), level);
|
||||
this.setOwnerUUID(owner.getUUID());
|
||||
this(owner, level, false);
|
||||
}
|
||||
|
||||
public C4Entity(LivingEntity owner, Level level, boolean isControllable) {
|
||||
super(ModEntities.C_4.get(), level);
|
||||
this.setOwnerUUID(owner.getUUID());
|
||||
if (owner != null) {
|
||||
this.setOwnerUUID(owner.getUUID());
|
||||
}
|
||||
this.entityData.set(IS_CONTROLLABLE, isControllable);
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,9 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
|
|||
|
||||
public LaserTowerEntity(LivingEntity owner, Level level) {
|
||||
super(ModEntities.LASER_TOWER.get(), level);
|
||||
this.setOwnerUUID(owner.getUUID());
|
||||
if (owner != null) {
|
||||
this.setOwnerUUID(owner.getUUID());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isOwnedBy(LivingEntity pEntity) {
|
||||
|
|
Loading…
Add table
Reference in a new issue