本文整理汇总了Java中net.minecraft.util.JsonUtils.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java JsonUtils.getBoolean方法的具体用法?Java JsonUtils.getBoolean怎么用?Java JsonUtils.getBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.JsonUtils
的用法示例。
在下文中一共展示了JsonUtils.getBoolean方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserialize
import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public BlockPart deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
JsonObject jsonobject = p_deserialize_1_.getAsJsonObject();
Vector3f vector3f = this.parsePositionFrom(jsonobject);
Vector3f vector3f1 = this.parsePositionTo(jsonobject);
BlockPartRotation blockpartrotation = this.parseRotation(jsonobject);
Map<EnumFacing, BlockPartFace> map = this.parseFacesCheck(p_deserialize_3_, jsonobject);
if (jsonobject.has("shade") && !JsonUtils.isBoolean(jsonobject, "shade"))
{
throw new JsonParseException("Expected shade to be a Boolean");
}
else
{
boolean flag = JsonUtils.getBoolean(jsonobject, "shade", true);
return new BlockPart(vector3f, vector3f1, map, blockpartrotation, flag);
}
}
示例2: parse
import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
@Override
public IRecipe parse(JsonContext context, JsonObject json) {
int clamp = JsonUtils.getInt(json, "clamp");
boolean combining = JsonUtils.getBoolean(json, "combining");
JsonArray upgradeList = JsonUtils.getJsonArray(json, "upgrades");
Map<Ingredient, Double> upgrades = new LinkedHashMap<>();
int n = 0;
for (JsonElement element : upgradeList) {
if (element.isJsonObject()) {
JsonObject upgrade = element.getAsJsonObject();
double amount = JsonUtils.getFloat(upgrade, "amount");
Ingredient ingredient = CraftingHelper.getIngredient(upgrade.get("ingredient"), context);
upgrades.put(ingredient, amount);
} else {
throw new JsonSyntaxException("Expected " + n + " to be a JsonObject, was " + JsonUtils.toString(json));
}
n++;
}
return new RandoresForgeUpgradeRecipe(clamp, combining, upgrades);
}
示例3: parseRotation
import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
@Nullable
private BlockPartRotation parseRotation(JsonObject object)
{
BlockPartRotation blockpartrotation = null;
if (object.has("rotation"))
{
JsonObject jsonobject = JsonUtils.getJsonObject(object, "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;
}
示例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;
}
示例5: 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);
}
示例6: deserializeSound
import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
private Sound deserializeSound(JsonObject object)
{
String s = JsonUtils.getString(object, "name");
Sound.Type sound$type = this.deserializeType(object, Sound.Type.FILE);
float f = JsonUtils.getFloat(object, "volume", 1.0F);
Validate.isTrue(f > 0.0F, "Invalid volume", new Object[0]);
float f1 = JsonUtils.getFloat(object, "pitch", 1.0F);
Validate.isTrue(f1 > 0.0F, "Invalid pitch", new Object[0]);
int i = JsonUtils.getInt(object, "weight", 1);
Validate.isTrue(i > 0, "Invalid weight", new Object[0]);
boolean flag = JsonUtils.getBoolean(object, "stream", false);
return new Sound(s, f, f1, i, sound$type, flag);
}
示例7: getAmbientOcclusionEnabled
import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
protected boolean getAmbientOcclusionEnabled(JsonObject p_178328_1_)
{
return JsonUtils.getBoolean(p_178328_1_, "ambientocclusion", true);
}
示例8: TwitchStream
import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public TwitchStream(Minecraft mcIn, final Property streamProperty)
{
this.mc = mcIn;
this.broadcastController = new BroadcastController();
this.chatController = new ChatController();
this.broadcastController.func_152841_a(this);
this.chatController.func_152990_a(this);
this.broadcastController.func_152842_a("nmt37qblda36pvonovdkbopzfzw3wlq");
this.chatController.func_152984_a("nmt37qblda36pvonovdkbopzfzw3wlq");
this.twitchComponent.getChatStyle().setColor(EnumChatFormatting.DARK_PURPLE);
if (streamProperty != null && !Strings.isNullOrEmpty(streamProperty.getValue()) && OpenGlHelper.framebufferSupported)
{
Thread thread = new Thread("Twitch authenticator")
{
public void run()
{
try
{
URL url = new URL("https://api.twitch.tv/kraken?oauth_token=" + URLEncoder.encode(streamProperty.getValue(), "UTF-8"));
String s = HttpUtil.get(url);
JsonObject jsonobject = JsonUtils.getJsonObject((new JsonParser()).parse(s), "Response");
JsonObject jsonobject1 = JsonUtils.getJsonObject(jsonobject, "token");
if (JsonUtils.getBoolean(jsonobject1, "valid"))
{
String s1 = JsonUtils.getString(jsonobject1, "user_name");
TwitchStream.LOGGER.debug(TwitchStream.STREAM_MARKER, "Authenticated with twitch; username is {}", new Object[] {s1});
AuthToken authtoken = new AuthToken();
authtoken.data = streamProperty.getValue();
TwitchStream.this.broadcastController.func_152818_a(s1, authtoken);
TwitchStream.this.chatController.func_152998_c(s1);
TwitchStream.this.chatController.func_152994_a(authtoken);
Runtime.getRuntime().addShutdownHook(new Thread("Twitch shutdown hook")
{
public void run()
{
TwitchStream.this.shutdownStream();
}
});
TwitchStream.this.broadcastController.func_152817_A();
TwitchStream.this.chatController.func_175984_n();
}
else
{
TwitchStream.this.authFailureReason = IStream.AuthFailureReason.INVALID_TOKEN;
TwitchStream.LOGGER.error(TwitchStream.STREAM_MARKER, "Given twitch access token is invalid");
}
}
catch (IOException ioexception)
{
TwitchStream.this.authFailureReason = IStream.AuthFailureReason.ERROR;
TwitchStream.LOGGER.error(TwitchStream.STREAM_MARKER, (String)"Could not authenticate with twitch", (Throwable)ioexception);
}
}
};
thread.setDaemon(true);
thread.start();
}
}
示例9: 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);
}
示例10: parseUvLock
import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
private boolean parseUvLock(JsonObject p_178429_1_)
{
return JsonUtils.getBoolean(p_178429_1_, "uvlock", false);
}
示例11: getAmbientOcclusionEnabled
import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
protected boolean getAmbientOcclusionEnabled(JsonObject object)
{
return JsonUtils.getBoolean(object, "ambientocclusion", true);
}
示例12: deserialize
import net.minecraft.util.JsonUtils; //导入方法依赖的package包/类
public EntityOnFire deserialize(JsonElement element, JsonDeserializationContext deserializationContext)
{
return new EntityOnFire(JsonUtils.getBoolean(element, "on_fire"));
}