use of pl.asie.charset.lib.render.model.WrappedBakedModel in project Charset by CharsetMC.
the class ModelShelf method bake.
@Override
public IBakedModel bake(ShelfCacheInfo info, boolean isItem, BlockRenderLayer layer) {
IModel retexturedModel = (shelfModel.retexture(ImmutableMap.of("plank", info.plank.getIconName()))).uvlock(false);
IModelState state = ModelRotation.getModelRotation(0, (int) info.facing.getHorizontalAngle());
if (info.back) {
state = new ModelStateComposition(state, STATE_BACK);
}
return new WrappedBakedModel(retexturedModel.bake(state, DefaultVertexFormats.BLOCK, ModelLoader.defaultTextureGetter()), info.plank).addDefaultBlockTransforms();
}
use of pl.asie.charset.lib.render.model.WrappedBakedModel in project Charset by CharsetMC.
the class BarrelModel method bake.
@Override
public IBakedModel bake(BarrelCacheInfo info, boolean isItem, BlockRenderLayer layer) {
TextureAtlasSprite log = info.log;
TextureAtlasSprite plank = info.plank;
TextureAtlasSprite top = info.isMetal ? this.top_metal : this.top;
TextureAtlasSprite front = this.front;
TextureAtlasSprite side = this.side;
if (info.upgrades.contains(BarrelUpgrade.STICKY)) {
side = this.side_sticky;
front = info.upgrades.contains(BarrelUpgrade.SILKY) ? this.front_silky_sticky : this.front_sticky;
} else if (info.upgrades.contains(BarrelUpgrade.SILKY)) {
front = this.front_silky;
}
ImmutableMap.Builder<String, String> textures = new ImmutableMap.Builder<>();
if (isItem || layer == BlockRenderLayer.SOLID) {
textures.put("log", log.getIconName());
textures.put("plank", plank.getIconName());
} else {
textures.put("#log", "");
textures.put("log", "");
textures.put("#plank", "");
textures.put("plank", "");
}
if (isItem || layer == BlockRenderLayer.TRANSLUCENT) {
if (info.upgrades.contains(BarrelUpgrade.HOPPING)) {
top = this.top_hopping;
textures.put("hopping", side_hopping.getIconName());
} else {
textures.put("#hopping", "");
textures.put("hopping", "");
}
textures.put("top", top.getIconName());
textures.put("front", front.getIconName());
textures.put("side", side.getIconName());
} else {
textures.put("#top", "");
textures.put("top", "");
textures.put("#front", "");
textures.put("front", "");
textures.put("#side", "");
textures.put("side", "");
textures.put("#hopping", "");
textures.put("hopping", "");
}
IModelState state = info.orientation.toTransformation();
IModel retexture = template.retexture(textures.build());
return new WrappedBakedModel(retexture.bake(state, DefaultVertexFormats.BLOCK, ModelLoader.defaultTextureGetter()), log).addDefaultBlockTransforms();
}
Aggregations