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


Java IJsonSerializable类代码示例

本文整理汇总了Java中net.minecraft.util.IJsonSerializable的典型用法代码示例。如果您正苦于以下问题:Java IJsonSerializable类的具体用法?Java IJsonSerializable怎么用?Java IJsonSerializable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: func_150870_b

import net.minecraft.util.IJsonSerializable; //导入依赖的package包/类
public <T extends IJsonSerializable> T func_150870_b(StatBase p_150870_1_)
{
    TupleIntJsonSerializable tupleintjsonserializable = (TupleIntJsonSerializable)this.statsData.get(p_150870_1_);
    return (T)(tupleintjsonserializable != null ? tupleintjsonserializable.getJsonSerializableValue() : null);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:6,代码来源:StatFileWriter.java

示例2: parseJson

import net.minecraft.util.IJsonSerializable; //导入依赖的package包/类
public Map<StatBase, TupleIntJsonSerializable> parseJson(String p_150881_1_)
{
    JsonElement jsonelement = (new JsonParser()).parse(p_150881_1_);

    if (!jsonelement.isJsonObject())
    {
        return Maps.<StatBase, TupleIntJsonSerializable>newHashMap();
    }
    else
    {
        JsonObject jsonobject = jsonelement.getAsJsonObject();
        Map<StatBase, TupleIntJsonSerializable> map = Maps.<StatBase, TupleIntJsonSerializable>newHashMap();

        for (Entry<String, JsonElement> entry : jsonobject.entrySet())
        {
            StatBase statbase = StatList.getOneShotStat((String)entry.getKey());

            if (statbase != null)
            {
                TupleIntJsonSerializable tupleintjsonserializable = new TupleIntJsonSerializable();

                if (((JsonElement)entry.getValue()).isJsonPrimitive() && ((JsonElement)entry.getValue()).getAsJsonPrimitive().isNumber())
                {
                    tupleintjsonserializable.setIntegerValue(((JsonElement)entry.getValue()).getAsInt());
                }
                else if (((JsonElement)entry.getValue()).isJsonObject())
                {
                    JsonObject jsonobject1 = ((JsonElement)entry.getValue()).getAsJsonObject();

                    if (jsonobject1.has("value") && jsonobject1.get("value").isJsonPrimitive() && jsonobject1.get("value").getAsJsonPrimitive().isNumber())
                    {
                        tupleintjsonserializable.setIntegerValue(jsonobject1.getAsJsonPrimitive("value").getAsInt());
                    }

                    if (jsonobject1.has("progress") && statbase.func_150954_l() != null)
                    {
                        try
                        {
                            Constructor <? extends IJsonSerializable > constructor = statbase.func_150954_l().getConstructor(new Class[0]);
                            IJsonSerializable ijsonserializable = (IJsonSerializable)constructor.newInstance(new Object[0]);
                            ijsonserializable.fromJson(jsonobject1.get("progress"));
                            tupleintjsonserializable.setJsonSerializableValue(ijsonserializable);
                        }
                        catch (Throwable throwable)
                        {
                            logger.warn("Invalid statistic progress in " + this.statsFile, throwable);
                        }
                    }
                }

                map.put(statbase, tupleintjsonserializable);
            }
            else
            {
                logger.warn("Invalid statistic in " + this.statsFile + ": Don\'t know what " + (String)entry.getKey() + " is");
            }
        }

        return map;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:62,代码来源:StatisticsFile.java

示例3: func_150954_l

import net.minecraft.util.IJsonSerializable; //导入依赖的package包/类
public Class <? extends IJsonSerializable > func_150954_l()
{
    return this.field_150956_d;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:StatBase.java

示例4: func_150953_b

import net.minecraft.util.IJsonSerializable; //导入依赖的package包/类
public StatBase func_150953_b(Class <? extends IJsonSerializable > p_150953_1_)
{
    this.field_150956_d = p_150953_1_;
    return this;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:6,代码来源:StatBase.java

示例5: func_150953_b

import net.minecraft.util.IJsonSerializable; //导入依赖的package包/类
public Achievement func_150953_b(Class <? extends IJsonSerializable > p_150953_1_)
{
    return (Achievement)super.func_150953_b(p_150953_1_);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:Achievement.java

示例6: getSerializableClazz

import net.minecraft.util.IJsonSerializable; //导入依赖的package包/类
public Class <? extends IJsonSerializable > getSerializableClazz()
{
    return this.serializableClazz;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:StatBase.java

示例7: setSerializableClazz

import net.minecraft.util.IJsonSerializable; //导入依赖的package包/类
public StatBase setSerializableClazz(Class <? extends IJsonSerializable > clazz)
{
    this.serializableClazz = clazz;
    return this;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:6,代码来源:StatBase.java

示例8: setSerializableClazz

import net.minecraft.util.IJsonSerializable; //导入依赖的package包/类
public Achievement setSerializableClazz(Class <? extends IJsonSerializable > clazz)
{
    return (Achievement)super.setSerializableClazz(clazz);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:Achievement.java

示例9: parseJson

import net.minecraft.util.IJsonSerializable; //导入依赖的package包/类
public Map<StatBase, TupleIntJsonSerializable> parseJson(String p_150881_1_)
{
    JsonElement jsonelement = (new JsonParser()).parse(p_150881_1_);

    if (!jsonelement.isJsonObject())
    {
        return Maps.<StatBase, TupleIntJsonSerializable>newHashMap();
    }
    else
    {
        JsonObject jsonobject = jsonelement.getAsJsonObject();
        Map<StatBase, TupleIntJsonSerializable> map = Maps.<StatBase, TupleIntJsonSerializable>newHashMap();

        for (Entry<String, JsonElement> entry : jsonobject.entrySet())
        {
            StatBase statbase = StatList.getOneShotStat((String)entry.getKey());

            if (statbase != null)
            {
                TupleIntJsonSerializable tupleintjsonserializable = new TupleIntJsonSerializable();

                if (((JsonElement)entry.getValue()).isJsonPrimitive() && ((JsonElement)entry.getValue()).getAsJsonPrimitive().isNumber())
                {
                    tupleintjsonserializable.setIntegerValue(((JsonElement)entry.getValue()).getAsInt());
                }
                else if (((JsonElement)entry.getValue()).isJsonObject())
                {
                    JsonObject jsonobject1 = ((JsonElement)entry.getValue()).getAsJsonObject();

                    if (jsonobject1.has("value") && jsonobject1.get("value").isJsonPrimitive() && jsonobject1.get("value").getAsJsonPrimitive().isNumber())
                    {
                        tupleintjsonserializable.setIntegerValue(jsonobject1.getAsJsonPrimitive("value").getAsInt());
                    }

                    if (jsonobject1.has("progress") && statbase.getSerializableClazz() != null)
                    {
                        try
                        {
                            Constructor <? extends IJsonSerializable > constructor = statbase.getSerializableClazz().getConstructor(new Class[0]);
                            IJsonSerializable ijsonserializable = (IJsonSerializable)constructor.newInstance(new Object[0]);
                            ijsonserializable.fromJson(jsonobject1.get("progress"));
                            tupleintjsonserializable.setJsonSerializableValue(ijsonserializable);
                        }
                        catch (Throwable throwable)
                        {
                            LOGGER.warn("Invalid statistic progress in {}", new Object[] {this.statsFile, throwable});
                        }
                    }
                }

                map.put(statbase, tupleintjsonserializable);
            }
            else
            {
                LOGGER.warn("Invalid statistic in {}: Don\'t know what {} is", new Object[] {this.statsFile, entry.getKey()});
            }
        }

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

示例10: getProgress

import net.minecraft.util.IJsonSerializable; //导入依赖的package包/类
public <T extends IJsonSerializable> T getProgress(StatBase p_150870_1_)
{
    TupleIntJsonSerializable tupleintjsonserializable = (TupleIntJsonSerializable)this.statsData.get(p_150870_1_);
    return (T)(tupleintjsonserializable != null ? tupleintjsonserializable.getJsonSerializableValue() : null);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:6,代码来源:StatisticsManager.java

示例11: func_150870_b

import net.minecraft.util.IJsonSerializable; //导入依赖的package包/类
public IJsonSerializable func_150870_b(StatBase p_150870_1_)
{
    TupleIntJsonSerializable var2 = (TupleIntJsonSerializable)this.field_150875_a.get(p_150870_1_);
    return var2 != null ? var2.getJsonSerializableValue() : null;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:6,代码来源:StatFileWriter.java

示例12: func_150881_a

import net.minecraft.util.IJsonSerializable; //导入依赖的package包/类
public Map func_150881_a(String p_150881_1_)
{
    JsonElement var2 = (new JsonParser()).parse(p_150881_1_);

    if (!var2.isJsonObject())
    {
        return Maps.newHashMap();
    }
    else
    {
        JsonObject var3 = var2.getAsJsonObject();
        HashMap var4 = Maps.newHashMap();
        Iterator var5 = var3.entrySet().iterator();

        while (var5.hasNext())
        {
            Entry var6 = (Entry)var5.next();
            StatBase var7 = StatList.func_151177_a((String)var6.getKey());

            if (var7 != null)
            {
                TupleIntJsonSerializable var8 = new TupleIntJsonSerializable();

                if (((JsonElement)var6.getValue()).isJsonPrimitive() && ((JsonElement)var6.getValue()).getAsJsonPrimitive().isNumber())
                {
                    var8.setIntegerValue(((JsonElement)var6.getValue()).getAsInt());
                }
                else if (((JsonElement)var6.getValue()).isJsonObject())
                {
                    JsonObject var9 = ((JsonElement)var6.getValue()).getAsJsonObject();

                    if (var9.has("value") && var9.get("value").isJsonPrimitive() && var9.get("value").getAsJsonPrimitive().isNumber())
                    {
                        var8.setIntegerValue(var9.getAsJsonPrimitive("value").getAsInt());
                    }

                    if (var9.has("progress") && var7.func_150954_l() != null)
                    {
                        try
                        {
                            Constructor var10 = var7.func_150954_l().getConstructor(new Class[0]);
                            IJsonSerializable var11 = (IJsonSerializable)var10.newInstance(new Object[0]);
                            var8.setJsonSerializableValue(var11);
                        }
                        catch (Throwable var12)
                        {
                            logger.warn("Invalid statistic progress in " + this.field_150887_d, var12);
                        }
                    }
                }

                var4.put(var7, var8);
            }
            else
            {
                logger.warn("Invalid statistic in " + this.field_150887_d + ": Don\'t know what " + (String)var6.getKey() + " is");
            }
        }

        return var4;
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:63,代码来源:StatisticsFile.java

示例13: func_150870_b

import net.minecraft.util.IJsonSerializable; //导入依赖的package包/类
@Override
public IJsonSerializable func_150870_b(StatBase p_150870_1_) {
	return new JsonSerializableSet();
}
 
开发者ID:unascribed,项目名称:Farrago,代码行数:5,代码来源:FakeStatFileWriter.java

示例14: func_150872_a

import net.minecraft.util.IJsonSerializable; //导入依赖的package包/类
@Override
public IJsonSerializable func_150872_a(StatBase p_150872_1_, IJsonSerializable p_150872_2_) {
	return new JsonSerializableSet();
}
 
开发者ID:unascribed,项目名称:Farrago,代码行数:5,代码来源:FakeStatFileWriter.java

示例15: func_150870_b

import net.minecraft.util.IJsonSerializable; //导入依赖的package包/类
public IJsonSerializable func_150870_b(StatBase p_150870_1_)
{
    TupleIntJsonSerializable tupleintjsonserializable = (TupleIntJsonSerializable)this.field_150875_a.get(p_150870_1_);
    return tupleintjsonserializable != null ? tupleintjsonserializable.getJsonSerializableValue() : null;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:6,代码来源:StatFileWriter.java


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