Java 类net.minecraft.client.renderer.block.model.multipart.Selector 实例源码

项目:Backmemed    文件:ModelBakery.java   
private void bakeBlockModels()
{
    for (ModelResourceLocation modelresourcelocation : this.variants.keySet())
    {
        IBakedModel ibakedmodel = this.createRandomModelForVariantList((VariantList)this.variants.get(modelresourcelocation), modelresourcelocation.toString());

        if (ibakedmodel != null)
        {
            this.bakedRegistry.putObject(modelresourcelocation, ibakedmodel);
        }
    }

    for (Entry<ModelBlockDefinition, Collection<ModelResourceLocation>> entry : this.multipartVariantMap.entrySet())
    {
        ModelBlockDefinition modelblockdefinition = (ModelBlockDefinition)entry.getKey();
        Multipart multipart = modelblockdefinition.getMultipartData();
        String s = ((ResourceLocation)Block.REGISTRY.getNameForObject(multipart.getStateContainer().getBlock())).toString();
        MultipartBakedModel.Builder multipartbakedmodel$builder = new MultipartBakedModel.Builder();

        for (Selector selector : multipart.getSelectors())
        {
            IBakedModel ibakedmodel1 = this.createRandomModelForVariantList(selector.getVariantList(), "selector of " + s);

            if (ibakedmodel1 != null)
            {
                multipartbakedmodel$builder.putModel(selector.getPredicate(multipart.getStateContainer()), ibakedmodel1);
            }
        }

        IBakedModel ibakedmodel2 = multipartbakedmodel$builder.makeMultipartModel();

        for (ModelResourceLocation modelresourcelocation1 : entry.getValue())
        {
            if (!modelblockdefinition.hasVariant(modelresourcelocation1.getVariant()))
            {
                this.bakedRegistry.putObject(modelresourcelocation1, ibakedmodel2);
            }
        }
    }
}
项目:CustomWorldGen    文件:ModelLoader.java   
public MultipartModel(ResourceLocation location, Multipart multipart) throws Exception
{
    this.location = location;
    this.multipart = multipart;
    ImmutableMap.Builder<Selector, IModel> builder = ImmutableMap.builder();
    for (Selector selector : multipart.getSelectors())
    {
        builder.put(selector, new WeightedRandomModel(location, selector.getVariantList()));
    }
    partModels = builder.build();
}
项目:CustomWorldGen    文件:ModelLoader.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    MultipartBakedModel.Builder builder = new MultipartBakedModel.Builder();

    for (Selector selector : multipart.getSelectors())
    {
        builder.putModel(selector.getPredicate(multipart.getStateContainer()), partModels.get(selector).bake(partModels.get(selector).getDefaultState(), format, bakedTextureGetter));
    }

    IBakedModel bakedModel = builder.makeMultipartModel();
    return bakedModel;
}
项目:CustomWorldGen    文件:ModelBakery.java   
private void bakeBlockModels()
{
    for (ModelResourceLocation modelresourcelocation : this.variants.keySet())
    {
        IBakedModel ibakedmodel = this.createRandomModelForVariantList((VariantList)this.variants.get(modelresourcelocation), modelresourcelocation.toString());

        if (ibakedmodel != null)
        {
            this.bakedRegistry.putObject(modelresourcelocation, ibakedmodel);
        }
    }

    for (Entry<ModelBlockDefinition, Collection<ModelResourceLocation>> entry : this.multipartVariantMap.entrySet())
    {
        ModelBlockDefinition modelblockdefinition = (ModelBlockDefinition)entry.getKey();
        Multipart multipart = modelblockdefinition.getMultipartData();
        String s = ((ResourceLocation)Block.REGISTRY.getNameForObject(multipart.getStateContainer().getBlock())).toString();
        MultipartBakedModel.Builder multipartbakedmodel$builder = new MultipartBakedModel.Builder();

        for (Selector selector : multipart.getSelectors())
        {
            IBakedModel ibakedmodel1 = this.createRandomModelForVariantList(selector.getVariantList(), "selector of " + s);

            if (ibakedmodel1 != null)
            {
                multipartbakedmodel$builder.putModel(selector.getPredicate(multipart.getStateContainer()), ibakedmodel1);
            }
        }

        IBakedModel ibakedmodel2 = multipartbakedmodel$builder.makeMultipartModel();

        for (ModelResourceLocation modelresourcelocation1 : entry.getValue())
        {
            if (!modelblockdefinition.hasVariant(modelresourcelocation1.getVariant()))
            {
                this.bakedRegistry.putObject(modelresourcelocation1, ibakedmodel2);
            }
        }
    }
}
项目:ExpandedRailsMod    文件:ModelBakery.java   
private void bakeBlockModels()
{
    for (ModelResourceLocation modelresourcelocation : this.variants.keySet())
    {
        IBakedModel ibakedmodel = this.createRandomModelForVariantList((VariantList)this.variants.get(modelresourcelocation), modelresourcelocation.toString());

        if (ibakedmodel != null)
        {
            this.bakedRegistry.putObject(modelresourcelocation, ibakedmodel);
        }
    }

    for (Entry<ModelBlockDefinition, Collection<ModelResourceLocation>> entry : this.multipartVariantMap.entrySet())
    {
        ModelBlockDefinition modelblockdefinition = (ModelBlockDefinition)entry.getKey();
        Multipart multipart = modelblockdefinition.getMultipartData();
        String s = ((ResourceLocation)Block.REGISTRY.getNameForObject(multipart.getStateContainer().getBlock())).toString();
        MultipartBakedModel.Builder multipartbakedmodel$builder = new MultipartBakedModel.Builder();

        for (Selector selector : multipart.getSelectors())
        {
            IBakedModel ibakedmodel1 = this.createRandomModelForVariantList(selector.getVariantList(), "selector of " + s);

            if (ibakedmodel1 != null)
            {
                multipartbakedmodel$builder.putModel(selector.getPredicate(multipart.getStateContainer()), ibakedmodel1);
            }
        }

        IBakedModel ibakedmodel2 = multipartbakedmodel$builder.makeMultipartModel();

        for (ModelResourceLocation modelresourcelocation1 : entry.getValue())
        {
            if (!modelblockdefinition.hasVariant(modelresourcelocation1.getVariant()))
            {
                this.bakedRegistry.putObject(modelresourcelocation1, ibakedmodel2);
            }
        }
    }
}