ChosenLib

ChosenLib

Mod

ChosenLib: a lightweight utility library for Fabric

Client or server Library

31 downloads
0 followers
Follow Save
Filter channels...

ChosenLib v1.4.0 – Changelog

New in this release

Major New Utility Classes

  • WorldUtils - World and block manipulation utilities:

    • Block operations: getBlockState(), setBlockState(), isPositionLoaded()
    • Area queries: getBlocksInCube(), getBlocksInSphere(), getBlocksInArea()
    • Block finding: findBlocks(), findNearestBlock(), replaceBlocks()
    • World properties: getBiome(), getLightLevel(), canSeeSky()
    • Chunk utilities: getChunk(), isChunkLoaded(), getChunkPos()
    • Fluid operations: getFluidState(), hasFluid()
    • Entity queries: getEntitiesInBox(), getEntitiesAround(), getNearestEntity()
  • EntityUtils - Entity-related helper functions:

    • Health management: getHealth(), setHealth(), heal(), damage()
    • Status effects: hasStatusEffect(), addStatusEffect(), removeStatusEffect()
    • Attributes: getAttributeValue(), setAttributeBaseValue()
    • Teleportation: teleport(), teleportToEntity()
    • Distance utilities: getDistance(), isWithinDistance()
    • Entity finding: getEntitiesInRadius(), findNearestPlayer()
    • Physics: setVelocity(), launchTowards(), knockback()
    • Player operations: sendMessage(), giveItem()
  • NetworkUtils - Networking and packet utilities:

    • Packet creation: createBuffer(), createSimplePacket(), createPositionPacket()
    • Player targeting: sendToPlayer(), sendToPlayers(), sendToWorld()
    • Radius sending: sendToPlayersInRadius()
    • Data serialization: writeString(), writeBlockPos(), writeVec3d(), writeUuid()
    • Array support: writeBooleanArray(), writeIntArray(), writeStringArray()
    • Safe operations: safeBufferOperation(), hasReadableBytes()

Enhanced Existing Utilities

  • GuiUtils - Now server-side compatible with major enhancements:

    • Server-side utilities: centerX(), centerY(), rgba(), rgb(), withAlpha()
    • Color operations: getRed(), getGreen(), getBlue(), getAlpha()
    • Mathematical: isPointInRect(), rectanglesOverlap(), distance()
    • Color manipulation: hsvToRgb(), adjustBrightness(), interpolateColor()
    • Progress utilities: calculateProgressWidth()
    • Clamping: clamp() for int, float, and double
  • ClientGuiUtils - Client-side rendering extensions:

    • Screen utilities: centerXOnScreen(), centerYOnScreen(), getScreenWidth()
    • Drawing: drawRect(), drawBorderedRect(), drawGradient(), drawTexture()
    • Text rendering: drawText(), drawCenteredText(), drawTooltip()
    • UI components: drawButton(), drawCheckbox(), drawProgressBar()
    • Text utilities: getTextWidth(), getTextHeight()
  • ItemUtils - Performance and feature enhancements:

    • Enhanced validation: canMerge(), isDamageable(), isEnchanted()
    • Item lookup: getItemById() for Identifier and String
    • Durability: getDurabilityPercentage(), damageItem(), repairItem(), fullyRepairItem()
    • NBT operations: getNbt(), setNbt(), hasNbt()
    • Enchantments: getEnchantmentLevel(), hasEnchantment()
    • Inventory: findFirst(), findAll(), countItem(), consumeItem(), insertStack()
    • Performance: Caching for getItemId() and getMaxStackSize()
  • TextUtils - Advanced text operations with performance improvements:

    • Interactive text: clickableCommand(), withTooltip(), interactiveText()
    • Text wrapping: wrapText(), createMultiLineTextBox()
    • Validation: isBlank(), matches() with pattern caching
    • Formatting: formatNumber(), formatDecimal(), formatDuration()
    • Enhanced utilities: removeSpecialCharsKeepSpaces(), join() for Lists
    • Progress bars: progressBar() with percentage support
    • Performance: Cached regex patterns and formatting styles

Performance Optimizations

  • Caching Systems:
    • ItemUtils: Concurrent caching for item IDs and stack sizes
    • TextUtils: Compiled regex pattern caching and pre-computed styles
    • Thread-safe concurrent hash maps for all caches
    • Cache statistics and management: getCacheStats(), clearCache()

Command Improvements

  • /chosenlib Command Enhancements:
    • Updated to showcase all new v1.4.0 features
    • Feature highlights for WorldUtils, EntityUtils, and NetworkUtils
    • Improved formatting with success/info message types
    • Enhanced user experience with comprehensive feature overview

General

  • Internal version updated to 1.4.0
  • All utility classes fully documented with comprehensive JavaDoc
  • Extensive null safety checks and error handling
  • Thread-safe operations across all utilities
  • Backward compatibility maintained - no breaking changes

