← bgplus.ca

For developers

Tie your own mod into Blockgame+ with these public, versioned hooks. Add Blockgame+ as an optional dependency and your mod still runs standalone without it.

Room API

A "room" is a sealed build with a trigger block. A player builds it, right-clicks the trigger, and Blockgame+ scans the room and hands you the result - open a screen, run an action, anything. The trigger has to be a block that opens a screen server-side (a container, smithing table, furnace, and so on): that open is what we intercept.

  1. Add Blockgame+ as a remapped mod dependency in build.gradle: modImplementation files("libs/bgplus-2.4.0.jar") - it stays a separate mod your users install, and Loom remaps it to your mappings with no transitive dependencies.
  2. Declare a bgplus:rooms entrypoint pointing at a BgplusRoomProvider.
  3. Register a RoomType with a trigger block, a room signature, and an on-open action.
// fabric.mod.json
"entrypoints": {
  "bgplus:rooms": ["com.you.MyRooms"]
}

// MyRooms.java
public class MyRooms implements BgplusRoomProvider {
  public void registerRooms(RoomRegistry r) {
    r.register(RoomType.builder("mymod:forge")
      .trigger(Blocks.BLAST_FURNACE)
      .signature(room -> room.sealed()
        && room.count(Blocks.NETHERITE_BLOCK) > 0)
      .onOpen(ctx -> Minecraft.getInstance()
        .setScreen(new MyForgeScreen(ctx)))
      .build());
  }
}

API version 1 · requires Blockgame+ 2.4.0 or newer · client side. The RoomView your signature receives exposes sealed(), count(block), bookshelves(), hasOutline(), containers() and the room bounds.

HUD widget API

Make your own mod's HUD widget draggable and scroll-to-resize inside Blockgame+'s HUD Layout editor (/bgplus hud), right alongside ours. Blockgame+ stays optional - guard the integration behind a mod-loaded check and your mod still runs standalone.

  1. Add Blockgame+ as an optional compile dependency: modCompileOnly files("libs/bgplus-2.4.0.jar") - Loom remaps it, and Yarn mods get the Yarn types (MinecraftClient / DrawContext) automatically.
  2. Implement EditableWidget (store your position as screen fractions 0..1) and register it once at client init, behind an isModLoaded("bgplus") guard.
  3. Bail your live HUD render while the editor is open, so only its preview draws.
// only when bgplus is present (keep this in its own class)
if (FabricLoader.getInstance().isModLoaded("bgplus")) {
  HudEditorRegistry.register(new EditableWidget() {
    public String id() { return "mymod:my_widget"; }
    public int[] bounds(Minecraft mc) { return new int[]{ x, y, w, h }; }
    public void render(GuiGraphics g, Minecraft mc, boolean preview) { /* draw it */ }
    public void setPositionFraction(float fx, float fy) { /* store fractions */ }
    public void save() { /* persist on editor close */ }
  });
}

// first line of your live HUD render, so the widget doesn't double up:
if (HudEditorRegistry.isEditorOpen()) return;

Types are in cody.bgplus.client.hud. Every method is called defensively, so a bug on your side can't crash our editor. Optional overrides: displayName(), enabled(), scale() / setScale() for scroll-resize.

Other hooks

Smaller extension points, same optional-dependency setup (modCompileOnly files("libs/bgplus-2.4.0.jar"), guarded by isModLoaded("bgplus")):

Build a room (for players)

The Armory

Seal a room with a smithing table, an anvil, and a gold block. Right-click the table to open your gear vault.

Rune Library

Seal a room with 3 or more bookshelves and a polished-blackstone-brick or chiseled-stone-brick outline, plus a barrel named "altar" to open it.

More integration points will land here as they open up.