The Best Resource for Minecraft
The Best Resource for Minecraft

SubLib Wiki

SubLib is the essential technical foundation and API for Subaraki's mod suite, providing advanced raytracing, targeting logic, and a custom inventory framework for mods like RPG Inventory, PetBuddy, and ClassArmor.

8 sections · 736 words

Overview#

SubLib is a core library mod developed by Subaraki (AbsolemJackdaw) designed to streamline the development and compatibility of a specific ecosystem of mods. It serves as a mandatory dependency for several popular gameplay-enhancing mods, including RPG Inventory, PetBuddy, and the ClassArmor series (BMA and UmbraLux).

While SubLib does not add significant standalone content to the game world, it introduces the underlying architecture required for custom player rendering, additional inventory slots, and complex entity AI. By centralizing these systems, SubLib ensures that multiple mods can modify the player entity and GUI simultaneously without causing conflicts or performance degradation.

Core Systems & API#

SubLib provides several high-level technical systems that are utilized by its dependent mods to create unique gameplay experiences.

Advanced Raytracing

SubLib includes a robust raytracing engine that functions on both the client and server sides. This system allows mods to accurately detect what a player is looking at or pointing toward, which is essential for the spell-casting mechanics in the Mage class and the targeting logic used by the PetBuddy.

Targeting Logic

The library features a specialized targeting API. This logic is used to determine entity priorities for pets and class-based abilities, ensuring that summons and spells interact correctly with friendly versus hostile mobs.

Shield & Weapon Framework

SubLib provides developers with a streamlined method for coding custom shields and weapons. This framework was particularly vital in versions prior to Minecraft and continues to enhance how custom shields (like those in the Paladin class) handle damage reduction and blocking animations.

SubLib provides the framework for custom shields and weapons

RPG Inventory Framework#

One of SubLib's primary functions is managing the RPG Inventory Layer. This system extends the standard Minecraft player inventory to include specialized slots for magical jewelry and equipment.

Slot Type Description Supported Items (via RPG Inventory)
Necklace A single slot for amulets and necklaces. Healing Amulets, Fire Resistance Necklaces
Rings Two slots (Left and Right hand). Strength Rings, Haste Rings, Debuff Cleansing Rings
Cape A dedicated slot for cosmetic and functional capes. Creeper Capes, Invisibility Cloaks
Gloves A slot for gauntlets or gloves. Mining Gloves, Combat Bracers
Shield A dedicated off-hand or secondary shield slot. Class-specific Shields

SubLib handles the data syncing for these slots, ensuring that the bonuses provided by items in these slots are correctly applied to the player's stats across server sessions.

Class & Ability System#

SubLib decouples the "Class" data from specific mods, allowing different class-based mods to work together seamlessly. It manages the player's current class assignment, level, and experience data.

Supported Classes

  • Berserker: Focuses on high physical damage and AoE attacks like the Hammer Smash.
  • Mage: Utilizes a wand system where spells are cast via chat commands or hotkeys.
  • Archer: Enhances bow mechanics and projectile speed.
  • Necromancer: Allows for the summoning of undead minions.
  • Paladin: A defensive class focused on shields and holy fire abilities.

The Class system enabled by SubLib allows for unique armor and abilities

PetBuddy Integration#

SubLib contains the base entity code for the PetBuddy, a miniature companion that follows the player.

Pet Mechanics

  • Behavior: The pet uses SubLib's targeting logic to stay within a specific radius of the owner. It can be set to stay, follow, or ride on the player's shoulder.
  • Appearance: The pet can mimic the player's skin or be transformed into various mobs using specific items.
  • Inventory: SubLib provides the pet with its own small inventory, allowing it to act as a mobile storage unit.

The PetBuddy entity relies on SubLib for its AI and following behavior

Supported Mods#

The following mods require SubLib to function correctly:

  • RPG Inventory: Adds the jewelry system, capes, and the specialized inventory GUI.
  • BMA (Berserker, Mage, Archer): The core class mod adding three distinct combat archetypes.
  • UmbraLux (Necromancer, Paladin): An expansion to the class system focusing on light and dark magic.
  • PetBuddy Mod: Adds the customizable miniature companion.
  • Beastmaster: A class mod focused on taming and commanding animals.

Mechanics & Technical Details#

Creative Tab

SubLib adds a unified creative tab titled "Subaraki's Mods". This tab serves as a central location for items from all installed mods in the Subaraki suite, preventing the creative menu from becoming cluttered.

Networking & Syncing

SubLib uses a custom packet handling system to ensure that player data (such as active class abilities or equipped jewelry) is synced between the server and the client. This prevents "ghosting" issues where a player might see an item equipped that the server does not recognize.

Configuration

The mod generates a configuration file located at .minecraft/config/sublib.cfg.

  • Targeting Settings: Allows users to adjust the sensitivity of the raytracing for spell casting.
  • GUI Offsets: Provides options to move the RPG Inventory button if it overlaps with other modded GUIs.