if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("MobSpawner")) {
throw new RuntimeException("'MobSpawner' tile entity expected");
}
StringTag mobTypeTag;
ShortTag delayTag;
try {
mobTypeTag = NBTUtils.getChildTag(values, "EntityId", StringTag.class);
delayTag = NBTUtils.getChildTag(values, "Delay", ShortTag.class);
} catch (InvalidFormatException ignored) {
throw new RuntimeException("Invalid mob spawner data: no EntityId and/or no Delay");
}
this.mobType = mobTypeTag.getValue();
this.delay = delayTag.getValue();
ShortTag spawnCountTag = null;
ShortTag spawnRangeTag = null;
ShortTag minSpawnDelayTag = null;
ShortTag maxSpawnDelayTag = null;
ShortTag maxNearbyEntitiesTag = null;
ShortTag requiredPlayerRangeTag = null;
ListTag spawnPotentialsTag = null;
CompoundTag spawnDataTag = null;
try {
spawnCountTag = NBTUtils.getChildTag(values, "SpawnCount", ShortTag.class);
} catch (InvalidFormatException ignored) {
}
try {
spawnRangeTag = NBTUtils.getChildTag(values, "SpawnRange", ShortTag.class);
} catch (InvalidFormatException ignored) {
}
try {
minSpawnDelayTag = NBTUtils.getChildTag(values, "MinSpawnDelay", ShortTag.class);
} catch (InvalidFormatException ignored) {
}
try {
maxSpawnDelayTag = NBTUtils.getChildTag(values, "MaxSpawnDelay", ShortTag.class);
} catch (InvalidFormatException ignored) {
}
try {
maxNearbyEntitiesTag = NBTUtils.getChildTag(values, "MaxNearbyEntities", ShortTag.class);
} catch (InvalidFormatException ignored) {
}
try {
requiredPlayerRangeTag = NBTUtils.getChildTag(values, "RequiredPlayerRange", ShortTag.class);
} catch (InvalidFormatException ignored) {
}
try {
spawnPotentialsTag = NBTUtils.getChildTag(values, "SpawnPotentials", ListTag.class);
} catch (InvalidFormatException ignored) {
}
try {
spawnDataTag = NBTUtils.getChildTag(values, "SpawnData", CompoundTag.class);
} catch (InvalidFormatException ignored) {
}
if (spawnCountTag != null) {
this.spawnCount = spawnCountTag.getValue();
}
if (spawnRangeTag != null) {
this.spawnRange =spawnRangeTag.getValue();
}
if (minSpawnDelayTag != null) {
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(CompoundTag.class, spawnPotentialsTag.getValue());
}
if (spawnDataTag != null) {