Modding utils used in my mods, which I thought could be reused. Feel free to use in your own mods or fork/copy what you need.
Licensed under the MIT License.
Note
Since version 1.2.0 this library includes the events and mixins previously provided by FlightCore.
Roughly accurate list of utils in this library. Categories correspond to packages in the source code.
QualifiedNameArgumentTypeArgument type acceptingqualified:resource_names
ColorUtilMeasure color distances, find closest dye/formatting color, mix and interpolate colors, and other miscellaneous color utils.ForgeUtilfutureNotNullPlaceholder for Object Holder initializersgetSerializedCapsExtract capabilities NBT from ItemStack
LogUtilLog once utils.ObfuscationReflectionUtilFailure tolerant reflection utils.
InterpolatorVery basic interpolation functions for animations.MathParserVery inefficient math parser with support for custom variables and functions.MathHighlighterAdd syntax highlighting to the expressions parsed by MathParser.Vec3dandVec3fCustom vector implementations with many rotation utils.
JsonToNBTUtilSelf documented name.NBTPathNavigate NBT using dot-separated paths. Can create intermediate nodes, and works similarly to IO paths.NBTPredicateSerializable NBT predicates, such as{Fireworks.Flight >= 3}. Supports lists and complex predicates, though it's not perfect.NBTCompareHelperUtils to compare NBT on specific paths.
PacketBufferUtilread/write nullables, lists and maps.ClientPlayerPacketandServerPlayerPacketBase class for packets carrying a player reference.DistributedPlayerPacketandValidatedDistributedPlayerPacketSpecial client player packet, that is automatically relayed to other players (usually those tracking the player). The server can prevent this behaviour ofc.ServerWorldPacketBase class for packets carrying a world reference to the clients.
NBTInheritingShapedRecipeBase recipe class that can specify (using upper case letters) items in the grid which are used as NBT sources for the crafting result.RecipeManagerHelperUtils to get registered recipes.
AudioUtilFading and cross-fading utils.PlayerTickableSoundBase class forTickableSounds associated to a player.
MutableComponentListList ofMutableComponents that can broadcast formatting operations to all its elements. Convenient for text split in lines.TextUtilAliases forTextComponentandTranslationComponentconstructors, split text components into formattable lists on newlines (including translated text (on client)), and link creation utils.TooltipUtilKey hints in tooltips.
The following events are injected by this library's mixins. For reference purposes, the mixins that fire these events can be found in the endorh.lazulib.mixins package.
CancelCapeRenderEventHide a player's cape conditionally.DisableElytraCheckEventConditionally tweak or skip the elytra speed check in servers for players.GenerateEndShipItemFrameEventModify the item frame containing the elytra in end ships. The handler for this event in Aerobatic Elytra exposes this event to datapacks through a loot table.PlayerTravelEventModify the movement physics of the player.RemotePlayerTravelEventModify the local movement physics extrapolation for remote players.PlayerTurnEventModify the logic controlling the player's rotation.RegisterTextureAtlasEventInject custom texture atlas into theModelManager'sAtlasSet.SetupRotationsRenderPlayerEventModify the rotations applied to the player's model.