本文整理汇总了Java中net.minecraft.util.JsonUtils.isString方法的典型用法代码示例。如果您正苦于以下问题:Java JsonUtils.isString方法的具体用法?Java JsonUtils.isString怎么用?Java JsonUtils.isString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.JsonUtils
的用法示例。
在下文中一共展示了JsonUtils.isString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: deserializeSounds
import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
private List<Sound> deserializeSounds(JsonObject object)
{
List<Sound> list = Lists.<Sound>newArrayList();
if (object.has("sounds"))
{
JsonArray jsonarray = JsonUtils.getJsonArray(object, "sounds");
for (int i = 0; i < jsonarray.size(); ++i)
{
JsonElement jsonelement = jsonarray.get(i);
if (JsonUtils.isString(jsonelement))
{
String s = JsonUtils.getString(jsonelement, "sound");
list.add(new Sound(s, 1.0F, 1.0F, 1, Sound.Type.FILE, false));
}
else
{
list.add(this.deserializeSound(JsonUtils.getJsonObject(jsonelement, "sound")));
}
}
}
return list;
}
示例3: 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);
}
}
示例4: parseSampler
import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
private void parseSampler(JsonElement element) throws JsonException
{
JsonObject jsonobject = JsonUtils.getJsonObject(element, "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);
}
}
示例5: func_148110_a
import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public static JsonBlendingMode func_148110_a(JsonObject p_148110_0_)
{
if (p_148110_0_ == null)
{
return new JsonBlendingMode();
}
else
{
int i = 32774;
int j = 1;
int k = 0;
int l = 1;
int i1 = 0;
boolean flag = true;
boolean flag1 = false;
if (JsonUtils.isString(p_148110_0_, "func"))
{
i = func_148108_a(p_148110_0_.get("func").getAsString());
if (i != 32774)
{
flag = false;
}
}
if (JsonUtils.isString(p_148110_0_, "srcrgb"))
{
j = func_148107_b(p_148110_0_.get("srcrgb").getAsString());
if (j != 1)
{
flag = false;
}
}
if (JsonUtils.isString(p_148110_0_, "dstrgb"))
{
k = func_148107_b(p_148110_0_.get("dstrgb").getAsString());
if (k != 0)
{
flag = false;
}
}
if (JsonUtils.isString(p_148110_0_, "srcalpha"))
{
l = func_148107_b(p_148110_0_.get("srcalpha").getAsString());
if (l != 1)
{
flag = false;
}
flag1 = true;
}
if (JsonUtils.isString(p_148110_0_, "dstalpha"))
{
i1 = func_148107_b(p_148110_0_.get("dstalpha").getAsString());
if (i1 != 0)
{
flag = false;
}
flag1 = true;
}
return flag ? new JsonBlendingMode() : (flag1 ? new JsonBlendingMode(j, k, l, i1, i) : new JsonBlendingMode(j, k, i));
}
}
示例6: 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");
SoundList soundlist = new SoundList();
soundlist.setReplaceExisting(JsonUtils.getBoolean(jsonobject, "replace", false));
SoundCategory soundcategory = SoundCategory.getCategory(JsonUtils.getString(jsonobject, "category", SoundCategory.MASTER.getCategoryName()));
soundlist.setSoundCategory(soundcategory);
Validate.notNull(soundcategory, "Invalid category", new Object[0]);
if (jsonobject.has("sounds"))
{
JsonArray jsonarray = JsonUtils.getJsonArray(jsonobject, "sounds");
for (int i = 0; i < jsonarray.size(); ++i)
{
JsonElement jsonelement = jsonarray.get(i);
SoundList.SoundEntry soundlist$soundentry = new SoundList.SoundEntry();
if (JsonUtils.isString(jsonelement))
{
soundlist$soundentry.setSoundEntryName(JsonUtils.getString(jsonelement, "sound"));
}
else
{
JsonObject jsonobject1 = JsonUtils.getJsonObject(jsonelement, "sound");
soundlist$soundentry.setSoundEntryName(JsonUtils.getString(jsonobject1, "name"));
if (jsonobject1.has("type"))
{
SoundList.SoundEntry.Type soundlist$soundentry$type = SoundList.SoundEntry.Type.getType(JsonUtils.getString(jsonobject1, "type"));
Validate.notNull(soundlist$soundentry$type, "Invalid type", new Object[0]);
soundlist$soundentry.setSoundEntryType(soundlist$soundentry$type);
}
if (jsonobject1.has("volume"))
{
float f = JsonUtils.getFloat(jsonobject1, "volume");
Validate.isTrue(f > 0.0F, "Invalid volume", new Object[0]);
soundlist$soundentry.setSoundEntryVolume(f);
}
if (jsonobject1.has("pitch"))
{
float f1 = JsonUtils.getFloat(jsonobject1, "pitch");
Validate.isTrue(f1 > 0.0F, "Invalid pitch", new Object[0]);
soundlist$soundentry.setSoundEntryPitch(f1);
}
if (jsonobject1.has("weight"))
{
int j = JsonUtils.getInt(jsonobject1, "weight");
Validate.isTrue(j > 0, "Invalid weight", new Object[0]);
soundlist$soundentry.setSoundEntryWeight(j);
}
if (jsonobject1.has("stream"))
{
soundlist$soundentry.setStreaming(JsonUtils.getBoolean(jsonobject1, "stream"));
}
}
soundlist.getSoundList().add(soundlist$soundentry);
}
}
return soundlist;
}
示例7: parseBlendNode
import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public static JsonBlendingMode parseBlendNode(JsonObject json)
{
if (json == null)
{
return new JsonBlendingMode();
}
else
{
int i = 32774;
int j = 1;
int k = 0;
int l = 1;
int i1 = 0;
boolean flag = true;
boolean flag1 = false;
if (JsonUtils.isString(json, "func"))
{
i = stringToBlendFunction(json.get("func").getAsString());
if (i != 32774)
{
flag = false;
}
}
if (JsonUtils.isString(json, "srcrgb"))
{
j = stringToBlendFactor(json.get("srcrgb").getAsString());
if (j != 1)
{
flag = false;
}
}
if (JsonUtils.isString(json, "dstrgb"))
{
k = stringToBlendFactor(json.get("dstrgb").getAsString());
if (k != 0)
{
flag = false;
}
}
if (JsonUtils.isString(json, "srcalpha"))
{
l = stringToBlendFactor(json.get("srcalpha").getAsString());
if (l != 1)
{
flag = false;
}
flag1 = true;
}
if (JsonUtils.isString(json, "dstalpha"))
{
i1 = stringToBlendFactor(json.get("dstalpha").getAsString());
if (i1 != 0)
{
flag = false;
}
flag1 = true;
}
return flag ? new JsonBlendingMode() : (flag1 ? new JsonBlendingMode(j, k, l, i1, i) : new JsonBlendingMode(j, k, i));
}
}
示例8: 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);
}