use of binnie.core.models.DoublePassBakedModel in project Binnie by ForestryMC.
the class ModuleWood method onBakedEvent.
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onBakedEvent(ModelBakeEvent e) {
// Find all ExtraTrees saplings
List<ModelResourceLocation> models = e.getModelRegistry().getKeys().stream().filter(mrl -> mrl.getResourceDomain().startsWith(Constants.EXTRA_TREES_MOD_ID)).filter(mrl -> mrl.getResourcePath().startsWith("germlings")).collect(Collectors.toList());
// Replace model
Map<String, ETTreeDefinition> map = Arrays.stream(ETTreeDefinition.values()).collect(Collectors.toMap(o -> o.name().toLowerCase(), o -> o));
models.forEach(model -> {
String species = model.getVariant().split("=")[1];
ETTreeDefinition treeSpecies = map.get(species);
int primaryColor = treeSpecies.getLeafColor().getRGB();
int secondaryColor = treeSpecies.getWoodColor().getRGB();
IBakedModel bakedModel = e.getModelRegistry().getObject(model);
if (bakedModel == null) {
return;
}
e.getModelRegistry().putObject(model, new DoublePassBakedModel(bakedModel, primaryColor, secondaryColor));
});
}
Aggregations