public class ResourceHandler extends ResourceDataTypes
Modifier and Type | Field and Description |
---|---|
static byte[] |
block_pack_mappings
Mapping information for resources-to-blocks and blocks-to-packs
|
static int |
BLOCKPACKPMAPPING_INDEX
Offset to the various chunks of data used to record block-to-pack mapping info
|
static int |
BLOCKPACKPMAPPING_LENGTH
Offset to the various chunks of data used to record block-to-pack mapping info
|
static int |
BLOCKPACKPMAPPING_PACKID
Offset to the various chunks of data used to record block-to-pack mapping info
|
static ResourceHandler |
instance
Our instance
|
static int[][] |
menu_cache
The cache of all the menus
|
static byte[] |
res_block_mappings
Mapping information for resources-to-blocks and blocks-to-packs
|
static int |
RESBLOCKMAPPING_BLOCKID
Offset to the various chunks of data used to record resource-to-block mapping info
|
static int |
RESBLOCKMAPPING_INDEX
Offset to the various chunks of data used to record resource-to-block mapping info
|
static int |
RESBLOCKMAPPING_LENGTH
Offset to the various chunks of data used to record resource-to-block mapping info
|
static byte[][] |
resource_blocks
Either the packs or blocks is used, depending on the value of PARAM_MD_RESHANDLER_CACHE_ENTIRE_PACKS
|
static java.lang.String[] |
resource_identifiers
String identifiers what all the resources are.
|
static byte[][] |
resource_packs
Either the packs or blocks is used, depending on the value of PARAM_MD_RESHANDLER_CACHE_ENTIRE_PACKS
|
static java.lang.Class |
rtclass |
static int |
SIZE_BLOCKPACKPMAPPINGS
Offset to the various chunks of data used to record block-to-pack mapping info
|
static int |
SIZE_RESBLOCKMAPPINGS
Offset to the various chunks of data used to record resource-to-block mapping info
|
static byte[] |
times_resource_pack_reference
Either the packs or blocks is used, depending on the value of PARAM_MD_RESHANDLER_CACHE_ENTIRE_PACKS
|
Constructor and Description |
---|
ResourceHandler() |
Modifier and Type | Method and Description |
---|---|
int |
getBlockOfResource(int res_id)
Returns which block this resource is contained in.
|
java.io.DataInputStream |
getFileFromJarAsDataInputStream(java.lang.String fileid)
Opens a file from a resource in the JAR and returns its inputstream
|
int |
getResID(java.lang.String res_name)
If PARAM_MD_DEBUG_REMEMBER_RESOURCE_NAMES is set, this will return the ID of a resource with a specified name
|
byte[] |
getResourceByteArray(int res_id)
Returns a byte-array for the specified resource.
|
java.lang.String |
getResString(int res_id)
If PARAM_MD_DEBUG_REMEMBER_RESOURCE_NAMES is set, this will return the name of a resource with a specified ID
|
void |
init()
Loads in the resmap file so it knows where the resources are and which languages are included in this build
|
byte[] |
loadFileFromJar(java.lang.String fileid,
int length)
Loads a file from a resource in the JAR and returns it as a byte array
|
void |
loadResourceBlock(int block_id)
Loads in a required resource block (to be called with the RESBLOCKID_ parameters)
|
void |
unloadResourceBlock(int block_id)
Frees up a resource block (to be called with the RESBLOCKID_ parameters)
|
void |
unloadUnusedResourcePacks()
Frees up any resource packs that are no longer being referenced by loaded blocks
|
getResourceCharArray, getResourceDoubleArray, getResourceFloatArray, getResourceIntArray, getResourceLongArray, getResourceShortArray, readIntFromByteArray, readLongFromByteArray, readShortFromByteArray, writeIntToByteArray
public static ResourceHandler instance
public static final int BLOCKPACKPMAPPING_PACKID
public static final int BLOCKPACKPMAPPING_INDEX
public static final int BLOCKPACKPMAPPING_LENGTH
public static final int SIZE_BLOCKPACKPMAPPINGS
public static final int RESBLOCKMAPPING_BLOCKID
public static final int RESBLOCKMAPPING_INDEX
public static final int RESBLOCKMAPPING_LENGTH
public static final int SIZE_RESBLOCKMAPPINGS
public static byte[] res_block_mappings
public static byte[] block_pack_mappings
public static byte[][] resource_packs
public static byte[] times_resource_pack_reference
public static byte[][] resource_blocks
public static java.lang.String[] resource_identifiers
public static int[][] menu_cache
public static java.lang.Class rtclass
public void init()
public java.io.DataInputStream getFileFromJarAsDataInputStream(java.lang.String fileid)
fileid
- Name of the file (don't worry about the leading "/")public byte[] loadFileFromJar(java.lang.String fileid, int length)
fileid
- Name of the file (don't worry about the leading "/")length
- Length, if known - if not, call with -1 (but exeuction will be slower)public void loadResourceBlock(int block_id)
public void unloadResourceBlock(int block_id)
public void unloadUnusedResourcePacks()
public int getBlockOfResource(int res_id)
public int getResID(java.lang.String res_name)
public java.lang.String getResString(int res_id)
public byte[] getResourceByteArray(int res_id)
getResourceByteArray
in class ResourceDataTypes