Ponder Library
repository·mc1.21.1/dev·Indexed 40 days ago
https://github.com/creators-of-create/ponderA library for Minecraft mod developers to create interactive, in-game tutorials and guides. It provides tools for crafting detailed guides to showcase mod mechanics, including a Gradle plugin for JAR transformation, a rendering API via SuperByteBuffer, animation movement effects through the Force interface, and UI positioning tools with LayoutHelper. Supports Minecraft 1.20.1 and 1.21.1 across Fabric, Forge, and NeoForge.
What's inside Ponder
- Ponder is a library designed for Minecraft mod developers to create interactive, in-game guides. It allows you to craft detailed, engaging tutorials that showcase mod mechanics directly within the game, helping players learn how to use your mod's content effectively.
Add Ponder dependency for Jared's MultiLoader Template
mc1.21.1/devFor Jared's MultiLoader Template (Minecraft 1.20.1/1.21.1), add the following to your
dependenciesblock:dependencies { implementation("net.createmod.ponder:Ponder-Common-${minecraft_version}:${ponder_version}") }Add Ponder dependency for Architectury MultiLoader
mc1.21.1/devFor Architectury MultiLoader (Minecraft 1.20.1/1.21.1), add the following to your
dependenciesblock:dependencies { modImplementation("net.createmod.ponder:Ponder-Common-${minecraft_version}:${ponder_version}") }Add Ponder dependency for Fabric
mc1.21.1/devFor Fabric (Minecraft 1.20.1/1.21.1), add the following to your
dependenciesblock:dependencies { modImplementation("net.createmod.ponder:Ponder-Fabric-${minecraft_version}:${ponder_version}") }Configure Maven repositories for Ponder
mc1.21.1/devTo use Ponder, you must first add the Create maven repository to your
repositoriesblock in your Gradle build script.repositories { maven { url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/" } maven { url = "https://maven.createmod.net" } }Add Ponder dependency for Forge with ForgeGradle
mc1.21.1/devFor Forge 1.20.1 using ForgeGradle, add the following to your
dependenciesblock usingfg.deobf:dependencies { implementation(fg.deobf("net.createmod.ponder:Ponder-Forge-${minecraft_version}:${ponder_version}")) }Add Ponder dependency for NeoForge
mc1.21.1/devFor NeoForge (Minecraft 1.21.1), add the following to your
dependenciesblock:dependencies { implementation("net.createmod.ponder:Ponder-NeoForge-${minecraft_version}:${ponder_version}") }Set the Ponder version property
mc1.21.1/devDefine a
ponder_versionproperty in yourgradle.propertiesfile. You can find the latest version at the Ponder CI link.... ponder_version = x ...Add Ponder dependency for Forge with ModDevGradle
mc1.21.1/devFor Forge 1.20.1 using ModDevGradle, add the following to your
dependenciesblock:dependencies { modImplementation("net.createmod.ponder:Ponder-Forge-${minecraft_version}:${ponder_version}") }Apply the PonderGradlePlugin
mc1.21.1/devThe
PonderGradlePluginis a Gradle plugin designed to automate the transformation of JAR files during the build process. It specifically handles the re-formatting of JSON and.mcmetafiles to ensure consistent formatting and applies ASM transformations to.classfiles.When applied, the plugin hooks into the
jartask. After the standard JAR creation is complete, it performs the following:- Reads the existing JAR contents.
- Deletes the original JAR.
- Re-packages the contents with
Deflater.BEST_COMPRESSION. - Re-formats all
.jsonand.mcmetafiles usingJsonOutput. - Applies ASM transformations to all
.classfiles viaASMTransformer. - Filters out specific Architectury injectable files matching the pattern
architectury_inject_${architecturyInjectableName}_common(wherearchitecturyInjectableNameis the project name, orrootProject.name_projectNameif in a subproject).
plugins { id("net.createmod.pondergradle") }Use SuperByteBuffer for rendering operations
mc1.21.1/devThe
SuperByteBufferinterface provides a fluent API for managing rendering state, including transformations, coloring, UV shifting, and lighting, before rendering into aVertexConsumer. It extendsTransformStack, allowing for matrix transformations (rotation, translation, etc.) to be applied to the rendering pipeline.Key capabilities include:
- Transformations: Use
getTransforms()to access thePoseStackor use inherited transformation methods. - Coloring: Set vertex colors using
color(int color)orcolor(int r, int g, int b, int a). It also supports aColorobject via a default method. - UV Manipulation: Apply sprite shifts using
shiftUV,shiftUVScrolling, orshiftUVtoSheet. - Lighting: Set manual light levels with
light(int packedLight)or enable automatic level lookup from the world usinguseLevelLight(BlockAndTintGetter level).
// Example of fluent usage superByteBuffer .reset() .color(Color.RED) .rotate(Direction.Axis.Y, 1.57f) .shiftUVScrolling(mySpriteEntry, 0.5f) .light(packedLightValue) .renderInto(poseStack, vertexConsumer);- Transformations: Use
Use LayoutHelper for UI positioning
mc1.21.1/devThe
LayoutHelperinterface provides tools for calculating the coordinates of UI elements in a grid or list. It is primarily used to manage the positioning of multiple items (like icons or buttons) within a container, ensuring they are spaced correctly and can be centered.To create a layout, use the static factory method
centeredHorizontal. This creates aCenteredHorizontalLayoutHelperwhich distributes items across a specified number of rows, centering the entire block of items relative to a zero-point (often the center of a screen or container).Key methods:
getX(): Returns the current X coordinate for the next item.getY(): Returns the current Y coordinate for the next item.next(): Advances the internal cursor to the next position in the layout. If the end of the layout is reached, it resets to the start.getArea(): Returns aRect2irepresenting the bounding box of the entire layout, centered on(0,0).
// Create a centered horizontal layout with 10 items, 2 rows, // each item being 18x18 pixels, with 2 pixels of spacing. LayoutHelper layout = LayoutHelper.centeredHorizontal(10, 2, 18, 18, 2); // Iterate through items to get their positions for (int i = 0; i < 10; i++) { int x = layout.getX(); int y = layout.getY(); // Render item at (x, y)... layout.next(); } // Get the total area occupied by the layout Rect2i bounds = layout.getArea();