Custom Element Types

Register new element types (items, blocks, entities, etc.) that integrate with Nexo Maker's project browser, routing, and editor system.

All registration happens in main.js init() function.


Registration (main.js)

api.nexomaker.registerItemType(typeId, config)

module.exports.init = async () => {
  api.nexomaker.registerItemType('armor', {
    renderMode: 'svg',               // 'svg' or '3d'
    editorRoute: 'armor_editor',     // Editor ID to use
    svgIcon: 'SmallItem',            // Icon name (for svg mode)
    displayName: 'Armor',            // Display name in UI
    tabIcon: 'SmallItem',            // Icon for tabs
    color: '#9333ea'                 // Hex color
  });
};

Parameters

Parameter
Type
Required
Description

typeId

string

Yes

Unique identifier (e.g., 'armor', 'weapon')

config.renderMode

'svg' | '3d'

Yes

How to render in browser

config.editorRoute

string

Yes

Editor ID to use when opening

config.svgIcon

string

No

Icon name (for svg mode)

config.displayName

string

Yes

Display name in UI

config.tabIcon

string

No

Icon for editor tabs

config.color

string

No

Hex color (e.g., '#9333ea')

config.showInBrowser

boolean

No

Show in browser (default: true)

config.browserCategory

string

No

Category grouping


Complete Workflow (main.js)

To fully integrate a custom element type, register 4 things:


How It Works

Flow

Type Recognition

When NexoMaker reads a YAML file:

System applies:

  • Color: #9333ea (purple)

  • Icon: SmallItem

  • Editor: armor_editor


Examples

Armor (SVG, from apitest)

YAML:

Weapon (3D model)

Vehicle (3D, categorized)

Spell (SVG, hidden from browser)


Color Guide

Use distinct colors for different categories:

Category
Colors
Example

Combat/Weapons

#dc2626, #ef4444, #f87171

Red family

Tools/Utility

#2563eb, #3b82f6, #60a5fa

Blue family

Magic/Special

#9333ea, #a855f7, #c084fc

Purple family

Nature/Food

#16a34a, #22c55e, #4ade80

Green family

NPCs/Quests

#eab308, #f59e0b, #fbbf24

Yellow/Amber


Common Issues

Type Not Showing in Browser

Solution 1: Check showInBrowser is not false

Solution 2: Verify YAML has type field

Wrong Editor Opens

Solution: Map type to editor

Icon Not Showing

Solution: For SVG mode, use valid icon name

Color Not Applied

Solution: Use hex format with #

Path Not Found

Solution: Use __dirname + '/path' (NOT path.join())


Quick Reference

Naming Convention

Required Steps


  • Custom Editors

  • Custom Creators

Last updated