MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / parseAxis

Method parseAxis

src/main/java/net/optifine/CustomSkyLayer.java:196–248  ·  view source on GitHub ↗
(String str, float[] defVal)

Source from the content-addressed store, hash-verified

194 }
195
196 private float[] parseAxis(String str, float[] defVal)
197 {
198 if (str == null)
199 {
200 return defVal;
201 }
202 else
203 {
204 String[] astring = Config.tokenize(str, " ");
205
206 if (astring.length != 3)
207 {
208 Config.warn("Invalid axis: " + str);
209 return defVal;
210 }
211 else
212 {
213 float[] afloat = new float[3];
214
215 for (int i = 0; i < astring.length; ++i)
216 {
217 afloat[i] = Config.parseFloat(astring[i], Float.MIN_VALUE);
218
219 if (afloat[i] == Float.MIN_VALUE)
220 {
221 Config.warn("Invalid axis: " + str);
222 return defVal;
223 }
224
225 if (afloat[i] < -1.0F || afloat[i] > 1.0F)
226 {
227 Config.warn("Invalid axis values: " + str);
228 return defVal;
229 }
230 }
231
232 float f2 = afloat[0];
233 float f = afloat[1];
234 float f1 = afloat[2];
235
236 if (f2 * f2 + f * f + f1 * f1 < 1.0E-5F)
237 {
238 Config.warn("Invalid axis values: " + str);
239 return defVal;
240 }
241 else
242 {
243 float[] afloat1 = new float[] {f1, f, -f2};
244 return afloat1;
245 }
246 }
247 }
248 }
249
250 public boolean isValid(String path)
251 {

Callers 1

CustomSkyLayerMethod · 0.95

Calls 3

tokenizeMethod · 0.95
warnMethod · 0.95
parseFloatMethod · 0.95

Tested by

no test coverage detected