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


Java JsonUtils.deserializeClass方法代码示例

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


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

示例1: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public static LootEntryItem deserialize(JsonObject object, JsonDeserializationContext deserializationContext, int weightIn, int qualityIn, LootCondition[] conditionsIn)
{
    Item item = JsonUtils.getItem(object, "name");
    LootFunction[] alootfunction;

    if (object.has("functions"))
    {
        alootfunction = (LootFunction[])JsonUtils.deserializeClass(object, "functions", deserializationContext, LootFunction[].class);
    }
    else
    {
        alootfunction = new LootFunction[0];
    }

    return new LootEntryItem(item, weightIn, qualityIn, alootfunction, conditionsIn);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:LootEntryItem.java

示例2: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public static LootEntryItem deserialize(JsonObject object, JsonDeserializationContext deserializationContext, int weightIn, int qualityIn, LootCondition[] conditionsIn)
{
    String name = net.minecraftforge.common.ForgeHooks.readLootEntryName(object, "item");
    Item item = JsonUtils.getItem(object, "name");
    LootFunction[] alootfunction;

    if (object.has("functions"))
    {
        alootfunction = (LootFunction[])JsonUtils.deserializeClass(object, "functions", deserializationContext, LootFunction[].class);
    }
    else
    {
        alootfunction = new LootFunction[0];
    }

    return new LootEntryItem(item, weightIn, qualityIn, alootfunction, conditionsIn, name);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:LootEntryItem.java

示例3: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public LootEntry deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "loot item");
    String s = JsonUtils.getString(jsonobject, "type");
    int i = JsonUtils.getInt(jsonobject, "weight", 1);
    int j = JsonUtils.getInt(jsonobject, "quality", 0);
    LootCondition[] alootcondition;

    if (jsonobject.has("conditions"))
    {
        alootcondition = (LootCondition[])JsonUtils.deserializeClass(jsonobject, "conditions", p_deserialize_3_, LootCondition[].class);
    }
    else
    {
        alootcondition = new LootCondition[0];
    }

    if ("item".equals(s))
    {
        return LootEntryItem.deserialize(jsonobject, p_deserialize_3_, i, j, alootcondition);
    }
    else if ("loot_table".equals(s))
    {
        return LootEntryTable.deserialize(jsonobject, p_deserialize_3_, i, j, alootcondition);
    }
    else if ("empty".equals(s))
    {
        return LootEntryEmpty.deserialize(jsonobject, p_deserialize_3_, i, j, alootcondition);
    }
    else
    {
        throw new JsonSyntaxException("Unknown loot entry type \'" + s + "\'");
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:35,代码来源:LootEntry.java

示例4: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public EntityHasProperty deserialize(JsonObject json, JsonDeserializationContext context)
{
    Set<Entry<String, JsonElement>> set = JsonUtils.getJsonObject(json, "properties").entrySet();
    EntityProperty[] aentityproperty = new EntityProperty[set.size()];
    int i = 0;

    for (Entry<String, JsonElement> entry : set)
    {
        aentityproperty[i++] = EntityPropertyManager.getSerializerForName(new ResourceLocation((String)entry.getKey())).deserialize((JsonElement)entry.getValue(), context);
    }

    return new EntityHasProperty(aentityproperty, (LootContext.EntityTarget)JsonUtils.deserializeClass(json, "entity", context, LootContext.EntityTarget.class));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:14,代码来源:EntityHasProperty.java

示例5: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public EntityHasScore deserialize(JsonObject json, JsonDeserializationContext context)
{
    Set<Entry<String, JsonElement>> set = JsonUtils.getJsonObject(json, "scores").entrySet();
    Map<String, RandomValueRange> map = Maps.<String, RandomValueRange>newLinkedHashMap();

    for (Entry<String, JsonElement> entry : set)
    {
        map.put(entry.getKey(), JsonUtils.deserializeClass((JsonElement)entry.getValue(), "score", context, RandomValueRange.class));
    }

    return new EntityHasScore(map, (LootContext.EntityTarget)JsonUtils.deserializeClass(json, "entity", context, LootContext.EntityTarget.class));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:EntityHasScore.java

示例6: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public LootPool deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "loot pool");
    LootEntry[] alootentry = (LootEntry[])JsonUtils.deserializeClass(jsonobject, "entries", p_deserialize_3_, LootEntry[].class);
    LootCondition[] alootcondition = (LootCondition[])JsonUtils.deserializeClass(jsonobject, "conditions", new LootCondition[0], p_deserialize_3_, LootCondition[].class);
    RandomValueRange randomvaluerange = (RandomValueRange)JsonUtils.deserializeClass(jsonobject, "rolls", p_deserialize_3_, RandomValueRange.class);
    RandomValueRange randomvaluerange1 = (RandomValueRange)JsonUtils.deserializeClass(jsonobject, "bonus_rolls", new RandomValueRange(0.0F, 0.0F), p_deserialize_3_, RandomValueRange.class);
    return new LootPool(alootentry, alootcondition, randomvaluerange, randomvaluerange1);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:10,代码来源:LootPool.java

示例7: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public LootEntry deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "loot item");
    String s = JsonUtils.getString(jsonobject, "type");
    int i = JsonUtils.getInt(jsonobject, "weight", 1);
    int j = JsonUtils.getInt(jsonobject, "quality", 0);
    LootCondition[] alootcondition;

    if (jsonobject.has("conditions"))
    {
        alootcondition = (LootCondition[])JsonUtils.deserializeClass(jsonobject, "conditions", p_deserialize_3_, LootCondition[].class);
    }
    else
    {
        alootcondition = new LootCondition[0];
    }

    LootEntry ret = net.minecraftforge.common.ForgeHooks.deserializeJsonLootEntry(s, jsonobject, i, j, alootcondition);
    if (ret != null) return ret;

    if ("item".equals(s))
    {
        return LootEntryItem.deserialize(jsonobject, p_deserialize_3_, i, j, alootcondition);
    }
    else if ("loot_table".equals(s))
    {
        return LootEntryTable.deserialize(jsonobject, p_deserialize_3_, i, j, alootcondition);
    }
    else if ("empty".equals(s))
    {
        return LootEntryEmpty.deserialize(jsonobject, p_deserialize_3_, i, j, alootcondition);
    }
    else
    {
        throw new JsonSyntaxException("Unknown loot entry type \'" + s + "\'");
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:38,代码来源:LootEntry.java

示例8: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public LootPool deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "loot pool");
    String name = net.minecraftforge.common.ForgeHooks.readPoolName(jsonobject);
    LootEntry[] alootentry = (LootEntry[])JsonUtils.deserializeClass(jsonobject, "entries", p_deserialize_3_, LootEntry[].class);
    LootCondition[] alootcondition = (LootCondition[])JsonUtils.deserializeClass(jsonobject, "conditions", new LootCondition[0], p_deserialize_3_, LootCondition[].class);
    RandomValueRange randomvaluerange = (RandomValueRange)JsonUtils.deserializeClass(jsonobject, "rolls", p_deserialize_3_, RandomValueRange.class);
    RandomValueRange randomvaluerange1 = (RandomValueRange)JsonUtils.deserializeClass(jsonobject, "bonus_rolls", new RandomValueRange(0.0F, 0.0F), p_deserialize_3_, RandomValueRange.class);
    return new LootPool(alootentry, alootcondition, randomvaluerange, randomvaluerange1, name);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:11,代码来源:LootPool.java

示例9: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public LootTable deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "loot table");
    LootPool[] alootpool = (LootPool[])JsonUtils.deserializeClass(jsonobject, "pools", new LootPool[0], p_deserialize_3_, LootPool[].class);
    return new LootTable(alootpool);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:7,代码来源:LootTable.java

示例10: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public static SetAttributes.Modifier deserialize(JsonObject jsonObj, JsonDeserializationContext context)
{
    String s = JsonUtils.getString(jsonObj, "name");
    String s1 = JsonUtils.getString(jsonObj, "attribute");
    int i = getOperationFromInt(JsonUtils.getString(jsonObj, "operation"));
    RandomValueRange randomvaluerange = (RandomValueRange)JsonUtils.deserializeClass(jsonObj, "amount", context, RandomValueRange.class);
    UUID uuid = null;
    EntityEquipmentSlot[] aentityequipmentslot;

    if (JsonUtils.isString(jsonObj, "slot"))
    {
        aentityequipmentslot = new EntityEquipmentSlot[] {EntityEquipmentSlot.fromString(JsonUtils.getString(jsonObj, "slot"))};
    }
    else
    {
        if (!JsonUtils.isJsonArray(jsonObj, "slot"))
        {
            throw new JsonSyntaxException("Invalid or missing attribute modifier slot; must be either string or array of strings.");
        }

        JsonArray jsonarray = JsonUtils.getJsonArray(jsonObj, "slot");
        aentityequipmentslot = new EntityEquipmentSlot[jsonarray.size()];
        int j = 0;

        for (JsonElement jsonelement : jsonarray)
        {
            aentityequipmentslot[j++] = EntityEquipmentSlot.fromString(JsonUtils.getString(jsonelement, "slot"));
        }

        if (aentityequipmentslot.length == 0)
        {
            throw new JsonSyntaxException("Invalid attribute modifier slot; must contain at least one entry.");
        }
    }

    if (jsonObj.has("id"))
    {
        String s2 = JsonUtils.getString(jsonObj, "id");

        try
        {
            uuid = UUID.fromString(s2);
        }
        catch (IllegalArgumentException var12)
        {
            throw new JsonSyntaxException("Invalid attribute modifier id \'" + s2 + "\' (must be UUID format, with dashes)");
        }
    }

    return new SetAttributes.Modifier(s, s1, i, randomvaluerange, aentityequipmentslot, uuid);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:52,代码来源:SetAttributes.java

示例11: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public EnchantWithLevels deserialize(JsonObject object, JsonDeserializationContext deserializationContext, LootCondition[] conditionsIn)
{
    RandomValueRange randomvaluerange = (RandomValueRange)JsonUtils.deserializeClass(object, "levels", deserializationContext, RandomValueRange.class);
    boolean flag = JsonUtils.getBoolean(object, "treasure", false);
    return new EnchantWithLevels(conditionsIn, randomvaluerange, flag);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:7,代码来源:EnchantWithLevels.java

示例12: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public SetCount deserialize(JsonObject object, JsonDeserializationContext deserializationContext, LootCondition[] conditionsIn)
{
    return new SetCount(conditionsIn, (RandomValueRange)JsonUtils.deserializeClass(object, "count", deserializationContext, RandomValueRange.class));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:SetCount.java

示例13: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public SetMetadata deserialize(JsonObject object, JsonDeserializationContext deserializationContext, LootCondition[] conditionsIn)
{
    return new SetMetadata(conditionsIn, (RandomValueRange)JsonUtils.deserializeClass(object, "data", deserializationContext, RandomValueRange.class));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:SetMetadata.java

示例14: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public LootingEnchantBonus deserialize(JsonObject object, JsonDeserializationContext deserializationContext, LootCondition[] conditionsIn)
{
    int i = JsonUtils.getInt(object, "limit", 0);
    return new LootingEnchantBonus(conditionsIn, (RandomValueRange)JsonUtils.deserializeClass(object, "count", deserializationContext, RandomValueRange.class), i);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:6,代码来源:LootingEnchantBonus.java

示例15: deserialize

import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public SetDamage deserialize(JsonObject object, JsonDeserializationContext deserializationContext, LootCondition[] conditionsIn)
{
    return new SetDamage(conditionsIn, (RandomValueRange)JsonUtils.deserializeClass(object, "damage", deserializationContext, RandomValueRange.class));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:SetDamage.java


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