private void loadBlocks()
{
BlockStateMapper blockstatemapper = this.blockModelShapes.getBlockStateMapper();
for (Block block : Block.REGISTRY)
{
for (final ResourceLocation resourcelocation : blockstatemapper.getBlockstateLocations(block))
{
try
{
ModelBlockDefinition modelblockdefinition = this.getModelBlockDefinition(resourcelocation);
Map<IBlockState, ModelResourceLocation> map = blockstatemapper.getVariants(block);
if (modelblockdefinition.hasMultipartData())
{
Collection<ModelResourceLocation> collection = Sets.newHashSet(map.values());
modelblockdefinition.getMultipartData().setStateContainer(block.getBlockState());
Collection<ModelResourceLocation> collection1 = (Collection)this.multipartVariantMap.get(modelblockdefinition);
if (collection1 == null)
{
collection1 = Lists.<ModelResourceLocation>newArrayList();
this.multipartVariantMap.put(modelblockdefinition, collection1);
}
collection1.addAll(Lists.newArrayList(Iterables.filter(collection, new Predicate<ModelResourceLocation>()
{
public boolean apply(@Nullable ModelResourceLocation p_apply_1_)
{
return resourcelocation.equals(p_apply_1_);
}
})));
}
for (Entry<IBlockState, ModelResourceLocation> entry : map.entrySet())
{
ModelResourceLocation modelresourcelocation = (ModelResourceLocation)entry.getValue();
if (resourcelocation.equals(modelresourcelocation))
{
try
{
this.variants.put(modelresourcelocation, modelblockdefinition.getVariant(modelresourcelocation.getVariant()));
}
catch (RuntimeException var12)
{
if (!modelblockdefinition.hasMultipartData())
{
LOGGER.warn("Unable to load variant: {} from {}", new Object[] {modelresourcelocation.getVariant(), modelresourcelocation});
}
}
}
}
}
catch (Exception exception)
{
LOGGER.warn("Unable to load definition {}", new Object[] {resourcelocation, exception});
}
}
}
}
ModelBakery.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:Backmemed
作者:
评论列表
文章目录