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

项目:Backmemed    文件:ModelBlockDefinition.java   
public ModelBlockDefinition deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = p_deserialize_1_.getAsJsonObject();
    Map<String, VariantList> map = this.parseMapVariants(p_deserialize_3_, jsonobject);
    Multipart multipart = this.parseMultipart(p_deserialize_3_, jsonobject);

    if (!map.isEmpty() || multipart != null && !multipart.getVariants().isEmpty())
    {
        return new ModelBlockDefinition(map, multipart);
    }
    else
    {
        throw new JsonParseException("Neither \'variants\' nor \'multipart\' found");
    }
}
项目:Backmemed    文件:ModelBlockDefinition.java   
@Nullable
protected Multipart parseMultipart(JsonDeserializationContext deserializationContext, JsonObject object)
{
    if (!object.has("multipart"))
    {
        return null;
    }
    else
    {
        JsonArray jsonarray = JsonUtils.getJsonArray(object, "multipart");
        return (Multipart)deserializationContext.deserialize(jsonarray, Multipart.class);
    }
}
项目: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    文件:ModelBlockDefinition.java   
public ModelBlockDefinition deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = p_deserialize_1_.getAsJsonObject();
    Map<String, VariantList> map = this.parseMapVariants(p_deserialize_3_, jsonobject);
    Multipart multipart = this.parseMultipart(p_deserialize_3_, jsonobject);

    if (!map.isEmpty() || multipart != null && !multipart.getVariants().isEmpty())
    {
        return new ModelBlockDefinition(map, multipart);
    }
    else
    {
        throw new JsonParseException("Neither \'variants\' nor \'multipart\' found");
    }
}
项目:CustomWorldGen    文件:ModelBlockDefinition.java   
@Nullable
protected Multipart parseMultipart(JsonDeserializationContext deserializationContext, JsonObject object)
{
    if (!object.has("multipart"))
    {
        return null;
    }
    else
    {
        JsonArray jsonarray = JsonUtils.getJsonArray(object, "multipart");
        return (Multipart)deserializationContext.deserialize(jsonarray, Multipart.class);
    }
}
项目: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    文件:ModelBlockDefinition.java   
public ModelBlockDefinition deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = p_deserialize_1_.getAsJsonObject();
    Map<String, VariantList> map = this.parseMapVariants(p_deserialize_3_, jsonobject);
    Multipart multipart = this.parseMultipart(p_deserialize_3_, jsonobject);

    if (!map.isEmpty() || multipart != null && !multipart.getVariants().isEmpty())
    {
        return new ModelBlockDefinition(map, multipart);
    }
    else
    {
        throw new JsonParseException("Neither \'variants\' nor \'multipart\' found");
    }
}
项目:ExpandedRailsMod    文件:ModelBlockDefinition.java   
@Nullable
protected Multipart parseMultipart(JsonDeserializationContext deserializationContext, JsonObject object)
{
    if (!object.has("multipart"))
    {
        return null;
    }
    else
    {
        JsonArray jsonarray = JsonUtils.getJsonArray(object, "multipart");
        return (Multipart)deserializationContext.deserialize(jsonarray, Multipart.class);
    }
}
项目: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);
            }
        }
    }
}
项目:Backmemed    文件:ModelBlockDefinition.java   
public ModelBlockDefinition(Map<String, VariantList> variants, Multipart multipartIn)
{
    this.multipart = multipartIn;
    this.mapVariants.putAll(variants);
}
项目:Backmemed    文件:ModelBlockDefinition.java   
public Multipart getMultipartData()
{
    return this.multipart;
}
项目:CustomWorldGen    文件:ModelBlockDefinition.java   
public ModelBlockDefinition(Map<String, VariantList> variants, Multipart multipartIn)
{
    this.multipart = multipartIn;
    this.mapVariants.putAll(variants);
}
项目:CustomWorldGen    文件:ModelBlockDefinition.java   
public Multipart getMultipartData()
{
    return this.multipart;
}
项目:ExpandedRailsMod    文件:ModelBlockDefinition.java   
public ModelBlockDefinition(Map<String, VariantList> variants, Multipart multipartIn)
{
    this.multipart = multipartIn;
    this.mapVariants.putAll(variants);
}
项目:ExpandedRailsMod    文件:ModelBlockDefinition.java   
public Multipart getMultipartData()
{
    return this.multipart;
}