RectGizmo.java
net.minecraft.gizmos.RectGizmo
信息
- 全限定名:net.minecraft.gizmos.RectGizmo
- 类型:public record
- 包:net.minecraft.gizmos
- 源码路径:src/main/java/net/minecraft/gizmos/RectGizmo.java
- 起始行号:L6
- 实现:Gizmo
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
public static RectGizmo fromCuboidFace(Vec3 cuboidCornerA, Vec3 cuboidCornerB, Direction face, GizmoStyle style) @ L7
- 方法名:fromCuboidFace
- 源码定位:L7
- 返回类型:RectGizmo
- 修饰符:public static
参数:
- cuboidCornerA: Vec3
- cuboidCornerB: Vec3
- face: Direction
- style: GizmoStyle
说明:
TODO
public void emit(GizmoPrimitives primitives, float alphaMultiplier) @ L54
- 方法名:emit
- 源码定位:L54
- 返回类型:void
- 修饰符:public
参数:
- primitives: GizmoPrimitives
- alphaMultiplier: float
说明:
TODO
代码
public record RectGizmo(Vec3 a, Vec3 b, Vec3 c, Vec3 d, GizmoStyle style) implements Gizmo {
public static RectGizmo fromCuboidFace(Vec3 cuboidCornerA, Vec3 cuboidCornerB, Direction face, GizmoStyle style) {
return switch (face) {
case DOWN -> new RectGizmo(
new Vec3(cuboidCornerA.x, cuboidCornerA.y, cuboidCornerA.z),
new Vec3(cuboidCornerB.x, cuboidCornerA.y, cuboidCornerA.z),
new Vec3(cuboidCornerB.x, cuboidCornerA.y, cuboidCornerB.z),
new Vec3(cuboidCornerA.x, cuboidCornerA.y, cuboidCornerB.z),
style
);
case UP -> new RectGizmo(
new Vec3(cuboidCornerA.x, cuboidCornerB.y, cuboidCornerA.z),
new Vec3(cuboidCornerA.x, cuboidCornerB.y, cuboidCornerB.z),
new Vec3(cuboidCornerB.x, cuboidCornerB.y, cuboidCornerB.z),
new Vec3(cuboidCornerB.x, cuboidCornerB.y, cuboidCornerA.z),
style
);
case NORTH -> new RectGizmo(
new Vec3(cuboidCornerA.x, cuboidCornerA.y, cuboidCornerA.z),
new Vec3(cuboidCornerA.x, cuboidCornerB.y, cuboidCornerA.z),
new Vec3(cuboidCornerB.x, cuboidCornerB.y, cuboidCornerA.z),
new Vec3(cuboidCornerB.x, cuboidCornerA.y, cuboidCornerA.z),
style
);
case SOUTH -> new RectGizmo(
new Vec3(cuboidCornerA.x, cuboidCornerA.y, cuboidCornerB.z),
new Vec3(cuboidCornerB.x, cuboidCornerA.y, cuboidCornerB.z),
new Vec3(cuboidCornerB.x, cuboidCornerB.y, cuboidCornerB.z),
new Vec3(cuboidCornerA.x, cuboidCornerB.y, cuboidCornerB.z),
style
);
case WEST -> new RectGizmo(
new Vec3(cuboidCornerA.x, cuboidCornerA.y, cuboidCornerA.z),
new Vec3(cuboidCornerA.x, cuboidCornerA.y, cuboidCornerB.z),
new Vec3(cuboidCornerA.x, cuboidCornerB.y, cuboidCornerB.z),
new Vec3(cuboidCornerA.x, cuboidCornerB.y, cuboidCornerA.z),
style
);
case EAST -> new RectGizmo(
new Vec3(cuboidCornerB.x, cuboidCornerA.y, cuboidCornerA.z),
new Vec3(cuboidCornerB.x, cuboidCornerB.y, cuboidCornerA.z),
new Vec3(cuboidCornerB.x, cuboidCornerB.y, cuboidCornerB.z),
new Vec3(cuboidCornerB.x, cuboidCornerA.y, cuboidCornerB.z),
style
);
};
}
@Override
public void emit(GizmoPrimitives primitives, float alphaMultiplier) {
if (this.style.hasFill()) {
int color = this.style.multipliedFill(alphaMultiplier);
primitives.addQuad(this.a, this.b, this.c, this.d, color);
}
if (this.style.hasStroke()) {
int color = this.style.multipliedStroke(alphaMultiplier);
primitives.addLine(this.a, this.b, color, this.style.strokeWidth());
primitives.addLine(this.b, this.c, color, this.style.strokeWidth());
primitives.addLine(this.c, this.d, color, this.style.strokeWidth());
primitives.addLine(this.d, this.a, color, this.style.strokeWidth());
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/构造调用 - 关联成员:
Vec3()
- 引用位置: