优化投弹实体数据读取
This commit is contained in:
parent
f510ca7d5d
commit
7b1a78560d
2 changed files with 21 additions and 7 deletions
|
@ -38,18 +38,34 @@ public class DroneAttachmentData implements IDBasedData {
|
|||
return (this.dropPosition != null && this.dropPosition.length < 3) ? new float[]{0, -0.09f, 0} : this.dropPosition;
|
||||
}
|
||||
|
||||
@SerializedName("Data")
|
||||
public JsonObject data;
|
||||
|
||||
/**
|
||||
* 无人机显示的挂载实体的实体数据
|
||||
*/
|
||||
@SerializedName("DisplayData")
|
||||
public JsonObject displayData;
|
||||
private JsonObject displayData;
|
||||
|
||||
/**
|
||||
* 无人机投弹实体的实体数据
|
||||
*/
|
||||
@SerializedName("DropData")
|
||||
public JsonObject dropData;
|
||||
private JsonObject dropData;
|
||||
|
||||
public JsonObject displayData() {
|
||||
if (this.data != null) {
|
||||
return this.data;
|
||||
}
|
||||
return this.displayData != null ? this.displayData : this.dropData;
|
||||
}
|
||||
|
||||
public JsonObject dropData() {
|
||||
if (this.data != null) {
|
||||
return this.data;
|
||||
}
|
||||
return this.dropData != null ? this.dropData : this.displayData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
|
@ -75,8 +91,6 @@ public class DroneAttachmentData implements IDBasedData {
|
|||
@SerializedName("ExplosionRadius")
|
||||
public float explosionRadius = 0;
|
||||
|
||||
// TODO 其他挂载设置
|
||||
|
||||
// display settings
|
||||
|
||||
@SerializedName("Scale")
|
||||
|
|
|
@ -267,7 +267,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
|||
projectile.setOwner(player);
|
||||
}
|
||||
|
||||
var tag = TagDataParser.parse(data.dropData, name -> {
|
||||
var tag = TagDataParser.parse(data.dropData(), name -> {
|
||||
if (player == null) return StringTag.valueOf(name);
|
||||
|
||||
var uuid = player.getUUID();
|
||||
|
@ -412,8 +412,8 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
|||
var offset = attachmentData.offset();
|
||||
var rotation = attachmentData.rotation();
|
||||
|
||||
if (attachmentData.displayData != null) {
|
||||
this.entityData.set(DISPLAY_ENTITY_TAG, TagDataParser.parse(attachmentData.displayData));
|
||||
if (attachmentData.displayData() != null) {
|
||||
this.entityData.set(DISPLAY_ENTITY_TAG, TagDataParser.parse(attachmentData.displayData()));
|
||||
}
|
||||
|
||||
this.entityData.set(DISPLAY_DATA, List.of(
|
||||
|
|
Loading…
Add table
Reference in a new issue