.NET Modding API for MineMogul
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
);
}
}Below you will find the documented functions for the ModMogul API
Constructor for the ItemSpec struct used to register in game items
ItemSpec.ItemSpec(
int blockID,
string internalName,
string displayName,
string description,
int price,
string shopCategory,
int maxStackSize = 999,
bool isLockedByDefault = false,
string qFunction = "Mirror"
)intblockID: Unique identifier for your item. Must be unique across all mods - if two mods use the same ID, the second one will fail to registerstringinternalName: This is what the game internally refers to your item as, the recommended structure for this name is ModName_ItemNamestringdisplayName: What the item will display as in gamestringdescription: The description for the item that will appear in the inventory and shopintprice: Price for the item in the shopstringshopCategory: The category from which the item can be found in the shop (note: will auto generate category if not found)intmaxStackSize: How many items can be in one stack (default: 999)boolisLockedByDefault: Determines whether the item will be locked in the shop by default (default: false)stringqFunction: Defines how the Q button interaction manipulates the object. Available options:Mirror,Rotate,Flip,MirrorVertically,MirrorHorizontally,None(default: "Mirror")
Returns a new ItemSpec structure
Registers an item with MineMogul making it usable in game & purchasable from the shop
BuildingObject Itemizer.RegisterItem(
ItemSpec spec,
string fileName = ""
);ItemSpecspec: ItemSpec structure generated byItemSpec.ItemSpecthat contains useful information such as name, price, description, etc.stringfileName: Optional argument that points to the image / icon for the item on disk, if not specified it will be a missing texture
Returns a BuildingObject prefab for the item
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.
public static async Task<GameObject> LoadModelToGameObjectAsync(
string modelPath,
Transform parent,
MaterialType materialType,
string childName = null,
CancellationToken ct = default
)stringmodelPath: Path to the.glbfile on diskTransformparent: The parent transform for the child object (model holder) to be applied toMaterialTypematerialType: Specifies the material type to load the model with:Opaque: Fully solid, no transparencyFade: Smooth transparency blendingCutout: Binary transparency (fully visible or fully invisible based on alpha threshold)
stringchildName: The name of the child object (model holder) that is applied to the parent transformCancellationTokenct: Optional token to cancel the async operation
Returns an awaitable GameObject which is the child mesh applied to the parent transform