Getting Started

Learn what ChosenLib is and how to set up your development environment for Fabric modding.

🎯 What is ChosenLib?

ChosenLib is a comprehensive utility library for Fabric modding, designed to help you build mods faster and with less boilerplate code. It provides essential utilities for common modding tasks, making your development process more efficient and enjoyable.

🌍 WorldUtils NEW

World and block manipulation utilities with safe operations and area queries.

👤 EntityUtils NEW

Entity-related helper functions for health, teleportation, and physics operations.

🌐 NetworkUtils NEW

Networking and packet utilities for client-server communication.

📝 TextUtils ENHANCED

Advanced text manipulation with interactive components and performance improvements.

🎨 GuiUtils ENHANCED

Now server-side compatible with client-side extensions for rendering operations.

🎒 ItemUtils ENHANCED

Comprehensive item management with inventory operations and performance optimizations.

📋 Prerequisites

Before you start using ChosenLib, make sure you have the following installed:

☕ Java 21

Latest LTS version of Java for optimal performance and modern language features.

Download Java

🎮 Fabric Loader

Required for running Fabric mods on Minecraft.

Get Fabric

🔧 Fabric API

Core API that provides essential hooks and utilities for Fabric mods.

Download API

📦 Gradle

Build system for managing dependencies and building your mod (included with Fabric template).

🚀 Quick Overview

Here's what you can do with ChosenLib v1.4.0:

🌍 World Utilities (NEW!)

// Safe block operations
WorldUtils.setBlockState(world, pos, newState);
boolean loaded = WorldUtils.isPositionLoaded(world, pos);

// Area operations
List<BlockPos> blocks = WorldUtils.getBlocksInSphere(center, 5.0);
BlockPos nearest = WorldUtils.findNearestBlock(world, pos, 10, 
    state -> state.isOf(Blocks.DIAMOND_ORE));

👤 Entity Utilities (NEW!)

// Health management
EntityUtils.heal(entity, 10.0f);
EntityUtils.setHealth(entity, 20.0f);

// Teleportation and physics
EntityUtils.teleport(entity, targetPos);
EntityUtils.launchTowards(entity, target, 2.0);

🌐 Network Utilities (NEW!)

// Easy packet creation
PacketByteBuf buffer = NetworkUtils.createBuffer();
NetworkUtils.writeString(buffer, "Hello World");

// Multi-target sending
NetworkUtils.sendToPlayersInRadius(world, center, 50.0, channelId, buffer);

📝 Enhanced Text Utilities

// Interactive text components
Text interactive = TextUtils.interactiveText("Click me", "Tooltip", "https://example.com");
Text command = TextUtils.clickableCommand("Run", "/help");

// Advanced formatting
String duration = TextUtils.formatDuration(90000); // "1m 30s"
List<String> wrapped = TextUtils.wrapText(longText, 40);

🎒 Enhanced Item Utilities

// Inventory operations
ItemStack remaining = ItemUtils.insertStack(inventory, stack);
int consumed = ItemUtils.consumeItem(inventory, Items.DIAMOND, 5);

// Enhanced item operations
boolean canMerge = ItemUtils.canMerge(stack1, stack2);
ItemUtils.repairItem(stack, 100);

📚 Learning Path

Follow this recommended learning path to get the most out of ChosenLib:

1️⃣ Installation

Set up ChosenLib in your project and configure your development environment.

Install ChosenLib

2️⃣ Usage Examples

Learn how to use the utilities with practical examples and real-world scenarios.

View Examples

3️⃣ API Reference

Explore the complete API documentation for all utility methods and classes.

Browse API

💡 Best Practices

Getting Started Tips

  • Start Small: Begin with basic TextUtils functions before moving to more complex GUI utilities
  • Check Compatibility: Ensure you're using the correct Minecraft and Fabric versions
  • Read Documentation: Always refer to the API reference for method signatures and examples
  • Test Regularly: Test your mod frequently to catch issues early

Common Pitfalls

  • Client-side Code: Remember that GuiUtils is client-side only
  • Version Compatibility: Use the correct ChosenLib version for your Minecraft version
  • Dependencies: Make sure Fabric API is included in your mod

⚠️ Version Note: ChosenLib v1.4.0 is the current stable release. Future versions (1.5.0-1.9.0) may introduce API changes. Check our changelog for the latest updates and migration guides.

🔗 Resources

Additional resources to help you get started:

📖 Fabric Documentation

Official Fabric documentation for mod development.

Fabric Wiki

💬 Discord Community

Join the Fabric community for support and discussions.

Fabric Discord

🐛 GitHub Issues

Report bugs or request features for ChosenLib.

Report Issue