This is a major feature release introducing comprehensive world, entity, and networking utilities with significant performance improvements. All existing code continues to work unchanged and automatically benefits from performance enhancements!

ChosenLib v1.3.1 – Changelog

New in this release

Chat Enhancements

  • /chosenlib Command Improvements
    • Added a clickable Modrinth link to the command output.
    • Provides an easy way for players and developers to quickly access the Modrinth page directly from in-game chat.

General

  • Internal version updated to 1.3.1.
  • Minor improvements to command feedback and user experience.

No breaking changes. This release introduces a convenient Modrinth link button in chat for quicker access to the project page.

ChosenLib v1.3.0 – Changelog

New in this release

Major Utility Additions

  • GuiUtils - Client-side GUI utility class for Minecraft modding:
    • Screen positioning helpers (centerX(), centerY())
    • Color utilities (rgba(), rgb(), withAlpha(), hsvToRgb())
    • Drawing helpers (drawRect(), drawBorderedRect(), drawGradient())
    • Texture rendering (drawTexture())
    • Hit testing (isPointInRect())
    • Progress bars (drawProgressBar())
    • Color manipulation (adjustBrightness())

Enhanced TextUtils

  • Text manipulation: truncate(), toTitleCase(), reverse(), isPalindrome()
  • Text validation: isAlphanumeric(), isValidEmail(), removeSpecialChars()
  • Text analysis: wordCount(), centerText(), createTextBox()
  • Visual elements: progressBar() - Create text-based progress bars
  • Advanced formatting: combine(), stripFormatting(), format() with multiple options
  • Clickable links: clickable() - Create clickable chat text with URLs

ItemUtils - Item Management

  • Item validation: isEmpty(), isNotEmpty(), isSameItem(), isExactMatch()
  • Item information: getItemId(), getDisplayName(), getMaxStackSize()
  • Durability utilities: getDurability(), isDamaged(), getDamagePercentage()
  • Item manipulation: copyWithCount(), isStackable()

General

  • Internal version updated to 1.3.0.
  • All utility classes are fully documented with JavaDoc.
  • Improved code organization and structure.
  • Fixed API compatibility issues for Minecraft 1.21.1.
  • Proper client/server separation with GuiUtils in client source set.

No breaking changes. This release adds comprehensive GUI, text, and item utilities for enhanced mod development!

ChosenLib v1.2.1 – Changelog

New in this release

/chosenlib Command Improvements

  • The /chosenlib command now displays version 1.2.1.
  • Added a clickable Discord link to the command output.
  • All links (CurseForge, Source, Discord) are now clickable in chat:
  • License information (MIT) is shown in the command output.

General

  • Internal version updated to 1.2.1.
  • Minor code and documentation improvements.

No breaking changes. All links are now user-friendly and clickable in Minecraft chat!

ChosenLib v1.2.0 – Changelog

New in this release

Custom Command System

  • Added the /chosenlib command:
    • Displays the mod version.
    • Shows links to CurseForge, Modrinth (coming soon), and the source.
    • Informs users that the mod is under the MIT license.

Configuration System

  • Introduced a JSON-based config system:
    • Config file is auto-generated at config/chosenlib.json.
    • Includes example fields and is ready for expansion.

Expanded TextUtils with new helpers

  • combine(Text... texts): Combine multiple Text objects into one.
  • stripFormatting(Text text): Get the plain string from a Text object.
  • format(String message, Formatting... formattings): Format a message with multiple formatting options.
  • Improved compatibility for formatting methods with modern Minecraft versions.

General Improvements

  • Project version bumped to 1.2.0.

No breaking changes. The library is now even more useful for Fabric mod development!

ChosenLib v1.1.0 – Changelog

New in this release

General-purpose utility functions added to ChosenLib

  • randomInt(int min, int max): Get a random integer in a range.
  • clamp(int value, int min, int max): Clamp a value between min and max.
  • lerp(double a, double b, double t): Linear interpolation between two values.
  • isBetween(int value, int min, int max): Check if a value is within a range.
  • safeEquals(Object a, Object b): Null-safe equality check.
  • debugLog(String message): Log debug messages with the mod logger.

Expanded TextUtils with new helpers

  • capitalize(String input): Capitalize the first letter of a string.
  • repeat(String str, int times): Repeat a string multiple times.
  • isNullOrEmpty(String str): Check if a string is null or empty.
  • join(String separator, String... elements): Join strings with a separator.

Documentation

  • README updated with usage examples for all new functions.

No breaking changes. Code is fully documented and ready for use in your Fabric mods!

  • Initial public release of ChosenLib.
  • Added TextUtils for simple, localized text creation and formatting.
  • Added client initializer with a sample debug keybind and tick hook.

Project members

urmoit

Owner

Details

Licensed MIT
Published 5 days ago
Updated 4 days ago