use of forestry.core.models.TRSRBakedModel in project ForestryMC by ForestryMC.
the class ModelButterflyItem method bakeModel.
private IBakedModel bakeModel(IAlleleButterflySpecies species, float size) {
ImmutableMap<String, String> textures = ImmutableMap.of("butterfly", species.getItemTexture());
if (modelButterfly == null) {
try {
modelButterfly = ModelLoaderRegistry.getModel(new ResourceLocation(Constants.MOD_ID, "item/butterfly_ge"));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
IModel model = modelButterfly.retexture(textures);
IBakedModel bakedModel = model.bake(ModelRotation.X0_Y0, DefaultVertexFormats.ITEM, DefaultTextureGetter.INSTANCE);
float scale = 1F / 16F;
IModelState state = ModelUtil.loadModelState(new ResourceLocation(Constants.MOD_ID, "models/item/butterfly_ge"));
state = new ModelStateComposition(state, new SimpleModelState(getTransformations(size)));
return new PerspectiveMapWrapper(new TRSRBakedModel(bakedModel, -0.03125F, 0.25F - size * 0.37F, -0.03125F + size * scale, size * 1.4F), state);
}
use of forestry.core.models.TRSRBakedModel in project ForestryMC by ForestryMC.
the class ModelCrate method bakeModel.
/**
* Bake the crate model.
*/
private List<IBakedModel> bakeModel(ItemCrated crateItem) {
List<IBakedModel> models = new ArrayList<>();
ItemStack contained = crateItem.getContained();
if (!contained.isEmpty()) {
IBakedModel containedModel = getCustomContentModel(crateItem);
if (containedModel == null) {
containedModel = ModelUtil.getModel(contained);
}
models.add(new TRSRBakedModel(containedModel, -0.0625F, 0, 0.0625F, 0.5F));
models.add(new TRSRBakedModel(containedModel, -0.0625F, 0, -0.0625F, 0.5F));
}
return models;
}
Aggregations