InteractionCameraSettings class
Пакет: com.hypixel.hytale.server.core.modules.interaction.interaction.config
Файл: com/hypixel/hytale/server/core/modules/interaction/interaction/config/InteractionCameraSettings.java
implements: NetworkSerializable<com.hypixel.hytale.protocol.InteractionCameraSettings>
Поля (9)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
BuilderCodec<InteractionCameraSettings> |
CODEC |
|
public static final BuilderCodec<InteractionCameraSettings.InteractionCamera> |
CODEC |
|
private Vector3f |
position |
|
private Direction |
rotation |
|
private float |
time |
|
com.hypixel.hytale.protocol.InteractionCameraSettings |
var1 |
|
com.hypixel.hytale.protocol.InteractionCamera |
var1 |
|
float |
var2 |
|
|
var2 |
Методы (10)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
public |
InteractionCamerapublic InteractionCamera() |
|
|
for for(InteractionCameraSettings.InteractionCamera var6 : var0) |
|
|
for for(int var2 = 0; var2 < this.firstPerson.length; var2++) |
|
|
for for(int var3 = 0; var3 < this.thirdPerson.length; var3++) |
|
|
if if(var0 != null) |
|
|
if if(var6.time <= var2) |
|
|
if if(this.firstPerson != null) |
|
|
if if(this.thirdPerson != null) |
|
public com.hypixel.hytale.protocol.InteractionCamera |
toPacketpublic com.hypixel.hytale.protocol.InteractionCamera toPacket() |
|
public String |
toStringpublic String toString() |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.modules.interaction.interaction.config;
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.codec.codecs.array.ArrayCodec;
class="kw">import com.hypixel.hytale.codec.validation.LegacyValidator;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.math.vector.Vector3fUtil;
class="kw">import com.hypixel.hytale.protocol.Direction;
class="kw">import com.hypixel.hytale.server.core.codec.ProtocolCodecs;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializable;
class="kw">import java.util.Arrays;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3f;
class="kw">public class InteractionCameraSettings class="kw">implements NetworkSerializable<com.hypixel.hytale.protocol.InteractionCameraSettings> {
class="kw">public class="kw">static class="kw">final BuilderCodec<InteractionCameraSettings> CODEC = BuilderCodec.builder(InteractionCameraSettings.class, InteractionCameraSettings::new)
.appendInherited(
new KeyedCodec<>(
"FirstPerson", new ArrayCodec<>(InteractionCameraSettings.InteractionCamera.CODEC, InteractionCameraSettings.InteractionCamera[]::new)
),
(var0, var1) -> var0.firstPerson = var1,
var0 -> var0.firstPerson,
(var0, var1) -> var0.firstPerson = var1.firstPerson
)
.addValidator(getInteractionCameraValidator())
.add()
.<InteractionCameraSettings.InteractionCamera[]>appendInherited(
new KeyedCodec<>(
"ThirdPerson", new ArrayCodec<>(InteractionCameraSettings.InteractionCamera.CODEC, InteractionCameraSettings.InteractionCamera[]::new)
),
(var0, var1) -> var0.thirdPerson = var1,
var0 -> var0.thirdPerson,
(var0, var1) -> var0.thirdPerson = var1.thirdPerson
)
.addValidator(getInteractionCameraValidator())
.add()
.build();
class="kw">private InteractionCameraSettings.InteractionCamera[] firstPerson;
class="kw">private InteractionCameraSettings.InteractionCamera[] thirdPerson;
class="kw">public InteractionCameraSettings() {
}
@Nonnull
class="kw">private class="kw">static LegacyValidator<InteractionCameraSettings.InteractionCamera[]> getInteractionCameraValidator() {
class="kw">return (var0, var1) -> {
if (var0 != null) {
float var2 = -1.0F;
for (InteractionCameraSettings.InteractionCamera var6 : var0) {
if (var6.time <= var2) {
var1.fail("Camera entry with time: " + var6.time + " conflicts with another entry");
}
var2 = var6.time;
}
}
};
}
@Nonnull
class="kw">public com.hypixel.hytale.protocol.InteractionCameraSettings toPacket() {
com.hypixel.hytale.protocol.InteractionCameraSettings var1 = new com.hypixel.hytale.protocol.InteractionCameraSettings();
if (this.firstPerson != null) {
var1.firstPerson = new com.hypixel.hytale.protocol.InteractionCamera[this.firstPerson.length];
for (int var2 = 0; var2 < this.firstPerson.length; var2++) {
var1.firstPerson[var2] = this.firstPerson[var2].toPacket();
}
}
if (this.thirdPerson != null) {
var1.thirdPerson = new com.hypixel.hytale.protocol.InteractionCamera[this.thirdPerson.length];
for (int var3 = 0; var3 < this.thirdPerson.length; var3++) {
var1.thirdPerson[var3] = this.thirdPerson[var3].toPacket();
}
}
class="kw">return var1;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "InteractionCameraSettings{firstPerson=" + Arrays.toString(this.firstPerson) + ", thirdPerson=" + Arrays.toString(this.thirdPerson) + "}";
}
class="kw">public class="kw">static class InteractionCamera class="kw">implements NetworkSerializable<com.hypixel.hytale.protocol.InteractionCamera> {
class="kw">public class="kw">static class="kw">final BuilderCodec<InteractionCameraSettings.InteractionCamera> CODEC = BuilderCodec.builder(
InteractionCameraSettings.InteractionCamera.class, InteractionCameraSettings.InteractionCamera::new
)
.appendInherited(new KeyedCodec<>("Time", Codec.FLOAT), (var0, var1) -> var0.time = var1, var0 -> var0.time, (var0, var1) -> var0.time = var1.time)
.addValidator(Validators.greaterThan(0.0F))
.add()
.<Vector3f>appendInherited(
new KeyedCodec<>("Position", Vector3fUtil.CODEC),
(var0, var1) -> var0.position = var1,
var0 -> var0.position,
(var0, var1) -> var0.position = var1.position
)
.addValidator(Validators.nonNull())
.add()
.<Direction>appendInherited(
new KeyedCodec<>("Rotation", ProtocolCodecs.DIRECTION),
(var0, var1) -> {
var0.rotation = var1;
var0.rotation.yaw *= (float) (Math.PI / 180.0);
var0.rotation.pitch *= (float) (Math.PI / 180.0);
var0.rotation.roll *= (float) (Math.PI / 180.0);
},
var0 -> new Direction(
var0.rotation.yaw * (180.0F / (float)Math.PI), var0.rotation.pitch * (180.0F / (float)Math.PI), var0.rotation.roll * (180.0F / (float)Math.PI)
),
(var0, var1) -> var0.rotation = var1.rotation
)
.addValidator(Validators.nonNull())
.add()
.build();
class="kw">private float time = 0.1F;
class="kw">private Vector3f position = new Vector3f(0.0F, 0.0F, 0.0F);
class="kw">private Direction rotation = new Direction(0.0F, 0.0F, 0.0F);
class="kw">public InteractionCamera() {
}
@Nonnull
class="kw">public com.hypixel.hytale.protocol.InteractionCamera toPacket() {
com.hypixel.hytale.protocol.InteractionCamera var1 = new com.hypixel.hytale.protocol.InteractionCamera();
var1.time = this.time;
var1.position = this.position;
var1.rotation = this.rotation;
class="kw">return var1;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "InteractionCamera{time=" + this.time + ", position=" + this.position + ", rotation=" + this.rotation + "}";
}
}
}