Class AssetTree

java.lang.Object
com.hypixel.hytale.builtin.asseteditor.AssetTree

public class AssetTree extends Object
  • Constructor Details

    • AssetTree

      public AssetTree(Path rootPath, String packKey, boolean isReadOnly, boolean canBeDeleted)
    • AssetTree

      public AssetTree(Path rootPath, String packKey, boolean isReadOnly, boolean canBeDeleted, @Nonnull Collection<AssetTypeHandler> assetTypes)
  • Method Details

    • replaceAssetTree

      public void replaceAssetTree(@Nonnull AssetTree assetTree)
    • sendPackets

      public void sendPackets(@Nonnull EditorClient editorClient)
    • isDirectoryEmpty

      public boolean isDirectoryEmpty(@Nonnull Path path)
      Parameters:
      path - the path to test
      Returns:
      true if the path is a directory and that directory doesn't contain any files
    • ensureAsset

      @Nullable public AssetEditorFileEntry ensureAsset(@Nonnull Path path, boolean isDirectory)
      Parameters:
      path - the asset path
      isDirectory - if the path is a directory
      Returns:
      the AssetEditorFileEntry for the inserted path or null if asset already exists
    • findAssetFilesByFilename

      @Nonnull public List<Path> findAssetFilesByFilename(@Nonnull Path directory, @Nonnull String fileNameWithExtension)
      Finds every asset file directly or indirectly under directory whose file name equals assetId + extension, ignoring case. The match is by file name only, so files with the same name in different sub-folders all qualify.
      Parameters:
      directory - the directory to search, relative to the pack root (for example Server/Item/Items or Common/BlockTextures/)
      fileNameWithExtension - the asset file name with the extension (for example .json or .png)
      Returns:
      the matching paths, relative to the pack root, in stable ascending path order (possibly empty)
    • getAssetFile

      @Nullable public AssetEditorFileEntry getAssetFile(@Nonnull Path path)
      Parameters:
      path - the asset path
      Returns:
      the AssetEditorFileEntry for the path or null if none exists
    • removeAsset

      @Nullable public AssetEditorFileEntry removeAsset(@Nonnull Path path)
      Parameters:
      path - the path of the asset to remove
      Returns:
      the removed AssetEditorFileEntry for the path or null if none exists
    • applyAssetChanges

      public void applyAssetChanges(@Nonnull Map<Path, ModifiedAsset> createdDirectories, @Nonnull Map<Path, ModifiedAsset> modifiedAssets)