use of net.minecraftforge.client.model.SimpleModelState 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 net.minecraftforge.client.model.SimpleModelState in project HorsePower by GoryMoon.
the class BakedChopperModel method getActualModel.
protected IBakedModel getActualModel(String texture, String top_texture, EnumFacing facing) {
IBakedModel bakedModel = standard;
if (texture != null) {
if (cache.containsKey(texture)) {
bakedModel = cache.get(texture);
} else if (choppingModel != null) {
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
builder.put("2", texture);
builder.put("1", top_texture);
IModel retexturedModel = choppingModel.retexture(builder.build());
IModelState modelState = new SimpleModelState(transforms);
bakedModel = retexturedModel.bake(modelState, format, textureGetter);
cache.put(texture, bakedModel);
}
}
final IBakedModel parentModel = bakedModel;
try {
bakedModel = tableCombinedCache.get(new TableCombinationCacheKey(bakedModel, facing), () -> getCombinedBakedModel(facing, parentModel));
} catch (ExecutionException ignored) {
}
return bakedModel;
}
use of net.minecraftforge.client.model.SimpleModelState in project Binnie by ForestryMC.
the class ModelManager method mergeStates.
private static IModelState mergeStates(IModelState state, IModelState secondaryState) {
Map<TransformType, TRSRTransformation> tMap = Maps.newHashMap();
TRSRTransformation guiTransformation = secondaryState.apply(Optional.of(TransformType.GUI)).get();
tMap.putAll(PerspectiveMapWrapper.getTransforms(state));
tMap.put(TransformType.GUI, guiTransformation);
return new SimpleModelState(ImmutableMap.copyOf(tMap));
}
use of net.minecraftforge.client.model.SimpleModelState in project Railcraft by Railcraft.
the class Transforms method getItem.
public static IModelState getItem() {
TRSRTransformation thirdPerson = get(0, 3, 1, 0, 0, 0, 0.55f);
TRSRTransformation firstPerson = get(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f);
ImmutableMap.Builder<ItemCameraTransforms.TransformType, TRSRTransformation> builder = ImmutableMap.builder();
builder.put(ItemCameraTransforms.TransformType.GROUND, get(0, 2, 0, 0, 0, 0, 0.5f));
builder.put(ItemCameraTransforms.TransformType.HEAD, get(0, 13, 7, 0, 180, 0, 1));
builder.put(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, thirdPerson);
builder.put(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, leftify(thirdPerson));
builder.put(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, firstPerson);
builder.put(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, leftify(firstPerson));
return new SimpleModelState(builder.build());
}
Aggregations