AnvilLib
In the ever-evolving landscape of Minecraft modification, developers constantly seek ways to streamline their workflows and reduce redundant code. Enter AnvilLib, a sophisticated NeoForge mod library designed by Anvil Dev to provide a robust suite of practical tools and frameworks. Whether you are a seasoned coder or an aspiring creator, this library serves as the backbone for creating complex, stable, and feature-rich modifications without reinventing the wheel.
Why Choose AnvilLib for Your Project?
Modding Minecraft on modern versions requires handling intricate systems like networking, data registration, and configuration management. AnvilLib adopts a modular design, allowing developers to pick and choose the specific components they need or utilize the aggregate module for full functionality. By leveraging this library, you ensure that your mod adheres to best practices while benefiting from continuous updates and community support.
The primary advantage lies in its ability to simplify tedious tasks. Instead of writing hundreds of lines of boilerplate code for packet registration or config GUIs, AnvilLib handles the heavy lifting through elegant annotations and automated systems. This efficiency allows creators to focus on what truly matters: unique gameplay mechanics and immersive content.
Core Modules and Features
The library is divided into several specialized modules, each addressing a critical aspect of mod development. Understanding these components is key to maximizing your productivity.
- Config Module: This feature offers an annotation-based configuration system. Developers can define settings using simple Java annotations like
@Configand@Comment. It automatically generates client-side configuration GUIs, supports nested objects, and enforces numerical bounds, making user customization effortless. - Integration Module: Compatibility is crucial in a modded environment. This framework supports automatic loading of integration code based on the presence of other mods. Using the
@Integrationannotation, you can safely interact with popular libraries like JEI only when they are installed, preventing crashes and ensuring smooth runtime performance across different environments. - Network Module: Networking in Minecraft can be notoriously tricky. AnvilLib provides a high-level abstraction with package-based packet auto-registration. It supports various protocols including PLAY and CONFIGURATION, allowing you to define packet directions easily without manual registry calls.
- Recipe Module: Move beyond standard crafting tables with an in-world recipe system. This module enables custom triggers, such as item drops or explosions, to initiate recipes. It supports complex predicates and multiple outcomes, all fully compatible with datapacks.
- Moveable Entity Block: One of the most requested features in the community is the ability to push block entities with pistons without losing data. This module implements the necessary interfaces to preserve tile entity information during movement, opening doors for innovative mechanical contraptions.
- Registrum Module: Built upon the principles of Registrate, this system simplifies the registration of items, blocks, and entities. Its chain-style API design reduces clutter and automatically handles language file and datapack generation.
Compatibility and Requirements
To get the most out of this library, it is essential to run it on the correct platform. AnvilLib is specifically built for Minecraft version 1.21.1 and requires NeoForge 21.1.x. It demands Java 21 or higher to function correctly, reflecting the modern standards of the game's latest iterations. Attempting to run it on older loaders like Forge or Fabric will result in incompatibility, as the library leverages NeoForge-specific hooks and APIs.
For players and testers who want to experiment with mods relying on this library without manually managing dependencies, the foxygame.net launcher offers a streamlined solution. With its intuitive add-on catalog, users can locate AnvilLib instantly and enable it with a single click, ensuring that version compatibility is handled automatically so you can jump straight into testing new creations.
How to Install and Integrate AnvilLib
Integrating this library into your development environment is straightforward. If you are using Gradle, simply add the Maven Central repository to your build script. For those looking to download AnvilLib binaries for testing, ensure you grab the version matching your target Minecraft release.
In your build.gradle file, you can include the full aggregate artifact or import individual modules to keep your dependency tree lean. The syntax is clean and easy to remember, utilizing the group ID dev.anvilcraft.lib. Once the dependency is declared, running the build task will fetch the necessary files automatically.
If you are wondering how to install this for a client instance rather than development, place the downloaded JAR file into your mods folder alongside your NeoForge installation. Ensure that no conflicting library versions are present, as this could lead to class definition errors during startup.
Getting Started with Code
Starting a new project with AnvilLib involves minimal setup. For the Config module, you merely annotate your class and register it with the ConfigManager. Similarly, setting up networking requires a single event subscription to register your payload handlers. The documentation provided by the developers includes clear usage examples for every module, demonstrating how to implement features like bounded discrete values for settings or custom recipe triggers with just a few lines of code.
Conclusion
AnvilLib stands out as an indispensable tool for any serious NeoForge developer targeting Minecraft 1.21.1. By abstracting complex systems into manageable, annotation-driven components, it empowers creators to build more ambitious projects with greater stability. From seamless mod integration to advanced in-world recipe systems, the possibilities are endless when you have the right foundation. Embrace the power of this library to elevate your modding experience and contribute to the vibrant ecosystem of Minecraft customization.