HyCodeYourTale
classpublicabstractPriority 3

ResponseCurve

com.hypixel.hytale.server.core.asset.type.responsecurve.config.ResponseCurve

implements JsonAssetWithMap<String, IndexedLookupTableAssetMap<String, ResponseCurve>>

6

Methods

6

Public Methods

4

Fields

2

Constructors

Constants

BuilderCodec<ResponseCurve>BASE_CODEC= BuilderCodec.abstractBuilder(ResponseCurve.class) .afterDecode(responseCurve -> responseCur...
AssetCodecMapCodec<String, ResponseCurve>CODEC= new AssetCodecMapCodec<>( Codec.STRING, (t, k) -> t.id = k, t -> t.id, (t, data) -> t.extra...
ValidatorCache<String>VALIDATOR_CACHE= new ValidatorCache<>(new AssetKeyValidator<>(ResponseCurve::getAssetStore))

Constructors

protected
ResponseCurve()
public
ResponseCurve(String id)

Methods

Public Methods (6)

public
double computeY(double var1)
publicstatic
IndexedLookupTableAssetMap<String, ResponseCurve> getAssetMap()
publicstatic
AssetStore<String, ResponseCurve, IndexedLookupTableAssetMap<String, ResponseCurve>> getAssetStore()
public
String getId()
public
WeakReference<ResponseCurve> getReference()
public
String toString()
@Nonnull@Override

Fields

Protected Fields (3)

protectedAssetExtraInfo.Data extraData
protectedString id
protectedWeakReference<ResponseCurve> reference

Private/Package Fields (1)

privateAssetStore<String, ResponseCurve, IndexedLookupTableAssetMap<String, ResponseCurve>> ASSET_STORE

Inheritance

Parent
Current
Interface
Child

Use mouse wheel to zoom, drag to pan. Click nodes to navigate.

Related Classes

Source Code

package com.hypixel.hytale.server.core.asset.type.responsecurve.config;

import com.hypixel.hytale.assetstore.AssetExtraInfo;
import com.hypixel.hytale.assetstore.AssetKeyValidator;
import com.hypixel.hytale.assetstore.AssetStore;
import com.hypixel.hytale.assetstore.codec.AssetCodecMapCodec;
import com.hypixel.hytale.assetstore.map.IndexedLookupTableAssetMap;
import com.hypixel.hytale.assetstore.map.JsonAssetWithMap;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.validation.ValidatorCache;
import java.lang.ref.WeakReference;
import javax.annotation.Nonnull;

public abstract class ResponseCurve implements JsonAssetWithMap<String, IndexedLookupTableAssetMap<String, ResponseCurve>> {
   public static final AssetCodecMapCodec<String, ResponseCurve> CODEC = new AssetCodecMapCodec<>(
      Codec.STRING, (t, k) -> t.id = k, t -> t.id, (t, data) -> t.extraData = data, t -> t.extraData
   );
   public static final BuilderCodec<ResponseCurve> BASE_CODEC = BuilderCodec.abstractBuilder(ResponseCurve.class)
      .afterDecode(responseCurve -> responseCurve.reference = new WeakReference<>(responseCurve))
      .build();
   public static final ValidatorCache<String> VALIDATOR_CACHE = new ValidatorCache<>(new AssetKeyValidator<>(ResponseCurve::getAssetStore));
   private static AssetStore<String, ResponseCurve, IndexedLookupTableAssetMap<String, ResponseCurve>> ASSET_STORE;
   protected AssetExtraInfo.Data extraData;
   protected String id;
   protected WeakReference<ResponseCurve> reference;

   public static AssetStore<String, ResponseCurve, IndexedLookupTableAssetMap<String, ResponseCurve>> getAssetStore() {
      // $VF: Couldn't be decompiled
      // Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
      // java.lang.StackOverflowError
      //   at java.base/java.util.HashMap.putVal(HashMap.java:636)
      //   at java.base/java.util.HashMap.put(HashMap.java:619)
      //   at org.jetbrains.java.decompiler.struct.gen.generics.GenericType.mapGenVarsTo(GenericType.java:623)
      //   at org.jetbrains.java.decompiler.struct.gen.generics.GenericType.getGenericSuperType(GenericType.java:677)
      //   at org.jetbrains.java.decompiler.modules.decompiler.exps.InvocationExprent.lambda$isMappingInBounds$18(InvocationExprent.java:1608)
      //   at org.jetbrains.java.decompiler.modules.decompiler.exps.InvocationExprent.lambda$isMappingInBounds$19(InvocationExprent.java:1648)
      //
      // Bytecode:
      // 00: getstatic com/hypixel/hytale/server/core/asset/type/responsecurve/config/ResponseCurve.ASSET_STORE Lcom/hypixel/hytale/assetstore/AssetStore;
      // 03: ifnonnull 0e
      // 06: ldc com/hypixel/hytale/server/core/asset/type/responsecurve/config/ResponseCurve
      // 08: invokestatic com/hypixel/hytale/assetstore/AssetRegistry.getAssetStore (Ljava/lang/Class;)Lcom/hypixel/hytale/assetstore/AssetStore;
      // 0b: putstatic com/hypixel/hytale/server/core/asset/type/responsecurve/config/ResponseCurve.ASSET_STORE Lcom/hypixel/hytale/assetstore/AssetStore;
      // 0e: getstatic com/hypixel/hytale/server/core/asset/type/responsecurve/config/ResponseCurve.ASSET_STORE Lcom/hypixel/hytale/assetstore/AssetStore;
      // 11: areturn
   }

   public static IndexedLookupTableAssetMap<String, ResponseCurve> getAssetMap() {
      // $VF: Couldn't be decompiled
      // Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
      // java.lang.StackOverflowError
      //   at java.base/java.lang.ThreadLocal$ThreadLocalMap.getEntry(ThreadLocal.java:491)
      //   at java.base/java.lang.ThreadLocal.get(ThreadLocal.java:186)
      //   at java.base/java.lang.ThreadLocal.get(ThreadLocal.java:171)
      //   at org.jetbrains.java.decompiler.main.DecompilerContext.getCurrentContext(DecompilerContext.java:67)
      //   at org.jetbrains.java.decompiler.main.DecompilerContext.getStructContext(DecompilerContext.java:137)
      //   at org.jetbrains.java.decompiler.modules.decompiler.exps.InvocationExprent.lambda$isMappingInBounds$18(InvocationExprent.java:1598)
      //   at org.jetbrains.java.decompiler.modules.decompiler.exps.InvocationExprent.lambda$isMappingInBounds$19(InvocationExprent.java:1648)
      //
      // Bytecode:
      // 0: invokestatic com/hypixel/hytale/server/core/asset/type/responsecurve/config/ResponseCurve.getAssetStore ()Lcom/hypixel/hytale/assetstore/AssetStore;
      // 3: invokevirtual com/hypixel/hytale/assetstore/AssetStore.getAssetMap ()Lcom/hypixel/hytale/assetstore/AssetMap;
      // 6: checkcast com/hypixel/hytale/assetstore/map/IndexedLookupTableAssetMap
      // 9: areturn
   }

   public ResponseCurve(String id) {
      this.id = id;
   }

   protected ResponseCurve() {
   }

   public String getId() {
      return this.id;
   }

   public WeakReference<ResponseCurve> getReference() {
      return this.reference;
   }

   public abstract double computeY(double var1);

   @Nonnull
   @Override
   public String toString() {
      return "ResponseCurve{id='" + this.id + "'}";
   }

   static {
      CODEC.register("Exponential", ExponentialResponseCurve.class, ExponentialResponseCurve.CODEC);
      CODEC.register("Logistic", LogisticResponseCurve.class, LogisticResponseCurve.CODEC);
      CODEC.register("SineWave", SineWaveResponseCurve.class, SineWaveResponseCurve.CODEC);
   }

   public static class Reference {
      private int index;
      private WeakReference<ResponseCurve> reference;

      public Reference(int index, @Nonnull ResponseCurve responseCurve) {
         this.index = index;
         this.reference = responseCurve.getReference();
      }

      @Nonnull
      public ResponseCurve get() {
         ResponseCurve responseCurve = this.reference.get();
         if (responseCurve == null) {
            responseCurve = ResponseCurve.getAssetMap().getAsset(this.index);
            this.reference = responseCurve.getReference();
         }

         return responseCurve;
      }
   }
}