🎯 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.
📂 FileUtils NEW v1.6.0
File system utilities for safe file operations and data management.
💻 Command Framework NEW v1.6.0
A framework for creating and managing commands.
🔧 AdvancedBlockOps NEW v1.5.0
Enhanced block manipulation with safety checks, transactional editing, and undo systems.
🤖 EntityAIUtils NEW v1.5.0
AI utilities for custom mobs and behavior management with goal systems and pathfinding.
💾 DataPersistence NEW v1.5.0
World, player, and global data storage with compression and migration support.
✨ EffectsUtils NEW v1.5.0
Sound and particle effect utilities with timing control and combinations.
🌐 AdvancedNetworking fixed v1.5.1
Sophisticated packet handling with routing, synchronization, compression, and encryption.
🌍 DimensionUtils NEW v1.5.0
Custom dimension management with teleportation and portal systems.
🔴 RedstoneUtils NEW v1.5.0
Redstone circuit analysis and automation with signal manipulation and logic gates.
📊 PerformanceMonitor NEW v1.5.0
Built-in performance profiling with memory monitoring, tick analysis, and reporting.
🚀 Enhanced Existing Utilities: All existing utilities (WorldUtils, EntityUtils, NetworkUtils, TextUtils, GuiUtils, ItemUtils) have been significantly enhanced in v1.6.0 with new features, performance improvements, and additional functionality.
📋 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📦 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.6.0:
📂 FileUtils (NEW v1.6.0!)
// Read and write files
String content = FileUtils.readFile(Paths.get("config.txt"));
FileUtils.writeFile(Paths.get("data.json"), "{ \"key\": \"value\" }");
// Search for files
List jsonFiles = FileUtils.searchFiles(Paths.get("."), "*.json");
💻 Command Framework (NEW v1.6.0!)
// Create and register a command
public class MyCommand implements com.chosen.lib.command.Command {
// ... register command logic
}
CommandManager.registerCommand(new MyCommand());
🔧 Advanced Block Operations (NEW v1.5.0!)
// Transactional block operations with safety
TransactionId transaction = AdvancedBlockOps.startTransaction(world);
AdvancedBlockOps.safeSetBlock(world, pos, newState);
AdvancedBlockOps.commitTransaction(transaction);
// Area operations with undo support
AdvancedBlockOps.fillArea(world, pos1, pos2, blockState);
AdvancedBlockOps.replaceInArea(world, pos1, pos2, fromState, toState);
🤖 Entity AI Utilities (NEW v1.5.0!)
// AI goal management
EntityAIUtils.addGoal(mob, new FollowPlayerGoal(), 1);
EntityAIUtils.setBehaviorState(mob, "aggressive");
EntityAIUtils.addMemory(mob, "lastPlayer", player);
// Custom behavior states
String state = EntityAIUtils.getBehaviorState(mob);
EntityAIUtils.clearGoals(mob);
💾 Data Persistence (NEW v1.5.0!)
// World and player data storage
DataPersistence.saveWorldData(world, "config", configData);
DataPersistence.savePlayerData(player, "stats", statsData);
// Data migration support
DataPersistence.migratePlayerData(playerId, "oldKey", "newKey");
✨ Effects & Particles (NEW v1.5.0!)
// Sound and particle effects
EffectsUtils.playSound(world, pos, sound, 1.0f, 1.0f);
EffectsUtils.spawnParticleSphere(world, particle, center, 2.0, 20);
// Delayed effects and sequences
EffectsUtils.playDelayedSound(world, pos, sound, 20);
EffectsUtils.createSoundSequence(sounds, delays);
🌐 Advanced Networking (fixed v1.5.1!)
// Sophisticated packet handling
AdvancedNetworking.createPacket("data", dataObject);
AdvancedNetworking.routePacket(channel, buffer, customRoute);
// Compression and encryption
AdvancedNetworking.compressPacket(buffer);
AdvancedNetworking.encryptPacket(buffer, "secret");
🌍 Custom Dimensions (NEW v1.5.0!)
// Dimension management
DimensionUtils.createDimension(dimensionId, dimensionType);
DimensionUtils.teleportToDimension(entity, dimensionId, pos);
// Portal systems
DimensionUtils.createPortal(world, pos, destination);
DimensionUtils.findPortal(world, dimensionId);
🔴 Redstone Automation (NEW v1.5.0!)
// Circuit analysis and logic gates
RedstoneUtils.analyzeCircuit(world, pos, 10);
RedstoneUtils.createANDGate(world, pos, inputs);
RedstoneUtils.simulateLogicGate(LogicGateType.OR, inputs);
📊 Performance Monitoring (NEW v1.5.0!)
// Built-in performance profiling
PerformanceMonitor.startProfiling("myOperation");
PerformanceMonitor.getMemoryUsage();
PerformanceMonitor.getTPSData(world);
PerformanceMonitor.generatePerformanceReport(world);
📝 Enhanced Existing Utilities
// Enhanced WorldUtils with transactional editing
WorldUtils.startTransaction(world);
WorldUtils.setBlockState(world, pos, newState);
WorldUtils.commitTransaction(transactionId);
// Enhanced EntityUtils with AI integration
EntityUtils.setAIEnabled(entity, true);
EntityUtils.addPathfindingGoal(entity, goal);
// Enhanced NetworkUtils with reliability
NetworkUtils.sendReliablePacket(player, channel, buffer);
NetworkUtils.enableCompression(channel);
📚 Learning Path
Follow this recommended learning path to get the most out of ChosenLib:
1️⃣ Installation
Set up ChosenLib v1.5.1 in your project and configure your development environment.
Install ChosenLib2️⃣ Usage Examples
Learn how to use the v1.5.1 utilities with practical examples and real-world scenarios.
View Examples3️⃣ API Reference
Explore the complete API documentation for all v1.5.1 utility methods and classes.
Browse API4️⃣ New Features
Discover the 8 new utility classes and enhanced existing utilities in v1.5.1.
View Changelog💡 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.6.0 is the current stable release with new features like FileUtils and a Command Framework. All features are production-ready with comprehensive documentation and examples. Check our changelog for detailed information about all new features.
🔗 Resources
Additional resources to help you get started: