Package mindustry.mod.data
Class DataAsset
java.lang.Object
mindustry.mod.data.DataAsset
- All Implemented Interfaces:
Comparable<DataAsset>
- Direct Known Subclasses:
BundleAsset,ContentAsset,ImageAsset,MusicAsset,PatchAsset,SoundAsset
Abstract class for a kind of asset used in a data asset modification.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintarc.files.Fiarc.files.Fibyte[]getData()abstract DataAssetTypegetType()booleanbooleanisCached()voidvoidreadFromZip(String path, arc.files.Fi file) voidreadOverride(String path, arc.files.Fi file) Reads this asset in from a file on disk, and makes its hash point to the specified file, instead of a new one in the cache folder.voidsetHash(byte[] value) voidtoString()voidupdateData(byte[] data) Caches this asset in the asset folder, and updates its hash to correspond to the appropriate cache file.voidwrite(DataOutput stream)
-
Field Details
-
path
File path, including name and extension, but excluding base folder prefix. -
name
File name, excluding extension. This is taken from the path. -
byteHash
@Nullable public byte[] byteHashsha256 of the internal data. this is null for non-external assets. -
stringHash
-
-
Constructor Details
-
DataAsset
public DataAsset()
-
-
Method Details
-
updateData
public void updateData(byte[] data) Caches this asset in the asset folder, and updates its hash to correspond to the appropriate cache file. -
setHash
public void setHash(byte[] value) -
setPath
-
getType
-
getFullPath
-
getData
public byte[] getData()- Returns:
- for embedded assets, the data. Not implemented for non-embedded assets (use the cache file).
-
isAlwaysEmbedded
public boolean isAlwaysEmbedded() -
isCached
public boolean isCached() -
getCacheFileNoNull
public arc.files.Fi getCacheFileNoNull() -
getCacheFile
@Nullable public arc.files.Fi getCacheFile() -
readFromZip
-
readOverride
Reads this asset in from a file on disk, and makes its hash point to the specified file, instead of a new one in the cache folder. Only used on the server.- Throws:
IOException
-
read
- Throws:
IOException
-
write
- Throws:
IOException
-
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<DataAsset>
-