30 lines
1,003 B
Java
30 lines
1,003 B
Java
package net.minecraft.client.model.geom;
|
|
|
|
import com.google.common.collect.ImmutableMap;
|
|
import java.util.Map;
|
|
import net.fabricmc.api.EnvType;
|
|
import net.fabricmc.api.Environment;
|
|
import net.minecraft.client.model.geom.builders.LayerDefinition;
|
|
|
|
@Environment(EnvType.CLIENT)
|
|
public class EntityModelSet {
|
|
public static final EntityModelSet EMPTY = new EntityModelSet(Map.of());
|
|
private final Map<ModelLayerLocation, LayerDefinition> roots;
|
|
|
|
public EntityModelSet(Map<ModelLayerLocation, LayerDefinition> roots) {
|
|
this.roots = roots;
|
|
}
|
|
|
|
public ModelPart bakeLayer(ModelLayerLocation modelLayerLocation) {
|
|
LayerDefinition layerDefinition = (LayerDefinition)this.roots.get(modelLayerLocation);
|
|
if (layerDefinition == null) {
|
|
throw new IllegalArgumentException("No model for layer " + modelLayerLocation);
|
|
} else {
|
|
return layerDefinition.bakeRoot();
|
|
}
|
|
}
|
|
|
|
public static EntityModelSet vanilla() {
|
|
return new EntityModelSet(ImmutableMap.copyOf(LayerDefinitions.createRoots()));
|
|
}
|
|
}
|