ZoomConfig class
Пакет: com.hypixel.hytale.server.core.modules.interaction.interaction.config
Файл: com/hypixel/hytale/server/core/modules/interaction/interaction/config/ZoomConfig.java
implements: NetworkSerializable<com.hypixel.hytale.protocol.ZoomConfig>
Поля (2)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
float |
UNSET |
|
com.hypixel.hytale.protocol.ZoomConfig |
var1 |
Методы (16)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
float |
getInLerpfloat getInLerp() |
public |
float |
getLodMultiplierfloat getLodMultiplier() |
public |
float |
getMagnificationMultiplierfloat getMagnificationMultiplier() |
public |
float |
getMouseSensitivityMultiplierfloat getMouseSensitivityMultiplier() |
public |
float |
getOutLerpfloat getOutLerp() |
public |
float |
getOverlayFadeInPerSecondfloat getOverlayFadeInPerSecond() |
public |
float |
getOverlayFadeOutPerSecondfloat getOverlayFadeOutPerSecond() |
|
|
if if(this.magnificationMultiplier <= 0.0F) |
|
|
if if(this.lodMultiplier <= 0.0F) |
|
|
if if(this.overlayFadePerSecond < 0.0F) |
|
|
if if(this.overlayFadeInPerSecond < 0.0F) |
|
|
if if(this.overlayFadeOutPerSecond < 0.0F) |
public |
boolean |
isAllowCameraOrbitboolean isAllowCameraOrbit() |
public |
boolean |
isDepthOfFieldboolean isDepthOfField() |
public |
boolean |
isOverlayFadeboolean isOverlayFade() |
private |
void |
resolvevoid resolve() |
Исходный код
Показать/скрыть
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.EnumCodec;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.protocol.ForcedPerspective;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializable;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class ZoomConfig class="kw">implements NetworkSerializable<com.hypixel.hytale.protocol.ZoomConfig> {
class="kw">private class="kw">static class="kw">final float UNSET = Float.NaN;
class="kw">private class="kw">static class="kw">final float DEFAULT_MAGNIFICATION_MULTIPLIER = 4.0F;
class="kw">private class="kw">static class="kw">final float DEFAULT_MOUSE_SENSITIVITY_MULTIPLIER = 0.5F;
class="kw">private class="kw">static class="kw">final float DEFAULT_TRANSITION_LERP = 0.4F;
class="kw">private class="kw">static class="kw">final float DEFAULT_OVERLAY_FADE_PER_SECOND = 3.0F;
@Nonnull
class="kw">public class="kw">static class="kw">final BuilderCodec<ZoomConfig> CODEC = BuilderCodec.builder(ZoomConfig.class, ZoomConfig::new)
.documentation(
"Configuration for the shared client-side zoom system.\n\nAdding a Zoom block to an interaction step's Effects makes that step drive the zoom while it is active. All values are optional and fall back to sensible defaults."
)
.<Float>append(
new KeyedCodec<>("MagnificationMultiplier", Codec.FLOAT), (var0, var1) -> var0.magnificationMultiplier = var1, var0 -> var0.magnificationMultiplier
)
.addValidator(Validators.greaterThan(0.0F))
.documentation("How many times narrower the field of view becomes while zoomed (relative to the player's FoV).")
.add()
.<Float>append(
new KeyedCodec<>("MouseSensitivityMultiplier", Codec.FLOAT),
(var0, var1) -> var0.mouseSensitivityMultiplier = var1,
var0 -> var0.mouseSensitivityMultiplier
)
.addValidator(Validators.greaterThan(0.0F))
.documentation("Mouse sensitivity multiplier applied while zoomed (lower = steadier aim).")
.add()
.<String>append(new KeyedCodec<>("OverlayTexture", Codec.STRING), (var0, var1) -> var0.overlayTexture = var1, var0 -> var0.overlayTexture)
.documentation("Optional screen-effect texture drawn over the screen while zoomed.")
.add()
.<Boolean>append(new KeyedCodec<>("DepthOfField", Codec.BOOLEAN), (var0, var1) -> var0.depthOfField = var1, var0 -> var0.depthOfField)
.documentation("Whether to enable a depth-of-field post effect while zoomed.")
.add()
.<Boolean>append(new KeyedCodec<>("AllowCameraOrbit", Codec.BOOLEAN), (var0, var1) -> var0.allowCameraOrbit = var1, var0 -> var0.allowCameraOrbit)
.documentation(
"Whether the free-rotate orbit camera is allowed while zoomed. When false (the class="kw">default), an active orbit ends when the zoom begins and orbit cannot be started while zoomed, since its pull-back distance is field-of-view derived."
)
.add()
.<ForcedPerspective>append(
new KeyedCodec<>("ForcePerspective", new EnumCodec<>(ForcedPerspective.class)),
(var0, var1) -> var0.forcePerspective = var1,
var0 -> var0.forcePerspective
)
.documentation(
"Temporarily forces the player's camera perspective while zoomed, restoring it afterwards. None leaves the perspective untouched; FirstPerson and ThirdPerson class="kw">switch a player in the other perspective."
)
.add()
.<Float>append(new KeyedCodec<>("LodMultiplier", Codec.FLOAT), (var0, var1) -> var0.lodMultiplier = var1, var0 -> var0.lodMultiplier)
.addValidator(Validators.greaterThanOrEqual(0.0F))
.documentation("Scales entity level-of-detail distances while zoomed so distant things keep updating. 0 means scale with MagnificationMultiplier.")
.add()
.<Float>append(new KeyedCodec<>("TransitionLerp", Codec.FLOAT), (var0, var1) -> var0.transitionLerp = var1, var0 -> var0.transitionLerp)
.addValidator(Validators.greaterThan(0.0F))
.documentation(
"Shared field-of-view interpolation factor for zooming in and out: a unitless lerp weight in the 0-1 range applied each fixed movement tick (higher snaps faster, 1 is instant)."
)
.add()
.<Float>append(new KeyedCodec<>("InLerp", Codec.FLOAT), (var0, var1) -> var0.inLerp = var1, var0 -> var0.inLerp)
.documentation("Optional override for the zoom-in FoV lerp. Falls back to TransitionLerp.")
.add()
.<Float>append(new KeyedCodec<>("OutLerp", Codec.FLOAT), (var0, var1) -> var0.outLerp = var1, var0 -> var0.outLerp)
.documentation("Optional override for the zoom-out FoV lerp. Falls back to TransitionLerp.")
.add()
.<Boolean>append(new KeyedCodec<>("OverlayFade", Codec.BOOLEAN), (var0, var1) -> var0.overlayFade = var1, var0 -> var0.overlayFade)
.documentation("Whether the overlay fades in/out (false = snap on/off instantly).")
.add()
.<Float>append(new KeyedCodec<>("OverlayFadePerSecond", Codec.FLOAT), (var0, var1) -> var0.overlayFadePerSecond = var1, var0 -> var0.overlayFadePerSecond)
.addValidator(Validators.greaterThanOrEqual(0.0F))
.documentation("Shared overlay fade rate in units per second: the overlay alpha eases toward its target at this rate (higher = faster).")
.add()
.<Float>append(
new KeyedCodec<>("OverlayFadeInPerSecond", Codec.FLOAT), (var0, var1) -> var0.overlayFadeInPerSecond = var1, var0 -> var0.overlayFadeInPerSecond
)
.documentation("Optional override for the overlay fade-in rate. Falls back to OverlayFadePerSecond.")
.add()
.<Float>append(
new KeyedCodec<>("OverlayFadeOutPerSecond", Codec.FLOAT), (var0, var1) -> var0.overlayFadeOutPerSecond = var1, var0 -> var0.overlayFadeOutPerSecond
)
.documentation("Optional override for the overlay fade-out rate. Falls back to OverlayFadePerSecond.")
.add()
.afterDecode(ZoomConfig::resolve)
.build();
class="kw">private float magnificationMultiplier = 4.0F;
class="kw">private float mouseSensitivityMultiplier = 0.5F;
@Nullable
class="kw">private String overlayTexture;
class="kw">private boolean depthOfField;
class="kw">private boolean allowCameraOrbit;
@Nonnull
class="kw">private ForcedPerspective forcePerspective = ForcedPerspective.None;
class="kw">private float lodMultiplier;
class="kw">private float transitionLerp = 0.4F;
class="kw">private float inLerp = Float.NaN;
class="kw">private float outLerp = Float.NaN;
class="kw">private boolean overlayFade = true;
class="kw">private float overlayFadePerSecond = 3.0F;
class="kw">private float overlayFadeInPerSecond = Float.NaN;
class="kw">private float overlayFadeOutPerSecond = Float.NaN;
class="kw">public ZoomConfig() {
}
class="kw">private void resolve() {
if (this.magnificationMultiplier <= 0.0F) {
this.magnificationMultiplier = 4.0F;
}
if (this.lodMultiplier <= 0.0F) {
this.lodMultiplier = this.magnificationMultiplier;
}
if (Float.isNaN(this.inLerp)) {
this.inLerp = this.transitionLerp;
}
if (Float.isNaN(this.outLerp)) {
this.outLerp = this.transitionLerp;
}
if (this.overlayFadePerSecond < 0.0F) {
this.overlayFadePerSecond = 0.0F;
}
if (Float.isNaN(this.overlayFadeInPerSecond)) {
this.overlayFadeInPerSecond = this.overlayFadePerSecond;
}
if (Float.isNaN(this.overlayFadeOutPerSecond)) {
this.overlayFadeOutPerSecond = this.overlayFadePerSecond;
}
if (this.overlayFadeInPerSecond < 0.0F) {
this.overlayFadeInPerSecond = 0.0F;
}
if (this.overlayFadeOutPerSecond < 0.0F) {
this.overlayFadeOutPerSecond = 0.0F;
}
}
class="kw">public float getMagnificationMultiplier() {
class="kw">return this.magnificationMultiplier;
}
class="kw">public float getMouseSensitivityMultiplier() {
class="kw">return this.mouseSensitivityMultiplier;
}
@Nullable
class="kw">public String getOverlayTexture() {
class="kw">return this.overlayTexture;
}
class="kw">public boolean isDepthOfField() {
class="kw">return this.depthOfField;
}
class="kw">public boolean isAllowCameraOrbit() {
class="kw">return this.allowCameraOrbit;
}
@Nonnull
class="kw">public ForcedPerspective getForcePerspective() {
class="kw">return this.forcePerspective;
}
class="kw">public float getLodMultiplier() {
class="kw">return this.lodMultiplier;
}
class="kw">public float getInLerp() {
class="kw">return this.inLerp;
}
class="kw">public float getOutLerp() {
class="kw">return this.outLerp;
}
class="kw">public boolean isOverlayFade() {
class="kw">return this.overlayFade;
}
class="kw">public float getOverlayFadeInPerSecond() {
class="kw">return this.overlayFadeInPerSecond;
}
class="kw">public float getOverlayFadeOutPerSecond() {
class="kw">return this.overlayFadeOutPerSecond;
}
@Nonnull
class="kw">public com.hypixel.hytale.protocol.ZoomConfig toPacket() {
com.hypixel.hytale.protocol.ZoomConfig var1 = new com.hypixel.hytale.protocol.ZoomConfig();
var1.magnificationMultiplier = this.magnificationMultiplier;
var1.mouseSensitivityMultiplier = this.mouseSensitivityMultiplier;
var1.overlayTexture = this.overlayTexture;
var1.depthOfField = this.depthOfField;
var1.allowCameraOrbit = this.allowCameraOrbit;
var1.forcePerspective = this.forcePerspective;
var1.lodMultiplier = this.lodMultiplier;
var1.inLerp = this.inLerp;
var1.outLerp = this.outLerp;
var1.overlayFade = this.overlayFade;
var1.overlayFadeInPerSecond = this.overlayFadeInPerSecond;
var1.overlayFadeOutPerSecond = this.overlayFadeOutPerSecond;
class="kw">return var1;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "ZoomConfig{magnificationMultiplier="
+ this.magnificationMultiplier
+ ", mouseSensitivityMultiplier="
+ this.mouseSensitivityMultiplier
+ ", overlayTexture='"
+ this.overlayTexture
+ "', depthOfField="
+ this.depthOfField
+ ", allowCameraOrbit="
+ this.allowCameraOrbit
+ ", forcePerspective="
+ this.forcePerspective
+ ", lodMultiplier="
+ this.lodMultiplier
+ ", inLerp="
+ this.inLerp
+ ", outLerp="
+ this.outLerp
+ ", overlayFade="
+ this.overlayFade
+ ", overlayFadeInPerSecond="
+ this.overlayFadeInPerSecond
+ ", overlayFadeOutPerSecond="
+ this.overlayFadeOutPerSecond
+ "}";
}
}