当前位置: 首页>>代码示例>>Java>>正文


Java JsonUtils.getJsonObject方法代码示例

本文整理汇总了Java中net.minecraft.util.JsonUtils.getJsonObject方法的典型用法代码示例。如果您正苦于以下问题:Java JsonUtils.getJsonObject方法的具体用法?Java JsonUtils.getJsonObject怎么用?Java JsonUtils.getJsonObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.util.JsonUtils的用法示例。


在下文中一共展示了JsonUtils.getJsonObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public LootCondition deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "condition");
    ResourceLocation resourcelocation = new ResourceLocation(JsonUtils.getString(jsonobject, "condition"));
    LootCondition.Serializer<?> serializer;

    try
    {
        serializer = LootConditionManager.getSerializerForName(resourcelocation);
    }
    catch (IllegalArgumentException var8)
    {
        throw new JsonSyntaxException("Unknown condition \'" + resourcelocation + "\'");
    }

    return serializer.deserialize(jsonobject, p_deserialize_3_);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:LootConditionManager.java

示例2: initTarget

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
private void initTarget(JsonElement p_148027_1_) throws JsonException
{
    if (JsonUtils.isString(p_148027_1_))
    {
        this.addFramebuffer(p_148027_1_.getAsString(), this.mainFramebufferWidth, this.mainFramebufferHeight);
    }
    else
    {
        JsonObject jsonobject = JsonUtils.getJsonObject(p_148027_1_, "target");
        String s = JsonUtils.getString(jsonobject, "name");
        int i = JsonUtils.getInt(jsonobject, "width", this.mainFramebufferWidth);
        int j = JsonUtils.getInt(jsonobject, "height", this.mainFramebufferHeight);

        if (this.mapFramebuffers.containsKey(s))
        {
            throw new JsonException(s + " is already defined");
        }

        this.addFramebuffer(s, i, j);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:ShaderGroup.java

示例3: parseMapVariants

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
protected Map<String, VariantList> parseMapVariants(JsonDeserializationContext deserializationContext, JsonObject object)
{
    Map<String, VariantList> map = Maps.<String, VariantList>newHashMap();

    if (object.has("variants"))
    {
        JsonObject jsonobject = JsonUtils.getJsonObject(object, "variants");

        for (Entry<String, JsonElement> entry : jsonobject.entrySet())
        {
            map.put(entry.getKey(), (VariantList)deserializationContext.deserialize((JsonElement)entry.getValue(), VariantList.class));
        }
    }

    return map;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:ModelBlockDefinition.java

示例4: parseRotation

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
private BlockPartRotation parseRotation(JsonObject p_178256_1_)
{
    BlockPartRotation blockpartrotation = null;

    if (p_178256_1_.has("rotation"))
    {
        JsonObject jsonobject = JsonUtils.getJsonObject(p_178256_1_, "rotation");
        Vector3f vector3f = this.parsePosition(jsonobject, "origin");
        vector3f.scale(0.0625F);
        EnumFacing.Axis enumfacing$axis = this.parseAxis(jsonobject);
        float f = this.parseAngle(jsonobject);
        boolean flag = JsonUtils.getBoolean(jsonobject, "rescale", false);
        blockpartrotation = new BlockPartRotation(vector3f, enumfacing$axis, f, flag);
    }

    return blockpartrotation;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:BlockPart.java

示例5: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public LootFunction deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "function");
    ResourceLocation resourcelocation = new ResourceLocation(JsonUtils.getString(jsonobject, "function"));
    LootFunction.Serializer<?> serializer;

    try
    {
        serializer = LootFunctionManager.getSerializerForName(resourcelocation);
    }
    catch (IllegalArgumentException var8)
    {
        throw new JsonSyntaxException("Unknown function \'" + resourcelocation + "\'");
    }

    return serializer.deserialize(jsonobject, p_deserialize_3_, (LootCondition[])JsonUtils.deserializeClass(jsonobject, "conditions", new LootCondition[0], p_deserialize_3_, LootCondition[].class));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:LootFunctionManager.java

示例6: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public ServerStatusResponse.Players deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "players");
    ServerStatusResponse.Players serverstatusresponse$players = new ServerStatusResponse.Players(JsonUtils.getInt(jsonobject, "max"), JsonUtils.getInt(jsonobject, "online"));

    if (JsonUtils.isJsonArray(jsonobject, "sample"))
    {
        JsonArray jsonarray = JsonUtils.getJsonArray(jsonobject, "sample");

        if (jsonarray.size() > 0)
        {
            GameProfile[] agameprofile = new GameProfile[jsonarray.size()];

            for (int i = 0; i < agameprofile.length; ++i)
            {
                JsonObject jsonobject1 = JsonUtils.getJsonObject(jsonarray.get(i), "player[" + i + "]");
                String s = JsonUtils.getString(jsonobject1, "id");
                agameprofile[i] = new GameProfile(UUID.fromString(s), JsonUtils.getString(jsonobject1, "name"));
            }

            serverstatusresponse$players.setPlayers(agameprofile);
        }
    }

    return serverstatusresponse$players;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:27,代码来源:ServerStatusResponse.java

示例7: parseAnimationFrame

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
private AnimationFrame parseAnimationFrame(int frame, JsonElement element)
{
    if (element.isJsonPrimitive())
    {
        return new AnimationFrame(JsonUtils.getInt(element, "frames[" + frame + "]"));
    }
    else if (element.isJsonObject())
    {
        JsonObject jsonobject = JsonUtils.getJsonObject(element, "frames[" + frame + "]");
        int i = JsonUtils.getInt(jsonobject, "time", -1);

        if (jsonobject.has("time"))
        {
            Validate.inclusiveBetween(1L, 2147483647L, (long)i, "Invalid frame time");
        }

        int j = JsonUtils.getInt(jsonobject, "index");
        Validate.inclusiveBetween(0L, 2147483647L, (long)j, "Invalid frame index");
        return new AnimationFrame(j, i);
    }
    else
    {
        return null;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:AnimationMetadataSectionSerializer.java

示例8: ResourceIndex

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public ResourceIndex(File assetsFolder, String indexName)
{
    File file1 = new File(assetsFolder, "objects");
    File file2 = new File(assetsFolder, "indexes/" + indexName + ".json");
    BufferedReader bufferedreader = null;

    try
    {
        bufferedreader = Files.newReader(file2, Charsets.UTF_8);
        JsonObject jsonobject = (new JsonParser()).parse((Reader)bufferedreader).getAsJsonObject();
        JsonObject jsonobject1 = JsonUtils.getJsonObject(jsonobject, "objects", (JsonObject)null);

        if (jsonobject1 != null)
        {
            for (Entry<String, JsonElement> entry : jsonobject1.entrySet())
            {
                JsonObject jsonobject2 = (JsonObject)entry.getValue();
                String s = (String)entry.getKey();
                String[] astring = s.split("/", 2);
                String s1 = astring.length == 1 ? astring[0] : astring[0] + ":" + astring[1];
                String s2 = JsonUtils.getString(jsonobject2, "hash");
                File file3 = new File(file1, s2.substring(0, 2) + "/" + s2);
                this.resourceMap.put(s1, file3);
            }
        }
    }
    catch (JsonParseException var20)
    {
        LOGGER.error("Unable to parse resource index file: {}", new Object[] {file2});
    }
    catch (FileNotFoundException var21)
    {
        LOGGER.error("Can\'t find the resource index file: {}", new Object[] {file2});
    }
    finally
    {
        IOUtils.closeQuietly((Reader)bufferedreader);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:40,代码来源:ResourceIndex.java

示例9: parseSampler

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
private void parseSampler(JsonElement p_147996_1_) throws JsonException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_147996_1_, "sampler");
    String s = JsonUtils.getString(jsonobject, "name");

    if (!JsonUtils.isString(jsonobject, "file"))
    {
        this.shaderSamplers.put(s, (Object)null);
        this.samplerNames.add(s);
    }
    else
    {
        this.samplerNames.add(s);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:ShaderManager.java

示例10: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public SoundList deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "entry");
    boolean flag = JsonUtils.getBoolean(jsonobject, "replace", false);
    String s = JsonUtils.getString(jsonobject, "subtitle", (String)null);
    List<Sound> list = this.deserializeSounds(jsonobject);
    return new SoundList(list, flag, s);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:9,代码来源:SoundListSerializer.java

示例11: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public ServerStatusResponse deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "status");
    ServerStatusResponse serverstatusresponse = new ServerStatusResponse();

    if (jsonobject.has("description"))
    {
        serverstatusresponse.setServerDescription((IChatComponent)p_deserialize_3_.deserialize(jsonobject.get("description"), IChatComponent.class));
    }

    if (jsonobject.has("players"))
    {
        serverstatusresponse.setPlayerCountData((ServerStatusResponse.PlayerCountData)p_deserialize_3_.deserialize(jsonobject.get("players"), ServerStatusResponse.PlayerCountData.class));
    }

    if (jsonobject.has("version"))
    {
        serverstatusresponse.setProtocolVersionInfo((ServerStatusResponse.MinecraftProtocolVersionIdentifier)p_deserialize_3_.deserialize(jsonobject.get("version"), ServerStatusResponse.MinecraftProtocolVersionIdentifier.class));
    }

    if (jsonobject.has("favicon"))
    {
        serverstatusresponse.setFavicon(JsonUtils.getString(jsonobject, "favicon"));
    }

    return serverstatusresponse;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:28,代码来源:ServerStatusResponse.java

示例12: parseFaces

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
private Map<EnumFacing, BlockPartFace> parseFaces(JsonDeserializationContext p_178253_1_, JsonObject p_178253_2_)
{
    Map<EnumFacing, BlockPartFace> map = Maps.newEnumMap(EnumFacing.class);
    JsonObject jsonobject = JsonUtils.getJsonObject(p_178253_2_, "faces");

    for (Entry<String, JsonElement> entry : jsonobject.entrySet())
    {
        EnumFacing enumfacing = this.parseEnumFacing((String)entry.getKey());
        map.put(enumfacing, (BlockPartFace)p_178253_1_.deserialize((JsonElement)entry.getValue(), BlockPartFace.class));
    }

    return map;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:14,代码来源:BlockPart.java

示例13: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public LanguageMetadataSection deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = p_deserialize_1_.getAsJsonObject();
    Set<Language> set = Sets.<Language>newHashSet();

    for (Entry<String, JsonElement> entry : jsonobject.entrySet())
    {
        String s = (String)entry.getKey();
        JsonObject jsonobject1 = JsonUtils.getJsonObject((JsonElement)entry.getValue(), "language");
        String s1 = JsonUtils.getString(jsonobject1, "region");
        String s2 = JsonUtils.getString(jsonobject1, "name");
        boolean flag = JsonUtils.getBoolean(jsonobject1, "bidirectional", false);

        if (s1.isEmpty())
        {
            throw new JsonParseException("Invalid language->\'" + s + "\'->region: empty value");
        }

        if (s2.isEmpty())
        {
            throw new JsonParseException("Invalid language->\'" + s + "\'->name: empty value");
        }

        if (!set.add(new Language(s, s1, s2, flag)))
        {
            throw new JsonParseException("Duplicate language->\'" + s + "\' defined");
        }
    }

    return new LanguageMetadataSection(set);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:32,代码来源:LanguageMetadataSectionSerializer.java

示例14: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public ServerStatusResponse.MinecraftProtocolVersionIdentifier deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "version");
    return new ServerStatusResponse.MinecraftProtocolVersionIdentifier(JsonUtils.getString(jsonobject, "name"), JsonUtils.getInt(jsonobject, "protocol"));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:6,代码来源:ServerStatusResponse.java

示例15: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public AnimationMetadataSection deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    List<AnimationFrame> list = Lists.<AnimationFrame>newArrayList();
    JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "metadata section");
    int i = JsonUtils.getInt(jsonobject, "frametime", 1);

    if (i != 1)
    {
        Validate.inclusiveBetween(1L, 2147483647L, (long)i, "Invalid default frame time");
    }

    if (jsonobject.has("frames"))
    {
        try
        {
            JsonArray jsonarray = JsonUtils.getJsonArray(jsonobject, "frames");

            for (int j = 0; j < jsonarray.size(); ++j)
            {
                JsonElement jsonelement = jsonarray.get(j);
                AnimationFrame animationframe = this.parseAnimationFrame(j, jsonelement);

                if (animationframe != null)
                {
                    list.add(animationframe);
                }
            }
        }
        catch (ClassCastException classcastexception)
        {
            throw new JsonParseException("Invalid animation->frames: expected array, was " + jsonobject.get("frames"), classcastexception);
        }
    }

    int k = JsonUtils.getInt(jsonobject, "width", -1);
    int l = JsonUtils.getInt(jsonobject, "height", -1);

    if (k != -1)
    {
        Validate.inclusiveBetween(1L, 2147483647L, (long)k, "Invalid width");
    }

    if (l != -1)
    {
        Validate.inclusiveBetween(1L, 2147483647L, (long)l, "Invalid height");
    }

    boolean flag = JsonUtils.getBoolean(jsonobject, "interpolate", false);
    return new AnimationMetadataSection(list, k, l, i, flag);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:51,代码来源:AnimationMetadataSectionSerializer.java


注:本文中的net.minecraft.util.JsonUtils.getJsonObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。