use of crafttweaker.mc1120.entity.MCEntityDefinition in project CraftTweaker by CraftTweaker.
the class MCGame method getEntity.
@Override
public IEntityDefinition getEntity(String entityName) {
for (IEntityDefinition ent : getEntities()) {
if (ent.getName().equalsIgnoreCase(entityName)) {
return ent;
}
}
boolean needsReloading = false;
for (ResourceLocation res : ForgeRegistries.ENTITIES.getKeys()) {
if (res.getResourcePath().equalsIgnoreCase(entityName)) {
needsReloading = true;
break;
}
}
if (needsReloading) {
ENTITY_DEFINITIONS.clear();
ForgeRegistries.ENTITIES.forEach((entry) -> ENTITY_DEFINITIONS.add(new MCEntityDefinition(entry)));
}
return getEntities().stream().filter(ent -> ent.getName().equals(entityName)).findFirst().orElse(null);
}
Aggregations