Multitool is a proof-of-concept Minecraft mod adding a structure placement tool with custom OpenGL hologram rendering and extensible behavior, allowing new functions added through JSON files.
Tools: Java, Gradle/Groovy, OpenGL, git/GitHub
Summary
Multitool was an attempt to bring the building tools from Satisfactory to Minecraft, with hologram previews of structure placement, varied tool modes, and the ability to add new structures with just JSON files (and behaviors with a seamless Java API).
- View source code on the GitHub repository.
Demo
Mode switcher
Multitool has a quickly accessible mode switching GUI, designed to be fast and painless and feel good to use. The radial menu is inspired by user interfaces in Satisfactory and similar factory building games.
This video shows off dynamically registered behavior definitions which can be restricted to a player gamemode or other contextual requirement, and either hidden or greyed out when not accessible to the current player. The intention here was to allow for features of the multitool that could be unlocked in later stages of progression.
The interface was written with GLFW’s OpenGL bindings, on top of Minecraft’s Blaze3D rendering engine. You can view the abstracted rendering code (and selection logic) for the radial menu in the RadialSelectScreen
class on GitHub.
Structure building
In the structure building mode, the multitool can render a preview of and place in-world any structure defined by a JSON file (describing placement settings) and an NBT (named binary tag; Minecraft’s proprietary serialization format) file describing the structure.
The StructureBuildingRecipe
class describes a buildable structure, its material cost, and its settings for placement by the multitool. The recipe class also contains an inner Serializer
class that can construct instances from JSON or serialize existing instances to JSON files. This allows dynamic loading of these “recipes”, so players can define their own structures and use them in-game.
Structures can be defined on the server as well and the necessary information will be synced to connected clients. The video below demonstrates this working seamlessly even with large structures, as well as the structure building mode itself with rotation, recipe switching, and an improved hologram renderer that also draws bounding boxes and switches color contextually (source code here):