82327c1d |
1 | /* |
2 | * Decompiled with CFR 0.151. |
3 | */ |
4 | package net.encode.wurmesp.util; |
5 | |
6 | import net.encode.wurmesp.WurmEspMod; |
7 | |
8 | public class TerrainUtils { |
9 | public static boolean isFlat(float[] tile) { |
10 | return tile[1] == tile[4] && tile[4] == tile[7] && tile[7] == tile[10]; |
11 | } |
12 | |
13 | public static boolean isNotRideable(float[] tile) { |
14 | return TerrainUtils.getTileSteepness(tile)[1] >= WurmEspMod.tilenotrideable; |
15 | } |
16 | |
17 | public static short[] getTileSteepness(float[] tile) { |
18 | short highest = -100; |
19 | short lowest = 32000; |
20 | for (int i = 1; i <= 10; i += 3) { |
21 | short height = 0; |
22 | height = (short)(tile[i] * 10.0f); |
23 | if (height > highest) { |
24 | highest = height; |
25 | } |
26 | if (height >= lowest) continue; |
27 | lowest = height; |
28 | } |
29 | int med = (highest + lowest) / 2; |
30 | return new short[]{(short)med, (short)(highest - lowest)}; |
31 | } |
32 | } |
33 | |