2 * Decompiled with CFR 0.151.
4 * Could not load the following classes:
5 * com.wurmonline.client.game.PlayerPosition
6 * com.wurmonline.client.renderer.Color
7 * com.wurmonline.client.renderer.HitNamesData
8 * com.wurmonline.client.renderer.backend.RenderState
9 * com.wurmonline.client.renderer.cave.CaveRender
10 * com.wurmonline.mesh.Tiles$Tile
12 package net
.encode
.wurmesp
.feature
;
14 import com
.wurmonline
.client
.game
.PlayerPosition
;
15 import com
.wurmonline
.mesh
.Tiles
;
16 import java
.awt
.Color
;
17 import java
.util
.logging
.Level
;
18 import java
.util
.logging
.Logger
;
19 import net
.encode
.wurmesp
.WurmEspMod
;
20 import net
.encode
.wurmesp
.util
.RenderUtils
;
21 import net
.encode
.wurmesp
.util
.XrayColors
;
23 public class FeatureXRay
26 public void refresh() {
27 if (!this.world
.isOwnBodyAdded()) {
30 WurmEspMod
._terrain
.clear();
31 WurmEspMod
._caveBuffer
= this.world
.getCaveBuffer();
32 PlayerPosition pos
= this.world
.getPlayer().getPos();
33 int px
= pos
.getTileX();
34 int py
= pos
.getTileY();
35 int size
= WurmEspMod
.xraydiameter
;
36 int sx
= px
- size
/ 2;
37 int sy
= py
- size
/ 2;
38 float ox
= this.world
.getRenderOriginX();
39 float oy
= this.world
.getRenderOriginY();
40 for (int x
= 0; x
< size
; ++x
) {
41 for (int y
= size
- 1; y
>= 0; --y
) {
45 Tiles
.Tile tile
= WurmEspMod
._caveBuffer
.getTileType(tileX
, tileY
);
46 if (tile
== null || !tile
.isOreCave()) continue;
47 Color color
= XrayColors
.getColorFor(tile
);
48 float[] colorF
= new float[]{(float)color
.getRed() / 255.0f, (float)color
.getGreen() / 255.0f, (float)color
.getBlue() / 255.0f};
49 float curX
= (float)(tileX
* 4) - ox
;
50 float curY
= (float)(tileY
* 4) - oy
;
51 float nextX
= (float)((tileX
+ 1) * 4) - ox
;
52 float nextY
= (float)((tileY
+ 1) * 4) - oy
;
53 float x0
= curX
+ 0.2f;
54 float y0
= curY
+ 0.2f;
55 float x1
= nextX
- 0.2f;
56 float y1
= nextY
- 0.2f;
57 WurmEspMod
._terrain
.add(new float[]{x0
, y0
, x1
, y1
, colorF
[0], colorF
[1], colorF
[2]});
60 catch (IllegalArgumentException
| SecurityException ex
) {
61 Logger
.getLogger(FeatureXRay
.class.getName()).log(Level
.SEVERE
, null, ex
);
69 if (WurmEspMod
._terrain
== null) {
72 WurmEspMod
._terrain
.stream().forEach(t
-> {
78 float[] color
= new float[]{t
[4],t
[5],t
[6], 1.0F};
79 PlayerPosition pos
= this.world
.getPlayer().getPos();
81 float z0
= pos
.getH();
84 float[] vertexdata
= new float[] {
94 int[] indexdata
= new int[] { 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 };
95 RenderUtils
.renderPrimitiveLines(8, vertexdata
, indexdata
, this.queuePick
, color
);
98 if (!this.world.isOwnBodyAdded()) {
101 WurmEspMod._terrain.clear();
102 WurmEspMod._caveBuffer = this.world.getCaveBuffer();
103 PlayerPosition pos = this.world.getPlayer().getPos();
104 int px = pos.getTileX();
105 int py = pos.getTileY();
106 int size = WurmEspMod.xraydiameter;
107 int sx = px - size / 2;
108 int sy = py - size / 2;
109 WorldRender worldRenderer = (WorldRender)ReUtils.getField(this.world, "worldRenderer");
110 CaveRender caveRenderer = (CaveRender)ReUtils.getField(worldRenderer, "caveRenderer");
111 for (int x = 0; x < size; ++x) {
112 for (int y = size - 1; y >= 0; --y) {
116 for (int side = 0; side < 7; ++side) {
117 IntBuffer intBuffer = IntBuffer.allocate(3);
118 intBuffer.put(tileX);
119 intBuffer.put(tileY);
121 Class<HitNamesData> cls = HitNamesData.class;
122 Constructor<HitNamesData> constructor = cls.getDeclaredConstructor(IntBuffer.class, Integer.TYPE);
123 constructor.setAccessible(true);
124 HitNamesData hitNames = (HitNamesData)constructor.newInstance(intBuffer, 3);
125 caveRenderer.getPickedWall(hitNames).renderPicked(this.queuePick, RenderState.RENDERSTATE_DEFAULT, com.wurmonline.client.renderer.Color.GREEN);
129 catch (IllegalAccessException | IllegalArgumentException | InstantiationException | NoSuchMethodException | SecurityException | InvocationTargetException ex) {
130 Logger.getLogger(FeatureXRay.class.getName()).log(Level.SEVERE, null, ex);