Class CommonAsset

java.lang.Object
com.hypixel.hytale.server.core.asset.common.CommonAsset
All Implemented Interfaces:
NetworkSerializable<Asset>
Direct Known Subclasses:
FileCommonAsset, ResourceCommonAsset

public abstract class CommonAsset extends Object implements NetworkSerializable<Asset>
Since:
1/05/2017
Version:
1.0
  • Field Details

  • Constructor Details

    • CommonAsset

      public CommonAsset(@Nonnull String name, @Nullable byte[] bytes)
    • CommonAsset

      public CommonAsset(@Nonnull String name, @Nonnull String hash, @Nullable byte[] bytes)
  • Method Details

    • getName

      @Nonnull public String getName()
    • getHash

      @Nonnull public String getHash()
    • getBlob

      public CompletableFuture<byte[]> getBlob()
    • getBlobPrefix

      public CompletableFuture<byte[]> getBlobPrefix(int length)
      Returns the first length bytes of the blob, or the whole blob if it is shorter.
    • toPacket

      @Nonnull public Asset toPacket()
      Specified by:
      toPacket in interface NetworkSerializable<Asset>
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object
    • hash

      @Nonnull public static String hash(byte[] bytes)
      Creates a hash from bytes matching the HASH_PATTERN.
      Parameters:
      bytes - bytes to hash
      Returns:
      the hash of the provided bytes