BlockMountPoint class
Пакет: com.hypixel.hytale.server.core.asset.type.blocktype.config.mountpoints
Файл: com/hypixel/hytale/server/core/asset/type/blocktype/config/mountpoints/BlockMountPoint.java
Поля (4)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
BuilderCodec<BlockMountPoint> |
CODEC |
|
RotationTuple |
var2 |
|
Rotation3f |
var3 |
|
Vector3d |
var4 |
Методы (2)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
Vector3dc |
getOffsetVector3dc getOffset() |
public |
float |
getYawOffSetDegreesfloat getYawOffSetDegrees() |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.type.blocktype.config.mountpoints;
class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.math.vector.Rotation3f;
class="kw">import com.hypixel.hytale.math.vector.Vector3dUtil;
class="kw">import com.hypixel.hytale.math.vector.Vector3iUtil;
class="kw">import com.hypixel.hytale.server.core.asset.type.blocktype.config.Rotation;
class="kw">import com.hypixel.hytale.server.core.asset.type.blocktype.config.RotationTuple;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3d;
class="kw">import org.joml.Vector3dc;
class="kw">import org.joml.Vector3i;
class="kw">public class BlockMountPoint {
class="kw">public class="kw">static class="kw">final BuilderCodec<BlockMountPoint> CODEC = BuilderCodec.builder(BlockMountPoint.class, BlockMountPoint::new)
.appendInherited(
new KeyedCodec<>("Offset", Vector3dUtil.CODEC),
(var0, var1) -> var0.offset.set(var1),
var0 -> var0.offset,
(var0, var1) -> var0.offset.set(var1.offset)
)
.documentation("Relative offset from the block center (the point at .5,.5,.5 in world). Forward on a chair is 0,0,0.3")
.add()
.<Double>appendInherited(
new KeyedCodec<>("Yaw", Codec.DOUBLE),
(var0, var1) -> var0.yawOffSetDegrees = var1.floatValue(),
var0 -> (double)var0.yawOffSetDegrees,
(var0, var1) -> var0.yawOffSetDegrees = var1.yawOffSetDegrees
)
.documentation("Offset for the model sitting on this seat in DEGREES")
.add()
.build();
class="kw">public class="kw">static class="kw">final BlockMountPoint[] EMPTY_ARRAY = new BlockMountPoint[0];
class="kw">private class="kw">final Vector3d offset = new Vector3d();
class="kw">private float yawOffSetDegrees;
class="kw">public BlockMountPoint() {
this(new Vector3d(), 0.0F);
}
class="kw">public BlockMountPoint(Vector3dc var1, float var2) {
this.offset.set(var1);
this.yawOffSetDegrees = var2;
}
class="kw">public Vector3dc getOffset() {
class="kw">return this.offset;
}
class="kw">public float getYawOffSetDegrees() {
class="kw">return this.yawOffSetDegrees;
}
@Nonnull
class="kw">public BlockMountPoint rotate(@Nonnull Rotation var1, @Nonnull Rotation var2, @Nonnull Rotation var3) {
Vector3d var4 = Rotation.rotate(this.offset, var1, var2, var3);
class="kw">return new BlockMountPoint(var4, this.yawOffSetDegrees);
}
@Nonnull
class="kw">public Vector3d computeWorldSpacePosition(@Nonnull Vector3i var1) {
class="kw">return Vector3iUtil.toVector3d(var1).add(0.5, 0.5, 0.5).add(this.offset.x, this.offset.y, this.offset.z);
}
@Nonnull
class="kw">public Rotation3f computeRotationEuler(int var1) {
RotationTuple var2 = RotationTuple.get(var1);
Rotation3f var3 = new Rotation3f((float)var2.pitch().getRadians(), (float)var2.yaw().getRadians(), (float)var2.roll().getRadians());
var3.addYaw((float) Math.PI);
var3.addYaw((float)Math.toRadians(this.yawOffSetDegrees));
class="kw">return var3;
}
}