Skip to content

Generic Utilities

Robert edited this page May 29, 2025 · 5 revisions

Along with the class bluntly named GenericUtils, there are a handful of different random miscellaneous utils, which may not be rich enough for their own pages. This page will go over them.

Xoshiro256** random, its speed is superior to the default Random implementation found in Java, but does not produce the same results when given the same seed compared to Java's stock random.

Utilities for registering recipes to sort them before or after vanilla recipes. In this case, recipes are first-come-first-serve, meaning the ones registered first, or lower in the list, gets priority. For example, if you wanted to add a door of a custom wood type, you could register it as a high priority recipe to guarantee it is sorted before recipes registered under vanilla classes, which means your wood type door would take precedent over the OreDictionary-based one in the game by default, allowing your door to exist alongside vanilla doors without modifying or removing their recipes.

This class also has a sanitization check for every recipe passed through it, meaning anything passed in that is null or not registered, prevents the entire recipe from being registered. This allows you to conveniently register recipes that depend on items that may not be guaranteed to be present, such as modded items or any toggleable items of your own, as HogUtils will check if everything is available before proceeding. This also means that recipes should registered AFTER all blocks present have already been initialized!

You can also utilize the sanity checking functionality by using the validateItems function, which will perform the sanity check on any ItemStack, Item or Block passed in whilst ignoring anything from other types. This is how the strings and chars present in regular recipe definitions do not automatically ruin the validation.

An easy way for you to reference mods, without having to memorize their ID every time. It stores the loaded mod state as well as the version and mod name for you to reference. It additionally comes with helper functions to check the currently loaded version of the mod the instance is referencing, and helper functions to compare said version with any arbitrary version number. This is useful if you want to check if a certain version of a mod is loaded before referencing code from it, such as if you reference code that is only present after a specific version of the referenced mod.

Clone this wiki locally