ItemPlayerAnimations class

Пакет: com.hypixel.hytale.server.core.asset.type.itemanimation.config

Файл: com/hypixel/hytale/server/core/asset/type/itemanimation/config/ItemPlayerAnimations.java

implements: JsonAssetWithMap<String, DefaultAssetMap<String, ItemPlayerAnimations>>, NetworkSerializable<com.hypixel.hytale.protocol.ItemPlayerAnimations>

Поля (4)

МодификаторыТипИмя
ASSET_STORE
final String DEFAULT_ID
com.hypixel.hytale.protocol.ItemPlayerAnimations var1
com.hypixel.hytale.protocol.ItemPlayerAnimations var2

Методы (10)

МодификаторыВозвратСигнатура
public Map<String, ItemAnimation> getAnimationsMap<String, ItemAnimation> getAnimations()
static DefaultAssetMap<String, ItemPlayerAnimations> getAssetMapDefaultAssetMap<String, ItemPlayerAnimations> getAssetMap()
static AssetStore<String, ItemPlayerAnimations, DefaultAssetMap<String, ItemPlayerAnimations>> getAssetStoreAssetStore<String, ItemPlayerAnimations, DefaultAssetMap<String, ItemPlayerAnimations>> getAssetStore()
public CameraSettings getCameraCameraSettings getCamera()
public String getIdString getId()
public WiggleWeights getWiggleWeightsWiggleWeights getWiggleWeights()
if if(ASSET_STORE == null)
if if(var1 != null)
if if(this.camera != null)
if if(this.pullbackConfig != null)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.type.itemanimation.config;

class="kw">import com.hypixel.hytale.assetstore.AssetExtraInfo;
class="kw">import com.hypixel.hytale.assetstore.AssetKeyValidator;
class="kw">import com.hypixel.hytale.assetstore.AssetRegistry;
class="kw">import com.hypixel.hytale.assetstore.AssetStore;
class="kw">import com.hypixel.hytale.assetstore.codec.AssetBuilderCodec;
class="kw">import com.hypixel.hytale.assetstore.codec.ContainedAssetCodec;
class="kw">import com.hypixel.hytale.assetstore.map.DefaultAssetMap;
class="kw">import com.hypixel.hytale.assetstore.map.JsonAssetWithMap;
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.map.MapCodec;
class="kw">import com.hypixel.hytale.codec.validation.ValidatorCache;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.common.util.MapUtil;
class="kw">import com.hypixel.hytale.protocol.ItemAnimation;
class="kw">import com.hypixel.hytale.protocol.WiggleWeights;
class="kw">import com.hypixel.hytale.server.core.asset.type.item.config.ItemPullbackConfig;
class="kw">import com.hypixel.hytale.server.core.asset.type.model.config.camera.CameraSettings;
class="kw">import com.hypixel.hytale.server.core.codec.ProtocolCodecs;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializable;
class="kw">import java.lang.ref.SoftReference;
class="kw">import java.util.Collections;
class="kw">import java.util.HashMap;
class="kw">import java.util.Map;
class="kw">import javax.annotation.Nonnull;

