Creating a Mod: Difference between revisions

From Qubica Wiki
Jump to navigation Jump to search
 
Line 32: Line 32:
* <code>data/</code> - Definitions for blocks, items, clothes and crafting recipes.
* <code>data/</code> - Definitions for blocks, items, clothes and crafting recipes.
* <code>scripts/</code> - Contains your Lua code.
* <code>scripts/</code> - Contains your Lua code.
* <code>data/</code> - Definitions for blocks, items, clothes and crafting recipes.
* <code>binary/</code> - The only folder accessible through the Filesystem API.
* <code>binary/</code> - The only folder accessible through the Filesystem API.



Latest revision as of 04:31, 18 December 2025

Mods are a core part of Qubica and are extremely easy to make with the power of Lua.

Locating the local mods folder

Local mods folder location
Windows
C:\Users\YOUR_USERNAME\AppData\LocalLow\Tomahawk Interactive\Qubica\mods\

Local mods are stored here.

Creating the mod's folder structure

In your local mod's folder, create a folder with the name of your mod, this name won't be shown to the end-user. enter the folder and create mod.json, this contains the metadata about your mod.

The contents of mod.json should look something like:

{
    "name": "Indestructible Item",
    "description": "All items now have infinite durability!",
}

An icon for your mode can also be placed in this folder under icon.png

These are the only files that Qubica looks for in the root folder of your mod, however several other folders are check here.

Other folders

  • assets/ - Should contain you mod's textures, models, and sounds
  • data/ - Definitions for blocks, items, clothes and crafting recipes.
  • scripts/ - Contains your Lua code.
  • binary/ - The only folder accessible through the Filesystem API.

Defining a block

Blocks are defined in your_mod_folder/data/blocks.json. Create this file if you haven't yet.

Example of blocks.json:

[
	{
		"id": "qubica:dirt",
		"name": "Dirt",
		"texture": "textures/blocks/dirt.png",
		"textureRotation": 3,
		"health": 5,
		"toolCategories": ["shovel"]
	},
	{
		"id": "qubica:stone",
		"name": "Stone",
		"texture": "textures/blocks/stone.png",
		"textureRotation": 3,
		"health": 8,
		"toolCategories": ["pickaxe"]
	}
]

Reminder that the texture field is relative to your mod's assets folder.

Redefining a block

Blocks can also have the data modified by mods. This is done by simply defining a block with the same ID as an already existing block.

Example of a mod making a dirt block indestructible:

[
	{
		"id": "qubica:dirt",
		"health": -1
	}
]

Notice how only the health field is defined here, only fields redefined will replaced/added to the block's data.

Texture replacements

Textures for blocks and items can be easily replaced by mods of a high priority, they just need to be placed in the same location, or have their texture field redefined to point to it's new location.

Hotloading

Once a texture has been loaded in game, it can be hotloaded, which allows you to see your changes instantly.

Qubica is a mod

Qubica itself uses the same system for defining objects and loading textures as mods do, this allows you to easily replace data, textures, and add your own code.

Mod Examples

Examples of different types of mods are available in the Qubica's install folder, including Qubica itself.