-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started
This mod allows you to create fully functional Minecraft content (Items, Blocks, Scripts, and Textures) by simply dropping .zip files into a folder. No Java knowledge or compilation required!
Once the mod is installed, look for a folder named modpacks in your main Minecraft directory (where mods and config are located).
If there is none, try starting Minecraft. It will autocreate it.
Every .zip file in this folder is treated as a separate mod.
Every modpack ZIP must have a pack.json in the root. This defines your Mod ID and metadata.
File: pack.json
{
"name": "Magic & Industry",
"modid": "magicmod",
"author": "YourName",
"version": "1.0.0"
}Note: Your modid must be lowercase and contain no spaces.
Custom objects are defined using JSON files inside the mod/ folder of your ZIP.
Path: mod/item/fire_wand.json
{
"max_stack": 1,
"rarity": "EPIC",
"creative_tab": "main_tab"
}Path: mod/block/healing_station.json
{
"hardness": 3.0,
"resistance": 10.0,
"light": 15,
"ticks": true,
"creative_tab": "main_tab"
}Setting "ticks": true allows the block to run JavaScript code every second.
You can add logic to your items and blocks by creating .js files in mod/scripts/. The filename must match the ID of your item or block.
Path: mod/scripts/fire_wand.js
function onRightClick(ctx) {
if (ctx.isCrouching()) {
ctx.actionBar("§6Fire Shield Activated!");
ctx.addEffect("minecraft:fire_resistance", 600, 0);
} else {
ctx.explode(2.0, true);
ctx.chat("§cFeel the heat!");
}
}Path: mod/scripts/healing_station.js
function onBlockTick(ctx) {
// ctx.getEventData() returns the BlockPos for blocks
var pos = ctx.getEventData();
// Heal the player if they are nearby
ctx.heal(1.0);
ctx.spawnParticle("minecraft:heart", pos.getX() + 0.5, pos.getY() + 1.2, pos.getZ() + 0.5, 5, 0.3, 0.3, 0.3, 0.05);
}Create a file named global.js to run code for every player or every block broken in the world.
Path: mod/scripts/global.js
function onPlayerTick(ctx) {
if (ctx.isPlayerInRain()) {
ctx.damage(0.5);
ctx.actionBar("§9The rain is acidic!");
}
}
function onBlockBreak(ctx) {
var pos = ctx.getEventData();
ctx.spawnParticle("minecraft:happy_villager", pos.getX(), pos.getY(), pos.getZ(), 10, 0.5, 0.5, 0.5, 0.1);
}To make your items look real, use the standard assets structure.
Place your .png at:
assets/magicmod/textures/item/fire_wand.png
Path: assets/magicmod/models/item/fire_wand.json
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "magicmod:item/fire_wand"
}
}Path: assets/magicmod/lang/en_us.json
{
"item.magicmod.fire_wand": "Wand of Eternal Flame",
"block.magicmod.healing_station": "Medical Bay",
"itemGroup.magicmod.main_tab": "Magic & Industry Tab"
}Your final ZIP file should look like this:
my_mod.zip
├── pack.json
├── assets/
│ └── magicmod/
│ ├── lang/en_us.json
│ ├── models/item/fire_wand.json
│ └── textures/item/fire_wand.png
└── mod/
├── item/fire_wand.json
├── block/healing_station.json
├── tab/main_tab.json
└── scripts/
├── global.js
├── fire_wand.js
└── healing_station.js
-
Dedicated Servers: Put the same ZIP files in the server's
modpacksfolder. -
Players: Every player must have the exact same ZIP files in their local
modpacksfolder to connect. - Scripts: The Server's scripts are the "Master." If a player changes their local script to give them infinite health, it won't work because the Server runs its own version of the code.
-
ctx.chat(msg)- Send a message to the player. -
ctx.actionBar(msg)- Show text above the hotbar. -
ctx.heal(amount)- Heal (2.0 = 1 heart). -
ctx.damage(amount)- Deal magic damage. -
ctx.explode(power, fire)- Create an explosion at the player. -
ctx.setBlock(x, y, z, id)- Change a block in the world. -
ctx.giveItem(id, count)- Add item to inventory. -
ctx.addEffect(id, duration, amp)- Give potion effect. -
ctx.spawnParticle(id, x, y, z, count, ...)- Show particles.