Rotations.java
net.minecraft.core.Rotations
信息
- 全限定名:net.minecraft.core.Rotations
- 类型:public record
- 包:net.minecraft.core
- 源码路径:src/main/java/net/minecraft/core/Rotations.java
- 起始行号:L9
- 职责:
TODO
字段/常量
-
CODEC- 类型:
Codec<Rotations> - 修饰符:
public static final - 源码定位:
L10 - 说明:
TODO
- 类型:
-
STREAM_CODEC- 类型:
StreamCodec<ByteBuf,Rotations> - 修饰符:
public static final public public - 源码定位:
L16 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public Rotations(float x, float y, float z) @ L28
- 构造器名:Rotations
- 源码定位:L28
- 修饰符:public
参数:
- x: float
- y: float
- z: float
说明:
TODO
方法
下面的方法块按源码顺序生成。
- 无
代码
public record Rotations(float x, float y, float z) {
public static final Codec<Rotations> CODEC = Codec.FLOAT
.listOf()
.comapFlatMap(
input -> Util.fixedSize((List<Float>)input, 3).map(floats -> new Rotations(floats.get(0), floats.get(1), floats.get(2))),
rotations -> List.of(rotations.x(), rotations.y(), rotations.z())
);
public static final StreamCodec<ByteBuf, Rotations> STREAM_CODEC = new StreamCodec<ByteBuf, Rotations>() {
public Rotations decode(ByteBuf input) {
return new Rotations(input.readFloat(), input.readFloat(), input.readFloat());
}
public void encode(ByteBuf output, Rotations value) {
output.writeFloat(value.x);
output.writeFloat(value.y);
output.writeFloat(value.z);
}
};
public Rotations(float x, float y, float z) {
x = !Float.isInfinite(x) && !Float.isNaN(x) ? x % 360.0F : 0.0F;
y = !Float.isInfinite(y) && !Float.isNaN(y) ? y % 360.0F : 0.0F;
z = !Float.isInfinite(z) && !Float.isNaN(z) ? z % 360.0F : 0.0F;
this.x = x;
this.y = y;
this.z = z;
}
}引用的其他类
-
- 引用位置:
字段
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Util.fixedSize()
- 引用位置: