ModelBakery.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:ExpandedRailsMod 作者:
protected void loadBlock(BlockStateMapper blockstatemapper, Block block, final ResourceLocation resourcelocation)
{
    {
        {
            {
                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());
                    registerMultipartVariant(modelblockdefinition, 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.registerVariant(modelblockdefinition, modelresourcelocation);
                        }
                        catch (RuntimeException var12)
                        {
                            if (!modelblockdefinition.hasMultipartData())
                            {
                                LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, var12);
                            }
                        }
                    }
                }
            }
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号