Contents
- Description
- Nested Class Summary
- Field Summary
- Method Summary
- Field Details
- Method Details
- getServerPrefab(String)
- getPrefab(Path)
- isPrefabFileName(String)
- stripPrefabSuffix(String)
- prefabExists(Path)
- deletePrefab(Path)
- getServerPrefabsPath()
- getServerPrefabDir(String)
- getPrefabDir(Path)
- saveServerPrefab(String, BlockSelection)
- saveWorldGenPrefab(String, BlockSelection, boolean)
- savePrefab(Path, BlockSelection, boolean)
- savePrefab(Path, BlockSelection, boolean, PrefabFormat)
- getWorldGenPrefabsPath()
- getAssetRootPath()
- getWorldGenPrefabsPath(String)
- saveServerPrefab(String, BlockSelection, boolean)
- saveServerPrefab(String, BlockSelection, boolean, PrefabFormat)
- getAssetPrefabsPath()
- getAssetPrefabsPathForPack(AssetPack)
- getAllAssetPrefabPaths()
- getAllBrowsablePrefabPaths()
- getAssetPrefabFromAnyPack(String)
- findAssetPrefabPath(String)
- findBrowsablePrefabPath(String)
- listBrowsablePrefabKeys()
- findAssetPackForPrefabPath(Path)
- getRelativePrefabPath(Path)
- getAssetPrefab(String)
- getAssetPrefabDir(String)
- saveAssetPrefab(String, BlockSelection)
- saveAssetPrefab(String, BlockSelection, boolean)
- savePrefabToPack(AssetPack, String, BlockSelection, boolean)
- savePrefabToPack(AssetPack, String, BlockSelection, boolean, PrefabFormat)
- getPrefabsPathForPack(AssetPack)
- getWorldGenPrefab(String)
- getWorldGenPrefab(Path, String)
- getWorldGenPrefabDir(String)
- saveWorldGenPrefab(String, BlockSelection)
- get()
Class PrefabStore
java.lang.Object
com.hypixel.hytale.server.core.prefab.PrefabStore
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intPrefabs with at least this many blocks save as.lpfinstead of.prefab.json: the binary format avoids the JSON encode cost and on-disk size that get punishing at this scale.static final Path -
Method Summary
Modifier and TypeMethodDescriptionbooleandeletePrefab(Path path) Deletes a prefab atpath, removing whichever of the.prefab.json/.lpfforms exists on disk.findAssetPackForPrefabPath(Path prefabPath) Finds a prefab's canonical.prefab.jsonpath within any asset pack, even if it only exists on disk as a sibling.lpf(as large prefabs do).Resolves a prefab key against every browsable location (all asset packs, then the server directory).static PrefabStoreget()Returns all prefab paths that should be shown in the prefab browser: all asset packs plus the server prefabs directory (if it exists).getAssetPrefab(String key) getAssetPrefabDir(String key) getPrefabDir(Path dir) getRelativePrefabPath(Path absolutePrefabPath) getServerPrefab(String key) getServerPrefabDir(String key) getWorldGenPrefab(String key) getWorldGenPrefab(Path prefabsPath, String key) getWorldGenPrefabsPath(String name) static booleanisPrefabFileName(String fileName) Returns whetherfileNamenames a prefab: a.prefab.json, or a.lpfthat is not the generated.prefab.json.lpfload cache.Lists every browsable prefab as a key without its.prefab.json/.lpfsuffix, for command suggestions.booleanprefabExists(Path path) Returns whether a prefab exists atpath, checking both the.prefab.jsonand.lpfforms.voidsaveAssetPrefab(String key, BlockSelection prefab) voidsaveAssetPrefab(String key, BlockSelection prefab, boolean overwrite) savePrefab(Path path, BlockSelection prefab, boolean overwrite) savePrefab(Path path, BlockSelection prefab, boolean overwrite, PrefabFormat format) voidsavePrefabToPack(AssetPack pack, String key, BlockSelection prefab, boolean overwrite) savePrefabToPack(AssetPack pack, String key, BlockSelection prefab, boolean overwrite, PrefabFormat format) voidsaveServerPrefab(String key, BlockSelection prefab) voidsaveServerPrefab(String key, BlockSelection prefab, boolean overwrite) saveServerPrefab(String key, BlockSelection prefab, boolean overwrite, PrefabFormat format) voidsaveWorldGenPrefab(String key, BlockSelection prefab) voidsaveWorldGenPrefab(String key, BlockSelection prefab, boolean overwrite) static StringstripPrefabSuffix(String fileName) Strips the prefab suffix fromfileName, for display names and prefab keys.
-
Field Details
-
PREFAB_FILTER
-
LARGE_PREFAB_BLOCK_THRESHOLD
public static final int LARGE_PREFAB_BLOCK_THRESHOLDPrefabs with at least this many blocks save as.lpfinstead of.prefab.json: the binary format avoids the JSON encode cost and on-disk size that get punishing at this scale.- See Also:
-
PREFABS_PATH
-
-
Method Details
-
getServerPrefab
-
getPrefab
-
isPrefabFileName
Returns whetherfileNamenames a prefab: a.prefab.json, or a.lpfthat is not the generated.prefab.json.lpfload cache. -
stripPrefabSuffix
-
prefabExists
Returns whether a prefab exists atpath, checking both the.prefab.jsonand.lpfforms. -
deletePrefab
Deletes a prefab atpath, removing whichever of the.prefab.json/.lpfforms exists on disk.- Returns:
trueif a file was deleted.- Throws:
IOException
-
getServerPrefabsPath
-
getServerPrefabDir
-
getPrefabDir
-
saveServerPrefab
-
saveWorldGenPrefab
public void saveWorldGenPrefab(@Nonnull String key, @Nonnull BlockSelection prefab, boolean overwrite) -
savePrefab
@Nonnull public Path savePrefab(@Nonnull Path path, @Nonnull BlockSelection prefab, boolean overwrite) -
savePrefab
@Nonnull public Path savePrefab(@Nonnull Path path, @Nonnull BlockSelection prefab, boolean overwrite, @Nonnull PrefabFormat format) - Returns:
- the path actually written, which is the
.lpfor the.prefab.jsonform depending onformatand the block count.
-
getWorldGenPrefabsPath
-
getAssetRootPath
-
getWorldGenPrefabsPath
-
saveServerPrefab
public void saveServerPrefab(@Nonnull String key, @Nonnull BlockSelection prefab, boolean overwrite) -
saveServerPrefab
@Nonnull public Path saveServerPrefab(@Nonnull String key, @Nonnull BlockSelection prefab, boolean overwrite, @Nonnull PrefabFormat format) -
getAssetPrefabsPath
-
getAssetPrefabsPathForPack
-
getAllAssetPrefabPaths
-
getAllBrowsablePrefabPaths
Returns all prefab paths that should be shown in the prefab browser: all asset packs plus the server prefabs directory (if it exists). -
getAssetPrefabFromAnyPack
-
findAssetPrefabPath
Finds a prefab's canonical.prefab.jsonpath within any asset pack, even if it only exists on disk as a sibling.lpf(as large prefabs do). Callers that need to load the prefab (e.g.getPrefab(Path)orPrefabBufferUtil.loadBuffer(Path)) resolve the.lpfsibling themselves from the returned path. -
findBrowsablePrefabPath
Resolves a prefab key against every browsable location (all asset packs, then the server directory). The.prefab.jsonor.lpfsuffix is optional; a sibling.lpfis preferred over.prefab.jsonwhen both exist. Returnsnullif no matching file exists. -
listBrowsablePrefabKeys
-
findAssetPackForPrefabPath
-
getRelativePrefabPath
-
getAssetPrefab
-
getAssetPrefabDir
-
saveAssetPrefab
-
saveAssetPrefab
-
savePrefabToPack
public void savePrefabToPack(@Nonnull AssetPack pack, @Nonnull String key, @Nonnull BlockSelection prefab, boolean overwrite) -
savePrefabToPack
@Nonnull public Path savePrefabToPack(@Nonnull AssetPack pack, @Nonnull String key, @Nonnull BlockSelection prefab, boolean overwrite, @Nonnull PrefabFormat format) -
getPrefabsPathForPack
-
getWorldGenPrefab
-
getWorldGenPrefab
-
getWorldGenPrefabDir
-
saveWorldGenPrefab
-
get
-