Package com.prupe.mcpatcher
Class MCPatcherUtils
java.lang.Object
com.prupe.mcpatcher.MCPatcherUtils
Collection of static methods available to mods at runtime. This class is always injected into
the output minecraft jar.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic AddonConfigstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic voidConvenience method to close a stream ignoring exceptions.static voidConvenience method to close a zip file ignoring exceptions.static voiddumpCommandLine(String[] args) static booleangetBooleanProperty(Properties properties, String key, boolean defaultValue) Get a value from a properties file.static Filestatic doublegetDoubleProperty(Properties properties, String key, double defaultValue) Get a value from a properties file.static floatgetFloatProperty(Properties properties, String key, float defaultValue) Get a value from a properties file.static FilegetGamePath(String... subdirs) Get the path to a file/directory within the game folder.static intgetHexProperty(Properties properties, String key, int defaultValue) Get a value from a properties file.static int[]getImageRGB(BufferedImage image) Get array of rgb values from image.static intgetIntProperty(Properties properties, String key, int defaultValue) Get a value from a properties file.static FilegetMinecraftPath(String... subdirs) Get the path to a file/directory within the minecraft folder.static StringGet shortened version of currently running Minecraft, e.g., 1.9pre4.static StringGet version of MCPatcher.static StringgetStringProperty(Properties properties, String key, String defaultValue) Get a value from a properties file.static booleanisGame()Returns true if running inside game, false if running inside MCPatcher.static booleanReturns true if string is null or consists only of whitespace.static booleanisNullOrEmpty(Collection<?> c) Returns true if collection is null or empty.static booleanisNullOrEmpty(Map<?, ?> m) Returns true if map is null or empty.static int[]parseIntegerList(String list, int minValue, int maxValue) Parse a comma-separated list of integers/ranges.static BufferedImagereadImage(InputStream input) Attempts to read image.static PropertiesreadProperties(InputStream input) Attempts to read a properties file.static booleanreadProperties(InputStream input, Properties properties) Attempts to read a properties file.static voidsetMinecraft(File gameDir, File assetsDir, String minecraftVersion, String patcherVersion)
-
Field Details
-
addonConfig
-
EXTENDED_HD
- See Also:
-
HD_TEXTURES
- See Also:
-
HD_FONT
- See Also:
-
RANDOM_MOBS
- See Also:
-
CUSTOM_COLORS
- See Also:
-
CONNECTED_TEXTURES
- See Also:
-
BETTER_SKIES
- See Also:
-
BETTER_GRASS
- See Also:
-
BETTER_GLASS
- See Also:
-
CUSTOM_ITEM_TEXTURES
- See Also:
-
GLSL_SHADERS
- See Also:
-
CUSTOM_TEXTURES_MODELS
- See Also:
-
BASE_MOD
- See Also:
-
TEXTURE_PACK_API_MOD
- See Also:
-
TESSELLATOR_API_MOD
- See Also:
-
TILESHEET_API_MOD
- See Also:
-
NBT_API_MOD
- See Also:
-
BLOCK_API_MOD
- See Also:
-
ITEM_API_MOD
- See Also:
-
BIOME_API_MOD
- See Also:
-
CUSTOM_ANIMATIONS
- See Also:
-
MIPMAP
- See Also:
-
GL11_CLASS
- See Also:
-
UTILS_CLASS
- See Also:
-
LOGGER_CLASS
- See Also:
-
CONFIG_CLASS
- See Also:
-
JSON_UTILS_CLASS
- See Also:
-
PROFILER_API_CLASS
- See Also:
-
MAL_CLASS
- See Also:
-
INPUT_HANDLER_CLASS
- See Also:
-
WEIGHTED_INDEX_CLASS
- See Also:
-
TEXTURE_PACK_API_CLASS
- See Also:
-
TEXTURE_PACK_CHANGE_HANDLER_CLASS
- See Also:
-
BLEND_METHOD_CLASS
- See Also:
-
RESOURCE_LIST_CLASS
- See Also:
-
RESOURCE_LOCATION_WITH_SOURCE_CLASS
- See Also:
-
FAKE_RESOURCE_LOCATION_CLASS
- See Also:
-
TILE_LOADER_CLASS
- See Also:
-
FACE_INFO_CLASS
- See Also:
-
TESSELLATOR_UTILS_CLASS
- See Also:
-
AA_HELPER_CLASS
- See Also:
-
BORDERED_TEXTURE_CLASS
- See Also:
-
CUSTOM_ANIMATION_CLASS
- See Also:
-
FANCY_DIAL_CLASS
- See Also:
-
FONT_UTILS_CLASS
- See Also:
-
MIPMAP_HELPER_CLASS
- See Also:
-
FANCY_COMPASS_CLASS
- See Also:
-
TEXTURE_UTILS_CLASS
- See Also:
-
TILE_SIZE_CLASS
- See Also:
-
BLOCK_API_CLASS
- See Also:
-
BLOCK_AND_METADATA_CLASS
- See Also:
-
RENDER_PASS_API_MAL_CLASS
- See Also:
-
RENDER_BLOCKS_UTILS_CLASS
- See Also:
-
ITEM_API_CLASS
- See Also:
-
NBT_RULE_CLASS
- See Also:
-
BIOME_API_CLASS
- See Also:
-
BIOME_HELPER_CLASS
- See Also:
-
RANDOM_MOBS_CLASS
- See Also:
-
MOB_RULE_LIST_CLASS
- See Also:
-
MOB_OVERLAY_CLASS
- See Also:
-
LINE_RENDERER_CLASS
- See Also:
-
COLORIZER_CLASS
- See Also:
-
COLORIZE_WORLD_CLASS
- See Also:
-
COLORIZE_ITEM_CLASS
- See Also:
-
COLORIZE_ENTITY_CLASS
- See Also:
-
COLORIZE_BLOCK_CLASS
- See Also:
-
COLORIZE_BLOCK18_CLASS
- See Also:
-
LIGHTMAP_CLASS
- See Also:
-
CTM_UTILS_CLASS
- See Also:
-
CTM_UTILS18_CLASS
- See Also:
-
TILE_OVERRIDE_INTERFACE
- See Also:
-
TILE_OVERRIDE_CLASS
- See Also:
-
TILE_OVERRIDE_IMPL_CLASS
- See Also:
-
TILE_OVERRIDE_ITERATOR_CLASS
- See Also:
-
BLOCK_ORIENTATION_CLASS
- See Also:
-
GLASS_PANE_RENDERER_CLASS
- See Also:
-
RENDER_PASS_API_CLASS
- See Also:
-
SUPER_TESSELLATOR_CLASS
- See Also:
-
RENDER_PASS_CLASS
- See Also:
-
RENDER_PASS_MAP_CLASS
- See Also:
-
SKY_RENDERER_CLASS
- See Also:
-
FIREWORKS_HELPER_CLASS
- See Also:
-
CIT_UTILS_CLASS
- See Also:
-
CIT_UTILS18_CLASS
- See Also:
-
OVERRIDE_BASE_CLASS
- See Also:
-
ITEM_OVERRIDE_CLASS
- See Also:
-
ENCHANTMENT_CLASS
- See Also:
-
ENCHANTMENT_LIST_CLASS
- See Also:
-
ARMOR_OVERRIDE_CLASS
- See Also:
-
POTION_REPLACER_CLASS
- See Also:
-
SHADERS_CLASS
- See Also:
-
BLANK_PNG_FORMAT
- See Also:
-
CATEGORY_EXTENDED_HD
- See Also:
-
CATEGORY_CUSTOM_COLORS
- See Also:
-
CATEGORY_CONNECTED_TEXTURES
- See Also:
-
CATEGORY_BETTER_SKIES
- See Also:
-
CATEGORY_CUSTOM_ITEMS
- See Also:
-
CONFIG_CUSTOM_ANIMATIONS
- See Also:
-
CONFIG_FANCY_COMPASS
- See Also:
-
CONFIG_FANCY_CLOCK
- See Also:
-
CONFIG_HD_FONT
- See Also:
-
CONFIG_FONT_WIDTH
- See Also:
-
CONFIG_DEBUG_BORDER
- See Also:
-
CONFIG_USE_GL13
- See Also:
-
CONFIG_SCRATCH_TEX
- See Also:
-
CONFIG_MIPMAP
- See Also:
-
CONFIG_MAX_MIPMAP
- See Also:
-
CONFIG_ANTI_ALIAS
- See Also:
-
CONFIG_ANISOTROPIC
- See Also:
-
CONFIG_LOD_BIAS
- See Also:
-
CONFIG_COLOR_WATER
- See Also:
-
CONFIG_COLOR_SWAMP
- See Also:
-
CONFIG_COLOR_TREES
- See Also:
-
CONFIG_COLOR_POTION
- See Also:
-
CONFIG_COLOR_PARTICLE
- See Also:
-
CONFIG_COLOR_LIGHTING
- See Also:
-
CONFIG_COLOR_CLOUDS
- See Also:
-
CONFIG_COLOR_REDSTONE
- See Also:
-
CONFIG_COLOR_STEM
- See Also:
-
CONFIG_COLOR_MOB_EGG
- See Also:
-
CONFIG_COLOR_HELD_MAP
- See Also:
-
CONFIG_COLOR_DYE
- See Also:
-
CONFIG_COLOR_TEXT
- See Also:
-
CONFIG_COLOR_XP_ORB
- See Also:
-
CONFIG_COLOR_FOG
- See Also:
-
CONFIG_COLOR_FOG_BLEND
- See Also:
-
CONFIG_COLOR_BLOCKS
- See Also:
-
CONFIG_COLOR_BLOCKS_BLEND
- See Also:
-
CONFIG_COLOR_BIOME
- See Also:
-
CONFIG_COLOR_Y_VARIANCE
- See Also:
-
CONFIG_COLOR_TEST
- See Also:
-
CONFIG_CTM_STANDARD
- See Also:
-
CONFIG_CTM_NON_STANDARD
- See Also:
-
CONFIG_CTM_GLASS_PANE
- See Also:
-
CONFIG_BETTER_GRASS
- See Also:
-
CONFIG_MAX_OVERRIDE
- See Also:
-
CONFIG_DEBUG_TEX
- See Also:
-
CONFIG_ENABLE_SKYBOX
- See Also:
-
CONFIG_UNLOAD_SKY
- See Also:
-
CONFIG_BRIGHT_FIREWORK
- See Also:
-
CONFIG_HORIZON_HEIGHT
- See Also:
-
CONFIG_CIT_ITEMS
- See Also:
-
CONFIG_CIT_ENCHANTS
- See Also:
-
CONFIG_CIT_ARMOR
- See Also:
-
-
Method Details
-
getDefaultGameDir
-
getMinecraftPath
Get the path to a file/directory within the minecraft folder.- Parameters:
subdirs- zero or more path components- Returns:
- combined path
-
getGamePath
Get the path to a file/directory within the game folder. The game folder is usually the same as the minecraft folder, but can be overridden via a launcher profile setting.- Parameters:
subdirs- zero or more path components- Returns:
- combined path
-
isGame
public static boolean isGame()Returns true if running inside game, false if running inside MCPatcher. Useful for code shared between mods and runtime classes.- Returns:
- true if in game
-
getStringProperty
Get a value from a properties file.- Parameters:
properties- properties filekey- property namedefaultValue- default value if not found in properties file- Returns:
- property value
-
getIntProperty
Get a value from a properties file.- Parameters:
properties- properties filekey- property namedefaultValue- default value if not found in properties file- Returns:
- property value
-
getHexProperty
Get a value from a properties file.- Parameters:
properties- properties filekey- property namedefaultValue- default value if not found in properties file- Returns:
- property value
-
getBooleanProperty
Get a value from a properties file.- Parameters:
properties- properties filekey- property namedefaultValue- default value if not found in properties file- Returns:
- property value
-
getFloatProperty
Get a value from a properties file.- Parameters:
properties- properties filekey- property namedefaultValue- default value if not found in properties file- Returns:
- property value
-
getDoubleProperty
Get a value from a properties file.- Parameters:
properties- properties filekey- property namedefaultValue- default value if not found in properties file- Returns:
- property value
-
close
Convenience method to close a stream ignoring exceptions.- Parameters:
closeable- closeable object
-
close
Convenience method to close a zip file ignoring exceptions.- Parameters:
zip- zip file
-
isNullOrEmpty
Returns true if string is null or consists only of whitespace.- Parameters:
s- possibly null string- Returns:
- true if null or empty
-
isNullOrEmpty
Returns true if collection is null or empty.- Parameters:
c- possibly null collection- Returns:
- true if null or empty
-
isNullOrEmpty
Returns true if map is null or empty.- Parameters:
m- possibly null map- Returns:
- true if null or empty
-
dumpCommandLine
-
setMinecraft
-
getMinecraftVersion
Get shortened version of currently running Minecraft, e.g., 1.9pre4.- Returns:
- string
-
getPatcherVersion
Get version of MCPatcher.- Returns:
- string
-
readImage
Attempts to read image. Closes input stream regardless of success or failure.- Parameters:
input- open input stream- Returns:
- image or null
-
readProperties
Attempts to read a properties file. Closes input stream regardless of success or failure.- Parameters:
input- open input stream- Returns:
- properties object or null
-
readProperties
Attempts to read a properties file. Closes input stream regardless of success or failure.- Parameters:
input- open input streamproperties- initial properties object- Returns:
- true if properties were successfully read
-
getImageRGB
Get array of rgb values from image.- Parameters:
image- input image- Returns:
- rgb array
-
parseIntegerList
Parse a comma-separated list of integers/ranges.- Parameters:
list- comma- or space-separated list, e.g., 2-4,5,8,12-20minValue- smallest value allowed in the listmaxValue- largest value allowed in the list- Returns:
- possibly empty integer array
-