class="kw">public class ItemPlayerAnimations
   class="kw">implements JsonAssetWithMap<String, DefaultAssetMap<String, ItemPlayerAnimations>>,
   NetworkSerializable<com.hypixel.hytale.protocol.ItemPlayerAnimations> {
   class="kw">public class="kw">static class="kw">final String DEFAULT_ID = "Default";
   class="kw">public class="kw">static class="kw">final BuilderCodec<WiggleWeights> WIGGLE_WEIGHTS_CODEC = BuilderCodec.builder(WiggleWeights.class, WiggleWeights::new)
      .append(new KeyedCodec<>("X", Codec.DOUBLE), (var0, var1) -> var0.x = var1.floatValue(), var0 -> (double)var0.x)
      .add()
      .append(new KeyedCodec<>("XDeceleration", Codec.DOUBLE), (var0, var1) -> var0.xDeceleration = var1.floatValue(), var0 -> (double)var0.xDeceleration)
      .add()
      .append(new KeyedCodec<>("Y", Codec.DOUBLE), (var0, var1) -> var0.y = var1.floatValue(), var0 -> (double)var0.y)
      .add()
      .append(new KeyedCodec<>("YDeceleration", Codec.DOUBLE), (var0, var1) -> var0.yDeceleration = var1.floatValue(), var0 -> (double)var0.yDeceleration)
      .add()
      .append(new KeyedCodec<>("Z", Codec.DOUBLE), (var0, var1) -> var0.z = var1.floatValue(), var0 -> (double)var0.z)
      .add()
      .append(new KeyedCodec<>("ZDeceleration", Codec.DOUBLE), (var0, var1) -> var0.zDeceleration = var1.floatValue(), var0 -> (double)var0.zDeceleration)
      .add()
      .append(new KeyedCodec<>("Roll", Codec.DOUBLE), (var0, var1) -> var0.roll = var1.floatValue(), var0 -> (double)var0.roll)
      .add()
      .append(
         new KeyedCodec<>("RollDeceleration", Codec.DOUBLE), (var0, var1) -> var0.rollDeceleration = var1.floatValue(), var0 -> (double)var0.rollDeceleration
      )
      .add()
      .append(new KeyedCodec<>("Pitch", Codec.DOUBLE), (var0, var1) -> var0.pitch = var1.floatValue(), var0 -> (double)var0.pitch)
      .add()
      .append(
         new KeyedCodec<>("PitchDeceleration", Codec.DOUBLE),
         (var0, var1) -> var0.pitchDeceleration = var1.floatValue(),
         var0 -> (double)var0.pitchDeceleration
      )
      .add()
      .build();
   class="kw">public class="kw">static class="kw">final AssetBuilderCodec<String, ItemPlayerAnimations> CODEC = AssetBuilderCodec.builder(
         ItemPlayerAnimations.class,
         ItemPlayerAnimations::new,
         Codec.STRING,
         (var0, var1) -> var0.id = var1,
         var0 -> var0.id,
         (var0, var1) -> var0.data = var1,
         var0 -> var0.data
      )
      .appendInherited(
         new KeyedCodec<>("Animations", new MapCodec<>(ProtocolCodecs.ITEM_ANIMATION_CODEC, HashMap::new)),
         (var0, var1) -> var0.animations = MapUtil.combineUnmodifiable(var0.animations, var1),
         var0 -> var0.animations,
         (var0, var1) -> var0.animations = var1.animations
      )
      .addValidator(Validators.nonNull())
      .add()
      .<WiggleWeights>appendInherited(
         new KeyedCodec<>("WiggleWeights", WIGGLE_WEIGHTS_CODEC),
         (var0, var1) -> var0.wiggleWeights = var1,
         var0 -> var0.wiggleWeights,
         (var0, var1) -> var0.wiggleWeights = var1.wiggleWeights
      )
      .addValidator(Validators.nonNull())
      .add()
      .appendInherited(
         new KeyedCodec<>("Camera", CameraSettings.CODEC), (var0, var1) -> var0.camera = var1, var0 -> var0.camera, (var0, var1) -> var0.camera = var1.camera
      )
      .add()
      .<ItemPullbackConfig>appendInherited(
         new KeyedCodec<>("PullbackConfig", ItemPullbackConfig.CODEC),
         (var0, var1) -> var0.pullbackConfig = var1,
         var0 -> var0.pullbackConfig,
         (var0, var1) -> var0.pullbackConfig = var1.pullbackConfig
      )
      .documentation("Overrides the offset of first person arms when close to obstacles")
      .add()
      .<Boolean>appendInherited(
         new KeyedCodec<>("UseFirstPersonOverrides", Codec.BOOLEAN),
         (var0, var1) -> var0.useFirstPersonOverrides = var1,
         var0 -> var0.useFirstPersonOverrides,
         (var0, var1) -> var0.useFirstPersonOverrides = var1.useFirstPersonOverrides
      )
      .documentation("Determines whether or not to use FirstPersonOverride animations within ItemAnimations")
      .add()
      .build();
   class="kw">public class="kw">static class="kw">final Codec<String> CHILD_CODEC = new ContainedAssetCodec<>(ItemPlayerAnimations.class, CODEC);
   class="kw">public class="kw">static class="kw">final ValidatorCache<String> VALIDATOR_CACHE = new ValidatorCache<>(new AssetKeyValidator<>(ItemPlayerAnimations::getAssetStore));
   class="kw">private class="kw">static AssetStore<String, ItemPlayerAnimations, DefaultAssetMap<String, ItemPlayerAnimations>> ASSET_STORE;
   class="kw">protected AssetExtraInfo.Data data;
   class="kw">protected String id;
   class="kw">protected Map<String, ItemAnimation> animations = Collections.emptyMap();
   class="kw">protected WiggleWeights wiggleWeights;
   class="kw">protected CameraSettings camera;
   class="kw">protected ItemPullbackConfig pullbackConfig;
   class="kw">protected boolean useFirstPersonOverrides;
   class="kw">private SoftReference<com.hypixel.hytale.protocol.ItemPlayerAnimations> cachedPacket;

   class="kw">public class="kw">static AssetStore<String, ItemPlayerAnimations, DefaultAssetMap<String, ItemPlayerAnimations>> getAssetStore() {
      if (ASSET_STORE == null) {
         ASSET_STORE = AssetRegistry.getAssetStore(ItemPlayerAnimations.class);
      }

      class="kw">return ASSET_STORE;
   }

   class="kw">public class="kw">static DefaultAssetMap<String, ItemPlayerAnimations> getAssetMap() {
      class="kw">return (DefaultAssetMap<String, ItemPlayerAnimations>)getAssetStore().getAssetMap();
   }

   class="kw">public ItemPlayerAnimations(String var1, Map<String, ItemAnimation> var2, WiggleWeights var3, CameraSettings var4, ItemPullbackConfig var5, boolean var6) {
      this.id = var1;
      this.animations = var2;
      this.wiggleWeights = var3;
      this.camera = var4;
      this.pullbackConfig = var5;
      this.useFirstPersonOverrides = var6;
   }

   class="kw">protected ItemPlayerAnimations() {
   }

   class="kw">public String getId() {
      class="kw">return this.id;
   }

   class="kw">public Map<String, ItemAnimation> getAnimations() {
      class="kw">return this.animations;
   }

   class="kw">public WiggleWeights getWiggleWeights() {
      class="kw">return this.wiggleWeights;
   }

   class="kw">public CameraSettings getCamera() {
      class="kw">return this.camera;
   }

   @Nonnull
   class="kw">public com.hypixel.hytale.protocol.ItemPlayerAnimations toPacket() {
      com.hypixel.hytale.protocol.ItemPlayerAnimations var1 = this.cachedPacket == null ? null : this.cachedPacket.get();
      if (var1 != null) {
         class="kw">return var1;
      }

      com.hypixel.hytale.protocol.ItemPlayerAnimations var2 = new com.hypixel.hytale.protocol.ItemPlayerAnimations();
      var2.id = this.id;
      var2.animations = this.animations;
      var2.wiggleWeights = this.wiggleWeights;
      if (this.camera != null) {
         var2.camera = this.camera.toPacket();
      }

      if (this.pullbackConfig != null) {
         var2.pullbackConfig = this.pullbackConfig.toPacket();
      }

      var2.useFirstPersonOverride = this.useFirstPersonOverrides;
      this.cachedPacket = new SoftReference<>(var2);
      class="kw">return var2;
   }

   @Nonnull
   @Override
   class="kw">public String toString() {
      class="kw">return "ItemPlayerAnimations{id='"
         + this.id
         + "', animations="
         + this.animations
         + ", wiggleWeights="
         + this.wiggleWeights
         + ", camera="
         + this.camera
         + ", pullbackConfig="
         + this.pullbackConfig
         + ", useFirstPersonOverrides="
         + this.useFirstPersonOverrides
         + "}";
   }
}