82327c1d |
1 | /* |
2 | * Decompiled with CFR 0.151. |
3 | * |
4 | * Could not load the following classes: |
5 | * com.wurmonline.client.renderer.PickableUnit |
6 | * com.wurmonline.client.renderer.cell.CreatureCellRenderable |
7 | */ |
8 | package net.encode.wurmesp.feature.hook; |
9 | |
10 | import com.wurmonline.client.renderer.PickableUnit; |
11 | import com.wurmonline.client.renderer.cell.CellRenderable; |
12 | import com.wurmonline.client.renderer.cell.CreatureCellRenderable; |
13 | import java.util.logging.Level; |
14 | import net.encode.wurmesp.Unit; |
15 | import net.encode.wurmesp.WurmEspMod; |
16 | import net.encode.wurmesp.util.SoundUtils; |
17 | |
18 | public class MobileModelRenderableInit |
19 | extends Hook { |
20 | public MobileModelRenderableInit() { |
21 | this.prepareHook("com.wurmonline.client.renderer.cell.MobileModelRenderable", "initialize", "()V", () -> (proxy, method, args) -> { |
22 | method.invoke(proxy, args); |
23 | PickableUnit pUnit = (PickableUnit)proxy; |
24 | Unit unit = new Unit(CellRenderable.world, pUnit.getId(), pUnit, ((CreatureCellRenderable)proxy).getModelName().toString(), ((CreatureCellRenderable)proxy).getHoverName()); |
25 | if (unit.isPlayer() || unit.isMob()) { |
26 | WurmEspMod.pickableUnits.add(unit); |
27 | if (unit.isUnique() && WurmEspMod.uniques && WurmEspMod.playsoundunique) { |
28 | SoundUtils.playSound(WurmEspMod.soundunique); |
29 | } |
30 | } else if (unit.isSpecial()) { |
31 | WurmEspMod.pickableUnits.add(unit); |
32 | if (WurmEspMod.specials && WurmEspMod.playsoundspecial) { |
33 | SoundUtils.playSound(WurmEspMod.soundspecial); |
34 | } |
35 | } else if (unit.isSpotted()) { |
36 | WurmEspMod.pickableUnits.add(unit); |
37 | if (WurmEspMod.items && WurmEspMod.playsounditem) { |
38 | SoundUtils.playSound(WurmEspMod.sounditem); |
39 | } |
40 | } |
41 | return null; |
42 | }); |
43 | WurmEspMod.logger.log(Level.INFO, "[WurmEspMod] MobileModelRenderable.initialize hooked"); |
44 | } |
45 | } |
46 | |