Search in sources :

Example 1 with BlockRenderLayer

use of net.minecraft.util.BlockRenderLayer in project MinecraftForge by MinecraftForge.

the class MultiLayerModel method process.

@Override
public MultiLayerModel process(ImmutableMap<String, String> customData) {
    ImmutableMap.Builder<Optional<BlockRenderLayer>, ModelResourceLocation> builder = ImmutableMap.builder();
    for (String key : customData.keySet()) {
        if ("base".equals(key)) {
            builder.put(Optional.<BlockRenderLayer>absent(), getLocation(customData.get(key)));
        }
        for (BlockRenderLayer layer : BlockRenderLayer.values()) {
            if (layer.toString().equals(key)) {
                builder.put(Optional.of(layer), getLocation(customData.get(key)));
            }
        }
    }
    ImmutableMap<Optional<BlockRenderLayer>, ModelResourceLocation> models = builder.build();
    if (models.isEmpty())
        return INSTANCE;
    return new MultiLayerModel(models);
}
Also used : Optional(com.google.common.base.Optional) BlockRenderLayer(net.minecraft.util.BlockRenderLayer) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ImmutableMap(com.google.common.collect.ImmutableMap)

Aggregations

Optional (com.google.common.base.Optional)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1 BlockRenderLayer (net.minecraft.util.BlockRenderLayer)1