geforkt von Mirrors/FastAsyncWorldEdit
Be less lazy handling MobSpawnerBlock tags. (Although once again, no one should actually being using this class.)
Dieser Commit ist enthalten in:
Ursprung
77a2b998bd
Commit
94dbfa3b85
@ -147,8 +147,12 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
|
|||||||
values.put("MaxSpawnDelay", new ShortTag("MaxSpawnDelay", maxSpawnDelay));
|
values.put("MaxSpawnDelay", new ShortTag("MaxSpawnDelay", maxSpawnDelay));
|
||||||
values.put("MaxNearbyEntities", new ShortTag("MaxNearbyEntities", maxNearbyEntities));
|
values.put("MaxNearbyEntities", new ShortTag("MaxNearbyEntities", maxNearbyEntities));
|
||||||
values.put("RequiredPlayerRange", new ShortTag("RequiredPlayerRange", requiredPlayerRange));
|
values.put("RequiredPlayerRange", new ShortTag("RequiredPlayerRange", requiredPlayerRange));
|
||||||
values.put("SpawnData", new CompoundTag("SpawnData", spawnData == null ? null : spawnData.getValue()));
|
if (spawnData != null) {
|
||||||
values.put("SpawnPotentials", new ListTag("SpawnPotentials", CompoundTag.class, spawnPotentials == null ? null : spawnPotentials.getValue()));
|
values.put("SpawnData", new CompoundTag("SpawnData", spawnData.getValue()));
|
||||||
|
}
|
||||||
|
if (spawnPotentials != null) {
|
||||||
|
values.put("SpawnPotentials", new ListTag("SpawnPotentials", CompoundTag.class, spawnPotentials.getValue()));
|
||||||
|
}
|
||||||
|
|
||||||
return new CompoundTag(getNbtId(), values);
|
return new CompoundTag(getNbtId(), values);
|
||||||
}
|
}
|
||||||
@ -182,24 +186,53 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
|
|||||||
CompoundTag spawnDataTag = null;
|
CompoundTag spawnDataTag = null;
|
||||||
try {
|
try {
|
||||||
spawnCountTag = NBTUtils.getChildTag(values, "SpawnCount", ShortTag.class);
|
spawnCountTag = NBTUtils.getChildTag(values, "SpawnCount", ShortTag.class);
|
||||||
|
} catch (InvalidFormatException e) {};
|
||||||
|
try {
|
||||||
spawnRangeTag = NBTUtils.getChildTag(values, "SpawnRange", ShortTag.class);
|
spawnRangeTag = NBTUtils.getChildTag(values, "SpawnRange", ShortTag.class);
|
||||||
|
} catch (InvalidFormatException e) {};
|
||||||
|
try {
|
||||||
minSpawnDelayTag = NBTUtils.getChildTag(values, "MinSpawnDelay", ShortTag.class);
|
minSpawnDelayTag = NBTUtils.getChildTag(values, "MinSpawnDelay", ShortTag.class);
|
||||||
|
} catch (InvalidFormatException e) {};
|
||||||
|
try {
|
||||||
maxSpawnDelayTag = NBTUtils.getChildTag(values, "MaxSpawnDelay", ShortTag.class);
|
maxSpawnDelayTag = NBTUtils.getChildTag(values, "MaxSpawnDelay", ShortTag.class);
|
||||||
|
} catch (InvalidFormatException e) {};
|
||||||
|
try {
|
||||||
maxNearbyEntitiesTag = NBTUtils.getChildTag(values, "MaxNearbyEntities", ShortTag.class);
|
maxNearbyEntitiesTag = NBTUtils.getChildTag(values, "MaxNearbyEntities", ShortTag.class);
|
||||||
|
} catch (InvalidFormatException e) {};
|
||||||
|
try {
|
||||||
requiredPlayerRangeTag = NBTUtils.getChildTag(values, "RequiredPlayerRange", ShortTag.class);
|
requiredPlayerRangeTag = NBTUtils.getChildTag(values, "RequiredPlayerRange", ShortTag.class);
|
||||||
|
} catch (InvalidFormatException e) {};
|
||||||
|
try {
|
||||||
spawnPotentialsTag = NBTUtils.getChildTag(values, "SpawnPotentials", ListTag.class);
|
spawnPotentialsTag = NBTUtils.getChildTag(values, "SpawnPotentials", ListTag.class);
|
||||||
|
} catch (InvalidFormatException e) {};
|
||||||
|
try {
|
||||||
spawnDataTag = NBTUtils.getChildTag(values, "SpawnData", CompoundTag.class);
|
spawnDataTag = NBTUtils.getChildTag(values, "SpawnData", CompoundTag.class);
|
||||||
} catch (InvalidFormatException e) { // leave tag as null, handle later
|
} catch (InvalidFormatException e) {};
|
||||||
}
|
|
||||||
|
|
||||||
this.spawnCount = spawnCountTag == null ? null : spawnCountTag.getValue();
|
if (spawnCountTag != null) {
|
||||||
this.spawnRange = spawnRangeTag == null ? null : spawnRangeTag.getValue();
|
this.spawnCount = spawnCountTag.getValue();
|
||||||
this.minSpawnDelay = minSpawnDelayTag == null ? null : minSpawnDelayTag.getValue();
|
}
|
||||||
this.maxSpawnDelay = maxSpawnDelayTag == null ? null : maxSpawnDelayTag.getValue();
|
if (spawnRangeTag != null) {
|
||||||
this.maxNearbyEntities = maxNearbyEntitiesTag == null ? null : maxNearbyEntitiesTag.getValue();
|
this.spawnRange =spawnRangeTag.getValue();
|
||||||
this.requiredPlayerRange = requiredPlayerRangeTag == null ? null : requiredPlayerRangeTag.getValue();
|
}
|
||||||
this.spawnPotentials = new ListTag("SpawnPotentials", CompoundTag.class, spawnPotentialsTag == null ? null : spawnPotentialsTag.getValue());
|
if (minSpawnDelayTag != null) {
|
||||||
this.spawnData = new CompoundTag("SpawnData", spawnDataTag == null ? null : spawnDataTag.getValue());
|
this.minSpawnDelay = minSpawnDelayTag.getValue();
|
||||||
|
}
|
||||||
|
if (maxSpawnDelayTag != null) {
|
||||||
|
this.maxSpawnDelay = maxSpawnDelayTag.getValue();
|
||||||
|
}
|
||||||
|
if (maxNearbyEntitiesTag != null) {
|
||||||
|
this.maxNearbyEntities = maxNearbyEntitiesTag.getValue();
|
||||||
|
}
|
||||||
|
if (requiredPlayerRangeTag != null) {
|
||||||
|
this.requiredPlayerRange = requiredPlayerRangeTag.getValue();
|
||||||
|
}
|
||||||
|
if (spawnPotentialsTag != null) {
|
||||||
|
this.spawnPotentials = new ListTag("SpawnPotentials", CompoundTag.class, spawnPotentialsTag.getValue());
|
||||||
|
}
|
||||||
|
if (spawnDataTag != null) {
|
||||||
|
this.spawnData = new CompoundTag("SpawnData", spawnDataTag.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren