HyCodeYourTale
classpublicPriority 3

ResourceType

com.hypixel.hytale.server.core.asset.type.item.config.ResourceType

implements JsonAssetWithMap<String, DefaultAssetMap<String, ResourceType>>, NetworkSerializable

8

Methods

8

Public Methods

7

Fields

2

Constructors

Constants

AssetBuilderCodec<String, ResourceType>CODEC= AssetBuilderCodec.builder( ResourceType.class, ResourceType::new, Code...
ValidatorCache<String>VALIDATOR_CACHE= new ValidatorCache<>(new AssetKeyValidator<>(ResourceType::getAssetStore))

Constructors

protected
ResourceType()
public
ResourceType(String id, String name, String description, String icon)

Methods

Public Methods (8)

publicstatic
DefaultAssetMap<String, ResourceType> getAssetMap()
publicstatic
AssetStore<String, ResourceType, DefaultAssetMap<String, ResourceType>> getAssetStore()
public
String getDescription()
public
String getIcon()
public
String getId()
public
String getName()
public
com.hypixel.hytale.protocol.ResourceType toPacket()
@Nonnull
public
String toString()
@Nonnull@Override

Fields

Protected Fields (5)

protectedAssetExtraInfo.Data data
protectedString description
protectedString icon
protectedString id
protectedString name

Private/Package Fields (2)

privateAssetStore<String, ResourceType, DefaultAssetMap<String, ResourceType>> ASSET_STORE
privateSoftReference<com.hypixel.hytale.protocol.ResourceType> cachedPacket

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.item.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.AssetBuilderCodec;
import com.hypixel.hytale.assetstore.map.DefaultAssetMap;
import com.hypixel.hytale.assetstore.map.JsonAssetWithMap;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.validation.ValidatorCache;
import com.hypixel.hytale.server.core.asset.common.CommonAssetValidator;
import com.hypixel.hytale.server.core.io.NetworkSerializable;
import java.lang.ref.SoftReference;
import javax.annotation.Nonnull;

public class ResourceType
   implements JsonAssetWithMap<String, DefaultAssetMap<String, ResourceType>>,
   NetworkSerializable<com.hypixel.hytale.protocol.ResourceType> {
   public static final AssetBuilderCodec<String, ResourceType> CODEC = AssetBuilderCodec.builder(
         ResourceType.class,
         ResourceType::new,
         Codec.STRING,
         (resourceType, k) -> resourceType.id = k,
         resourceType -> resourceType.id,
         (asset, data) -> asset.data = data,
         asset -> asset.data
      )
      .appendInherited(
         new KeyedCodec<>("Name", Codec.STRING),
         (resourceType, s) -> resourceType.name = s,
         resourceType -> resourceType.name,
         (resourceType, parent) -> resourceType.name = parent.name
      )
      .add()
      .appendInherited(
         new KeyedCodec<>("Description", Codec.STRING),
         (resourceType, s) -> resourceType.description = s,
         resourceType -> resourceType.description,
         (resourceType, parent) -> resourceType.description = parent.description
      )
      .add()
      .<String>appendInherited(
         new KeyedCodec<>("Icon", Codec.STRING),
         (resourceType, s) -> resourceType.icon = s,
         resourceType -> resourceType.icon,
         (resourceType, parent) -> resourceType.icon = parent.icon
      )
      .addValidator(CommonAssetValidator.ICON_RESOURCE)
      .add()
      .build();
   public static final ValidatorCache<String> VALIDATOR_CACHE = new ValidatorCache<>(new AssetKeyValidator<>(ResourceType::getAssetStore));
   private static AssetStore<String, ResourceType, DefaultAssetMap<String, ResourceType>> ASSET_STORE;
   protected AssetExtraInfo.Data data;
   protected String id;
   protected String name;
   protected String description;
   protected String icon;
   private SoftReference<com.hypixel.hytale.protocol.ResourceType> cachedPacket;

   public static AssetStore<String, ResourceType, DefaultAssetMap<String, ResourceType>> 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.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/item/config/ResourceType.ASSET_STORE Lcom/hypixel/hytale/assetstore/AssetStore;
      // 03: ifnonnull 0e
      // 06: ldc com/hypixel/hytale/server/core/asset/type/item/config/ResourceType
      // 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/item/config/ResourceType.ASSET_STORE Lcom/hypixel/hytale/assetstore/AssetStore;
      // 0e: getstatic com/hypixel/hytale/server/core/asset/type/item/config/ResourceType.ASSET_STORE Lcom/hypixel/hytale/assetstore/AssetStore;
      // 11: areturn
   }

   public static DefaultAssetMap<String, ResourceType> 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 org.jetbrains.java.decompiler.modules.decompiler.exps.InvocationExprent.lambda$isMappingInBounds$19(InvocationExprent.java:1648)
      //
      // Bytecode:
      // 0: invokestatic com/hypixel/hytale/server/core/asset/type/item/config/ResourceType.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/DefaultAssetMap
      // 9: areturn
   }

   public ResourceType(String id, String name, String description, String icon) {
      this.id = id;
      this.name = name;
      this.description = description;
      this.icon = icon;
   }

   protected ResourceType() {
   }

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

   public String getName() {
      return this.name;
   }

   public String getDescription() {
      return this.description;
   }

   public String getIcon() {
      return this.icon;
   }

   @Nonnull
   public com.hypixel.hytale.protocol.ResourceType toPacket() {
      com.hypixel.hytale.protocol.ResourceType cached = this.cachedPacket == null ? null : this.cachedPacket.get();
      if (cached != null) {
         return cached;
      } else {
         com.hypixel.hytale.protocol.ResourceType packet = new com.hypixel.hytale.protocol.ResourceType(this.id, this.icon);
         this.cachedPacket = new SoftReference<>(packet);
         return packet;
      }
   }

   @Nonnull
   @Override
   public String toString() {
      return "ResourceType{id='" + this.id + "', name='" + this.name + "', description='" + this.description + "', icon='" + this.icon + "'}";
   }
}