82327c1d |
1 | /* |
2 | * Decompiled with CFR 0.151. |
3 | * |
4 | * Could not load the following classes: |
5 | * com.wurmonline.client.game.PlayerPosition |
6 | */ |
7 | package net.encode.wurmesp.feature; |
8 | |
9 | import com.wurmonline.client.game.PlayerPosition; |
10 | import net.encode.wurmesp.WurmEspMod; |
11 | import net.encode.wurmesp.util.RenderUtils; |
12 | import net.encode.wurmesp.util.TerrainUtils; |
13 | |
14 | public class FeatureTilesWalkable |
15 | extends Feature { |
16 | @Override |
17 | public void refresh() { |
18 | WurmEspMod._closeByWalkableTerrain.clear(); |
19 | WurmEspMod._terrainBuffer2 = this.world.getNearTerrainBuffer(); |
20 | PlayerPosition pos = this.world.getPlayer().getPos(); |
21 | int px = pos.getTileX(); |
22 | int py = pos.getTileY(); |
23 | int size = 6; |
24 | int sx = px - size / 2; |
25 | int sy = py - size / 2; |
26 | float ox = this.world.getRenderOriginX(); |
27 | float oy = this.world.getRenderOriginY(); |
28 | for (int x = 0; x < size + 1; ++x) { |
29 | for (int y = 0; y < size + 1; ++y) { |
30 | float tileX = x + sx; |
31 | float tileY = y + sy; |
32 | float curX = tileX * 4.0f - ox; |
33 | float curY = tileY * 4.0f - oy; |
34 | float nextX = (tileX + 1.0f) * 4.0f - ox; |
35 | float nextY = (tileY + 1.0f) * 4.0f - oy; |
36 | float x0 = curX + 0.2f; |
37 | float y0 = curY + 0.2f; |
38 | float x1 = nextX - 0.2f; |
39 | float y1 = nextY - 0.2f; |
40 | float z0 = WurmEspMod._terrainBuffer2.getHeight((int)tileX, (int)tileY); |
41 | float z1 = WurmEspMod._terrainBuffer2.getHeight((int)tileX + 1, (int)tileY); |
42 | float z2 = WurmEspMod._terrainBuffer2.getHeight((int)tileX, (int)tileY + 1); |
43 | float z3 = WurmEspMod._terrainBuffer2.getHeight((int)tileX + 1, (int)tileY + 1); |
44 | WurmEspMod._closeByWalkableTerrain.add(new float[]{x0, z0, y0, x1, z1, y0, x0, z2, y1, x1, z3, y1}); |
45 | } |
46 | } |
47 | } |
48 | |
49 | @Override |
50 | public void queue() { |
51 | if (WurmEspMod._closeByWalkableTerrain == null) { |
52 | return; |
53 | } |
54 | WurmEspMod._closeByWalkableTerrain.stream().filter(t -> TerrainUtils.isNotRideable(t)).forEachOrdered(t -> { |
55 | float[] color = new float[]{1.0f, 0.0f, 0.0f, 0.5f}; |
56 | int[] indexdata = new int[]{1, 0, 0, 2, 2, 3, 3, 1}; |
57 | RenderUtils.renderPrimitiveLines(4, t, indexdata, this.queuePick, color); |
58 | }); |
59 | } |
60 | } |
61 | |