Gets the float value of the given JsonElement. Expects the second parameter to be the name of the element's field if an error message needs to be thrown.
(JsonElement p_151220_0_, String p_151220_1_)
| 139 | * field if an error message needs to be thrown. |
| 140 | */ |
| 141 | public static float getFloat(JsonElement p_151220_0_, String p_151220_1_) |
| 142 | { |
| 143 | if (p_151220_0_.isJsonPrimitive() && p_151220_0_.getAsJsonPrimitive().isNumber()) |
| 144 | { |
| 145 | return p_151220_0_.getAsFloat(); |
| 146 | } |
| 147 | else |
| 148 | { |
| 149 | throw new JsonSyntaxException("Expected " + p_151220_1_ + " to be a Float, was " + toString(p_151220_0_)); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * Gets the float value of the field on the JsonObject with the given name. |
no test coverage detected