RaidDebugRenderer .java

net.minecraft.client.renderer.debug.RaidDebugRenderer (class): members: MAX_RENDER_DIST, TEXT_SCALE, frustum, emitGizmos, minecraft. imports: GizmoStyle.

net.minecraft.client.renderer.debugclass54 linesclient1.9 KB

Implements

API Surface (1)

void emitGizmos(final double camX, final double camY, final double camZ, final DebugValueAccess debugValues, final Frustum frustum, final float partialTicks)

Fields & Constants (4)

MAX_RENDER_DIST
TEXT_SCALE
minecraft
frustum

String literals (1)

"Raid center"

Full Source

RaidDebugRenderer.java54 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.renderer.debug;
2
3
import net.fabricmc.api.EnvType;
4
import net.fabricmc.api.Environment;
5
import net.minecraft.client.Camera;
6
import net.minecraft.client.Minecraft;
7
import net.minecraft.client.renderer.culling.Frustum;
8
import net.minecraft.core.BlockPos;
9
import net.minecraft.gizmos.GizmoStyle;
10
import net.minecraft.gizmos.Gizmos;
11
import net.minecraft.gizmos.TextGizmo.Style;
12
import net.minecraft.util.ARGB;
13
import net.minecraft.util.debug.DebugSubscriptions;
14
import net.minecraft.util.debug.DebugValueAccess;
15
import net.minecraft.world.phys.Vec3;
16
17
@Environment(EnvType.CLIENT)
18
public class RaidDebugRenderer implements DebugRenderer.SimpleDebugRenderer {
19
	private static final int MAX_RENDER_DIST = 160;
20
	private static final float TEXT_SCALE = 0.64F;
21
	private final Minecraft minecraft;
22
23
	public RaidDebugRenderer(final Minecraft minecraft) {
24
		this.minecraft = minecraft;
25
	}
26
27
	@Override
28
	public void emitGizmos(
29
		final double camX, final double camY, final double camZ, final DebugValueAccess debugValues, final Frustum frustum, final float partialTicks
30
	) {
31
		BlockPos playerPos = this.getCamera().blockPosition();
32
		debugValues.forEachChunk(DebugSubscriptions.RAIDS, (chunkPos, raidCenters) -> {
33
			for (BlockPos raidCenter : raidCenters) {
34
				if (playerPos.closerThan(raidCenter, 160.0)) {
35
					highlightRaidCenter(raidCenter);
36
				}
37
			}
38
		});
39
	}
40
41
	private static void highlightRaidCenter(final BlockPos raidCenter) {
42
		Gizmos.cuboid(raidCenter, GizmoStyle.fill(ARGB.colorFromFloat(0.15F, 1.0F, 0.0F, 0.0F)));
43
		renderTextOverBlock("Raid center", raidCenter, -65536);
44
	}
45
46
	private static void renderTextOverBlock(final String text, final BlockPos pos, final int color) {
47
		Gizmos.billboardText(text, Vec3.atLowerCornerWithOffset(pos, 0.5, 1.3, 0.5), Style.forColor(color).withScale(0.64F)).setAlwaysOnTop();
48
	}
49
50
	private Camera getCamera() {
51
		return this.minecraft.gameRenderer.mainCamera();
52
	}
53
}
54

Decompiled Minecraft 26.3 source of RaidDebugRenderer (net/minecraft/client/renderer/debug/RaidDebugRenderer.java) with Mojang official mappings, stored verbatim on the site.