use of forestry.api.arboriculture.IWoodItemMeshDefinition in project ForestryMC by ForestryMC.
the class ProxyArboricultureClient method onModelBake.
@SubscribeEvent
public <T extends Block & IWoodTyped> void onModelBake(ModelBakeEvent event) {
IRegistry<ModelResourceLocation, IBakedModel> registry = event.getModelRegistry();
for (WoodModelEntry<T> entry : woodModelEntrys) {
T woodTyped = entry.woodTyped;
WoodBlockKind woodKind = woodTyped.getBlockKind();
IWoodStateMapper woodMapper = stateMappers.get(woodTyped);
for (IBlockState blockState : woodTyped.getBlockState().getValidStates()) {
IWoodType woodType;
ItemStack itemStack;
if (entry.withVariants) {
int meta = woodTyped.getMetaFromState(blockState);
woodType = woodTyped.getWoodType(meta);
itemStack = new ItemStack(woodTyped, 1, meta);
} else {
woodType = woodTyped.getWoodType(0);
itemStack = new ItemStack(woodTyped);
}
IWoodItemMeshDefinition definition = shapers.get(itemStack.getItem());
ImmutableMap<String, String> textures = WoodTextureManager.getTextures(woodType, woodKind);
if (definition != null) {
retextureItemModel(registry, textures, woodType, woodKind, itemStack, definition);
}
if (woodMapper != null) {
retexturBlockModel(registry, textures, woodType, woodKind, blockState, woodMapper);
}
}
}
}
Aggregations