public WeightedRandomModel(ResourceLocation parent, VariantList variants) throws Exception
{
this.variants = variants.getVariantList();
ImmutableList.Builder<Pair<IModel, IModelState>> builder = ImmutableList.builder();
for (Variant v : this.variants)
{
ResourceLocation loc = v.getModelLocation();
locations.add(loc);
/*
* Vanilla eats this, which makes it only show variants that have models.
* But that doesn't help debugging, so throw the exception
*/
IModel model;
if(loc.equals(MODEL_MISSING))
{
// explicit missing location, happens if blockstate has "model"=null
model = ModelLoaderRegistry.getMissingModel();
}
else
{
model = ModelLoaderRegistry.getModel(loc);
}
// FIXME: is this the place? messes up dependency and texture resolution
model = v.process(model);
for(ResourceLocation location : model.getDependencies())
{
ModelLoaderRegistry.getModelOrMissing(location);
}
//FMLLog.getLogger().error("Exception resolving indirect dependencies for model" + loc, e);
textures.addAll(model.getTextures()); // Kick this, just in case.
models.add(model);
builder.add(Pair.of(model, v.getState()));
}
if (models.size() == 0) //If all variants are missing, add one with the missing model and default rotation.
{
// FIXME: log this?
IModel missing = ModelLoaderRegistry.getMissingModel();
models.add(missing);
builder.add(Pair.<IModel, IModelState>of(missing, TRSRTransformation.identity()));
}
defaultState = new MultiModelState(builder.build());
}
ModelLoader.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:CustomWorldGen
作者:
评论列表
文章目录