-
Notifications
You must be signed in to change notification settings - Fork 25
/
RenderWaypointBeaconMixin.java
40 lines (35 loc) · 1.58 KB
/
RenderWaypointBeaconMixin.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.sinthoras.visualprospecting.mixins.journeymap;
import com.sinthoras.visualprospecting.integration.journeymap.JourneyMapState;
import com.sinthoras.visualprospecting.integration.journeymap.waypoints.WaypointManager;
import journeymap.client.model.Waypoint;
import journeymap.client.render.ingame.RenderWaypointBeacon;
import net.minecraft.client.Minecraft;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(RenderWaypointBeacon.class)
public class RenderWaypointBeaconMixin {
@Shadow(remap = false)
static Minecraft mc;
@Shadow(remap = false)
static void doRender(Waypoint waypoint) {
throw new IllegalStateException("Mixin failed to shadow doRender()");
}
@Inject(method = "renderAll",
at = @At(value = "INVOKE",
target = "Ljourneymap/client/waypoint/WaypointStore;instance()Ljourneymap/client/waypoint/WaypointStore;"),
remap = false,
require = 1)
private static void onRenderAll(CallbackInfo callbackInfo) {
for(WaypointManager waypointManager : JourneyMapState.instance.waypointManagers) {
if(waypointManager.hasWaypoint()) {
final Waypoint waypoint = waypointManager.getJmWaypoint();
if(waypoint.getDimensions().contains(mc.thePlayer.dimension)) {
doRender(waypoint);
}
}
}
}
}