use of net.minecraft.world.level.biome.MobSpawnSettings in project Denizen-For-Bukkit by DenizenScript.
the class BiomeNMSImpl method getSpawnableEntities.
private List<EntityType> getSpawnableEntities(MobCategory creatureType) {
MobSpawnSettings mobs = biomeBase.getMobSettings();
WeightedRandomList<MobSpawnSettings.SpawnerData> typeSettingList = mobs.getMobs(creatureType);
List<EntityType> entityTypes = new ArrayList<>();
if (typeSettingList == null) {
return entityTypes;
}
for (MobSpawnSettings.SpawnerData meta : typeSettingList.unwrap()) {
try {
String n = net.minecraft.world.entity.EntityType.getKey(meta.type).getPath();
EntityType et = EntityType.fromName(n);
if (et == null) {
et = EntityType.valueOf(n.toUpperCase(Locale.ENGLISH));
}
entityTypes.add(et);
} catch (Throwable e) {
// Ignore the error. Likely from invalid entity type name output.
}
}
return entityTypes;
}
use of net.minecraft.world.level.biome.MobSpawnSettings in project Denizen-For-Bukkit by DenizenScript.
the class BiomeNMSImpl method getSpawnableEntities.
private List<EntityType> getSpawnableEntities(MobCategory creatureType) {
MobSpawnSettings mobs = biomeBase.getMobSettings();
WeightedRandomList<MobSpawnSettings.SpawnerData> typeSettingList = mobs.getMobs(creatureType);
List<EntityType> entityTypes = new ArrayList<>();
if (typeSettingList == null) {
return entityTypes;
}
for (MobSpawnSettings.SpawnerData meta : typeSettingList.unwrap()) {
try {
String n = net.minecraft.world.entity.EntityType.getKey(meta.type).getPath();
EntityType et = EntityType.fromName(n);
if (et == null) {
et = EntityType.valueOf(n.toUpperCase(Locale.ENGLISH));
}
entityTypes.add(et);
} catch (Throwable e) {
// Ignore the error. Likely from invalid entity type name output.
}
}
return entityTypes;
}
Aggregations