本文整理汇总了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);
}
示例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);
}
示例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 + "\'");
}
}
示例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));
}
示例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));
}
示例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);
}
示例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 + "\'");
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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));
}
示例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);
}
示例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));
}