project - icon

Moonlight Lib

Universal mod

Forge and Fabric lightweight library with utilities such as custom Villagers AI, data driven trades,, custom Map Markers, First and third person item animations, dynamic assets and registration & more

Api and library

104.57M downloads 0 followers
Created 3 years ago
Updated a day ago

External resources



Project members


Technical information

License
Client side
optional
Server side
optional
Project ID
499980

Moonlight Lib

Supplementaries Discord Support me on Patreon Supplementaries Twitter Youtube Channel

📖 About 📖

Formerly Selene Library, Moonlight Lib is a set of specialized utilities and shared code that I use for my mods.
These include some highly specialized features such as dynamic asset generation, 2 new data registries, dynamic registration system as well as your usual multi loader helpers and wrappers to develop for both Fabric and Forge

🛠️ Features🛠️

Here are the most important features included. If you are a developer planning to use this library this is the section for you!

The main place for documentations are these:

  • This page

  • Example Package classes on github

  • Java Docs in classes from API package on github

To import this lbrary, simply go into the file section here and click "copy gradle line". Then paste that in your build.gradle file.


🎨Dynamic Assets

Moonlight allows you to generate any asset dynamically, for both datapacks and resource packs. In particulat the mod contains an extensive API to generate dynamic textures with tools like extracting palette, cropping, reshaping images, automatic recoloring and more.

  • Dynamic Resources example:

  • Texture Recoloring example:

  • Palette manipulation example:

🌍 Multiloader Utilities

These sets of utilities try to be as simple as possible, usually just relying on static helper functions instead of annotations or other OOP practices, and mainly emulate Forge behavior by simply wrapping it with helper functions. For fabric the equivalent behavior is called or implemented if its not available. Some highlight of this are Deferred registration, Common Setup and more.

Mod focus is on simplicity so most important calls are split among just 4 main API classes.

These are: PlatHelper, ClientHelper, RegHelper and ForgeHelper.

For configs and networking the main classes are ConfigBuilder and ChannelHandler

Configs in particular have extra features like being able to use Codecs, be loaded early or be automatically synced to clients

  • PlatHelper example:

  • ClientHelper example

  • RegHelper example:

  • ConfigBuilder example:

  • ChannelHandler example:

📒 Dynamic Registration**

**

This includes a new system (BlockSetAPI) which allows to dynamically detect "block sets" right after all blocks have been registered and dynamically register new entries which depend on it. An example is using the builtin WoodTypeRegistry or LeavesTypeRegistry, two block sets that will be populated dynamically with all installed woods and leaves from any mod, allowing you to register your wooden items in all existing wood types.

  • BlockSetAPI example : defining a block set

  • BlockSetAPI example: registering dynamic blocks

**

🧙‍♂️ Misc Utilities**

  • DispenserHelper example

  • First and Third-person Item animations example:

**🍩Custom Baked Models

**

  • Custom Model and Model Loader example:

  • Quad Utils example:

🌽Custom Villager Trades

Using the moonlight/villager_trades datapack folder you'll be able to add new custom trades to any villager. Here's an example trade.  Check out Supplementaries of Sawmill for more examples

  • **Block Color API:**A set of utilities which allows to detect any arbitrary modded block DyeColor as well as getting the equivalent block in a different color
    This works dynamically for any modded block or item

  • **Custom map markers: **
      A complete system that allows to easily implement and add map decoration and map markers as well as control every aspect of them like rendering. Also allows storing simple data inside maps data offering a couple of hooks to use it too like on item tooltip.
     This system also offers a simple Data Driven implementation meaning you can easily register new markers with datapacks!

  • **Dynamic Villager AI
    **A helper system to easily and dynamically add tasks and modify villager schedules in a compatible way without overriding the whole existing AI. Also allows to properly add memory types

  • **Custom first and third person animations:
    **  Allows modders to implement a simple interface in their items to allow it to have custom third and first person animations (like crossbows). 
     Includes simple and easy to use interfaces that can let you control first person and third person animations as well as a callback for rendering the item itself (similar to spyglass) directly in your item class

  • Grindstone achievement triggers:
      The mod adds a custom trigger that gets called when an item is passed through a grindstone that you can call in your mods advancements jsons

  • Soft fluid system:
      An entirely Data Driven custom virtual fluid system that goes on top of forge one and is designed to fit better in vanilla minecraft and having as main feature the ability to have multiple fluid containers items like bottles, bowls and buckets, as well as providing support for stews and drinks that can be consumed directly from a fluid tank. As opposed to the forge fluid system it has a base unit of 1 minecraft bottle (250 forge mb). The system also automatically generates all the needed fluids for already registered forge fluids and allows the user to override them or add to them easily. Fluids are virtual so they can only exist in modded container specifically for them

❤️Support Me❤️

Modding is taking a lot of my time, so if you like what I do, and you would like to support me, you can do so here. If you do, you'll receive a custom **Globe **and or Statue just for you! This also applies if you purchase a server from Akliz using "supplementaries" code.


Ko-Fi

Need a server? Check out Akliz, they have top brand servers just for modded minecraft.
They really have a cozy community with great support and the servers wonderfully Use code "supplementaries" to get** 20% off** and also support me in the process!
![](https://i.imgur.com/g5B76A8.png)

🦉 Our Mods🦉

Haunted HarvestSnowy SpiritStorage LabelsGoatedMysyical Oak TreeCarpeted StairsMmmMmmMmmMmmMoyaiJeedBetter Lily PadsAdvancement FramesRandomium