Get started

Your first mod

Make a mod from a template, change it in the game's code editor, run it and fix it when it breaks. It takes about five minutes.

광고

This page walks you through a real mod from start to finish. You do not need to know Lua yet. Every step says exactly what to click.

1. Open the game

Open Eaglercraft 26.3 (26.2 works too) and wait for the title screen.

2. Open the Mods menu

Click Mods on the title screen. It sits right next to Options..., where the normal game has Quit Game.

Your list is empty for now. The buttons along the bottom are how you add mods: Import mod brings in a mod someone else made, and Create mod starts a new one.

3. Create a mod

Click Create mod and fill in the form:

  1. Type a name in Mod name, like My First Mod.
  2. Put your name in Author if you want to.
  3. The Template button picks the code you start with. Click it until it says Template: HUD element.
  4. Click Create.

Zeus makes the mod, turns it on and opens it in the code editor.

4. Read the code

The HUD element template looks like this:

-- name: My First Mod
-- version: 1.0.0

settings.toggle("enabled", { label = "Show text", default = true })

hud.add(function(ctx)
  if not settings.enabled then return end
  ctx:text("Hello from My First Mod!", 4, 4, "#55FF55")
end)

Here is what each part does:

  • Lines that start with -- are comments. The game skips them when it runs your code.
  • settings.toggle adds an on and off setting called Show text. Players can flip it in the Mods menu.
  • hud.add hands the game a function to call every frame, while it draws the HUD. ctx is the thing you draw with.
  • if not settings.enabled then return end stops early when the setting is off, so nothing gets drawn.
  • ctx:text draws text. It takes the words, then x and y in pixels from the top left corner, then a color.

5. Change something

Change the ctx:text line so it says your name:

  ctx:text("Hello, " .. player.name() .. "!", 4, 4, "#55FF55")

.. joins pieces of text together in Lua, and player.name() is your username.

Now click Save & reload. The status line says "Saved and reloaded", which means your new code is already running.

6. See it in a world

Click Close, then Done, then open any singleplayer world. Your hello is in the top left corner.

Mods only run in singleplayer. If you join a server, your mod pauses until you leave. How mods run explains why.

7. Flip the setting

Leave the world, open Mods again, pick your mod and click Settings. Click Show text so it says OFF and click Done. Open your world again and the text is gone.

That is all a setting is: a value your code reads, that players can change without touching the code.

8. Break it on purpose

Every modder hits errors, so it is good to see one now. Open your mod with Edit code and change player.name() to player.nam(), then click Save & reload.

The mod still loads, because nothing is wrong until that line runs. Open a world and two things happen. The text is missing, and a popup says your mod stopped. Your function now fails every frame, and after 30 errors in a minute Zeus stops the mod so it cannot spam the game.

To find the problem, open Mods, pick your mod and click Log. Each error is there with the file and line number it happened on. Fix the typo, click Save & reload, and your mod is back.

What's next

You can also start from the other templates. Keybind runs code when you press a key, Custom screen opens a menu of your own, and Blank is an empty mod.