傻逼UUID😅

This commit is contained in:
Light_Quanta 2025-07-16 04:25:29 +08:00
parent d57bd9016a
commit b4ea5bb23a
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
6 changed files with 59 additions and 26 deletions

View file

@ -1,5 +1,6 @@
package com.atsuishio.superbwarfare.entity; package com.atsuishio.superbwarfare.entity;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModDamageTypes;
import com.atsuishio.superbwarfare.init.ModEntities; import com.atsuishio.superbwarfare.init.ModEntities;
@ -125,10 +126,15 @@ public class Blu43Entity extends Entity implements GeoEntity, OwnableEntity {
} else { } else {
String s = compound.getString("Owner"); String s = compound.getString("Owner");
if (this.getServer() == null) { try {
uuid = UUID.fromString(s); if (this.getServer() == null) {
} else { uuid = UUID.fromString(s);
uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); } else {
uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s);
}
} catch (Exception exception) {
Mod.LOGGER.error("Couldn't load owner UUID of {}: {}", this, exception);
uuid = null;
} }
} }

View file

@ -130,10 +130,15 @@ public class ClaymoreEntity extends Entity implements GeoEntity, OwnableEntity {
} else { } else {
String s = compound.getString("Owner"); String s = compound.getString("Owner");
if (this.getServer() == null) { try {
uuid = UUID.fromString(s); if (this.getServer() == null) {
} else { uuid = UUID.fromString(s);
uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); } else {
uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s);
}
} catch (Exception exception) {
Mod.LOGGER.error("Couldn't load owner UUID of {}: {}", this, exception);
uuid = null;
} }
} }

View file

@ -1,5 +1,6 @@
package com.atsuishio.superbwarfare.entity; package com.atsuishio.superbwarfare.entity;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModDamageTypes;
@ -134,10 +135,15 @@ public class Tm62Entity extends Entity implements GeoEntity, OwnableEntity {
} else { } else {
String s = compound.getString("Owner"); String s = compound.getString("Owner");
if (this.getServer() == null) { try {
uuid = UUID.fromString(s); if (this.getServer() == null) {
} else { uuid = UUID.fromString(s);
uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); } else {
uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s);
}
} catch (Exception exception) {
Mod.LOGGER.error("Couldn't load owner UUID of {}: {}", this, exception);
uuid = null;
} }
} }

View file

@ -1,5 +1,6 @@
package com.atsuishio.superbwarfare.entity.projectile; package com.atsuishio.superbwarfare.entity.projectile;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.config.server.ExplosionConfig; import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModDamageTypes;
import com.atsuishio.superbwarfare.init.ModEntities; import com.atsuishio.superbwarfare.init.ModEntities;
@ -144,10 +145,15 @@ public class C4Entity extends Entity implements GeoEntity, OwnableEntity {
} else { } else {
String s = compound.getString("Owner"); String s = compound.getString("Owner");
if (this.getServer() == null) { try {
uuid = UUID.fromString(s); if (this.getServer() == null) {
} else { uuid = UUID.fromString(s);
uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); } else {
uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s);
}
} catch (Exception exception) {
Mod.LOGGER.error("Couldn't load owner UUID of {}: {}", this, exception);
uuid = null;
} }
} }

View file

@ -110,7 +110,7 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
} }
@Override @Override
public void addAdditionalSaveData(CompoundTag compound) { public void addAdditionalSaveData(@NotNull CompoundTag compound) {
super.addAdditionalSaveData(compound); super.addAdditionalSaveData(compound);
compound.putInt("AnimTime", this.entityData.get(ANIM_TIME)); compound.putInt("AnimTime", this.entityData.get(ANIM_TIME));
compound.putBoolean("Active", this.entityData.get(ACTIVE)); compound.putBoolean("Active", this.entityData.get(ACTIVE));
@ -120,7 +120,7 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
} }
@Override @Override
public void readAdditionalSaveData(CompoundTag compound) { public void readAdditionalSaveData(@NotNull CompoundTag compound) {
super.readAdditionalSaveData(compound); super.readAdditionalSaveData(compound);
this.entityData.set(ANIM_TIME, compound.getInt("AnimTime")); this.entityData.set(ANIM_TIME, compound.getInt("AnimTime"));
this.entityData.set(ACTIVE, compound.getBoolean("Active")); this.entityData.set(ACTIVE, compound.getBoolean("Active"));
@ -131,10 +131,15 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
} else { } else {
String s = compound.getString("Owner"); String s = compound.getString("Owner");
if (this.getServer() == null) { try {
uuid = UUID.fromString(s); if (this.getServer() == null) {
} else { uuid = UUID.fromString(s);
uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); } else {
uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s);
}
} catch (Exception exception) {
Mod.LOGGER.error("Couldn't load owner UUID of {}: {}", this, exception);
uuid = null;
} }
} }

View file

@ -110,10 +110,15 @@ public class LaserTowerEntity extends VehicleEntity implements GeoEntity, Ownabl
} else { } else {
String s = compound.getString("Owner"); String s = compound.getString("Owner");
if (this.getServer() == null) { try {
uuid = UUID.fromString(s); if (this.getServer() == null) {
} else { uuid = UUID.fromString(s);
uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s); } else {
uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s);
}
} catch (Exception exception) {
Mod.LOGGER.error("Couldn't load owner UUID of {}: {}", this, exception);
uuid = null;
} }
} }