Skip to content
 
 

Latest commit

 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ModMogul

.NET Modding API for MineMogul

Quick Start

Here's a minimal complete example to get you started:

using BepInEx;
using BepInEx.Unity.Mono;
using UnityEngine;
using ModMogul;

[BepInPlugin("com.yourname.mymod", "My Mod", "1.0.0")]
public class MyMod : BaseUnityPlugin
{
    private BuildingObject cubePrefab;

    async void Start()
    {
        string myPlugin = "cubeItem";

        cubePrefab = Itemizer.RegisterItem(
            new ItemSpec(
                blockID: 1337,
                internalName: "MyMod_MyFirstItem",
                displayName: "My First Item",
                description: "It's an item!",
                price: 10,
                shopCategory: "My Mod Category"
            ),
            Paths.PluginPath + $"\\{myPlugin}\\Icon\\Icon.png"
        );

        await ModelMaker.LoadModelToGameObjectAsync(
            Paths.PluginPath + $"\\{myPlugin}\\Models\\MyModel.glb",
            cubePrefab.transform,
            ModelMaker.MaterialType.Opaque
        );
    }
}

API

Below you will find the documented functions for the ModMogul API

ItemSpec.ItemSpec

Description

Constructor for the ItemSpec struct used to register in game items

Signature

ItemSpec.ItemSpec(
    int blockID,
    string internalName,
    string displayName,
    string description,
    int price,
    string shopCategory,
    int maxStackSize = 999,
    bool isLockedByDefault = false,
    string qFunction = "Mirror"
)

Parameters

  • int blockID: Unique identifier for your item. Must be unique across all mods - if two mods use the same ID, the second one will fail to register
  • string internalName: This is what the game internally refers to your item as, the recommended structure for this name is ModName_ItemName
  • string displayName: What the item will display as in game
  • string description: The description for the item that will appear in the inventory and shop
  • int price: Price for the item in the shop
  • string shopCategory: The category from which the item can be found in the shop (note: will auto generate category if not found)
  • int maxStackSize: How many items can be in one stack (default: 999)
  • bool isLockedByDefault: Determines whether the item will be locked in the shop by default (default: false)
  • string qFunction: Defines how the Q button interaction manipulates the object. Available options: Mirror, Rotate, Flip, MirrorVertically, MirrorHorizontally, None (default: "Mirror")

Returns

Returns a new ItemSpec structure


Itemizer.RegisterItem

Description

Registers an item with MineMogul making it usable in game & purchasable from the shop

Signature

BuildingObject Itemizer.RegisterItem(
    ItemSpec spec,
    string fileName = ""
);

Parameters

  • ItemSpec spec: ItemSpec structure generated by ItemSpec.ItemSpec that contains useful information such as name, price, description, etc.
  • string fileName: Optional argument that points to the image / icon for the item on disk, if not specified it will be a missing texture

Returns

Returns a BuildingObject prefab for the item


ModelMaker.LoadModelToGameObjectAsync

Description

Will load a model from disk and apply it as a child to the parent Transform. Only .glb / glTF files are supported. This should be called in an async function like async void Start() or similar.

Signature

public static async Task<GameObject> LoadModelToGameObjectAsync(
    string modelPath,
    Transform parent,
    MaterialType materialType,
    string childName = null,
    CancellationToken ct = default
)

Parameters

  • string modelPath: Path to the .glb file on disk
  • Transform parent: The parent transform for the child object (model holder) to be applied to
  • MaterialType materialType: Specifies the material type to load the model with:
    • Opaque: Fully solid, no transparency
    • Fade: Smooth transparency blending
    • Cutout: Binary transparency (fully visible or fully invisible based on alpha threshold)
  • string childName: The name of the child object (model holder) that is applied to the parent transform
  • CancellationToken ct: Optional token to cancel the async operation

Returns

Returns an awaitable GameObject which is the child mesh applied to the parent transform

About

Modding API for MineMogul

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages