API Surface (1)
void emit(final GizmoPrimitives primitives, final float alphaMultiplier)
Fields & Constants (2)
CIRCLE_VERTICES
SEGMENT_SIZE_RADIANS
Code Graph: Dependencies (4)
Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.
Full Source
CircleGizmo.java36 lines · Minecraft 26.3 · verbatim
| 1 | package net.minecraft.gizmos;
|
| 2 |
|
| 3 | import net.minecraft.world.phys.Vec3;
|
| 4 |
|
| 5 | public record CircleGizmo(Vec3 pos, float radius, GizmoStyle style) implements Gizmo {
|
| 6 | private static final int CIRCLE_VERTICES = 20;
|
| 7 | private static final float SEGMENT_SIZE_RADIANS = (float) (Math.PI / 10);
|
| 8 |
|
| 9 | @Override
|
| 10 | public void emit(final GizmoPrimitives primitives, final float alphaMultiplier) {
|
| 11 | if (this.style.hasStroke() || this.style.hasFill()) {
|
| 12 | Vec3[] points = new Vec3[21];
|
| 13 |
|
| 14 | for (int i = 0; i < 20; i++) {
|
| 15 | float theta = i * (float) (Math.PI / 10);
|
| 16 | Vec3 point = this.pos.add((float)(this.radius * Math.cos(theta)), 0.0, (float)(this.radius * Math.sin(theta)));
|
| 17 | points[i] = point;
|
| 18 | }
|
| 19 |
|
| 20 | points[20] = points[0];
|
| 21 | if (this.style.hasFill()) {
|
| 22 | int color = this.style.multipliedFill(alphaMultiplier);
|
| 23 | primitives.addTriangleFan(points, color);
|
| 24 | }
|
| 25 |
|
| 26 | if (this.style.hasStroke()) {
|
| 27 | int color = this.style.multipliedStroke(alphaMultiplier);
|
| 28 |
|
| 29 | for (int i = 0; i < 20; i++) {
|
| 30 | primitives.addLine(points[i], points[i + 1], color, this.style.strokeWidth());
|
| 31 | }
|
| 32 | }
|
| 33 | }
|
| 34 | }
|
| 35 | }
|
| 36 |
|
Decompiled Minecraft 26.3 source of CircleGizmo (net/minecraft/gizmos/CircleGizmo.java) with Mojang official mappings, stored verbatim on the site.