Skip to content

Hotbar

A row of slots along the bottom of the screen showing what the Inventory holds, with how many. Pick a slot with the number keys or the mouse wheel; a BlockBuilder puts down the picked block.

Part of the Block Worlds module: Block worlds, Terraria style: worlds made from a seed (WorldGenerator), blocks that break, fall, glow and are kept in the save data (Blocks), digging and building (BlockBuilder), a Hotbar and Crafting, and the Sandbox template.

Requires: Inventory (what it shows)

Works with: BlockBuilder (puts down what’s picked)

Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.

  • slots: a whole number = 9. How many slots it has, up to 10. (Field: a number.)
  • selected: a whole number = 0. The picked slot, counting from 0. (Field: a number.)
  • colors: lines of text: an array of strings, or one string with line breaks = []. Item colors for the slots, one per row: a name and a color, e.g. “Dirt #8B5A2B”. Others get a color from their name. (Items’ colors, one per row: a name and a hex color, e.g. “Dirt #8B5A2B”. The Inspector lists them a row each with the color shown.) (Field: its own editor: Item Colors.)

What anything can make it do with no code: a Trigger’s do when its message arrives, a Contraptions Wire’s input as its signal comes on, a script’s Game.Do(entity, “Name”).

  • Next. Picks the next slot along, as the mouse wheel does (round to the first after the last).
  • Previous. Picks the slot before, as the mouse wheel does (round to the last before the first).
  • Pick (done with a whole number, its slot: a trigger’s with, 1 without one). Picks slot slot, counting from 1 as the number keys do.

What anything can read with no code: a Counter’s, Bar’s or Text’s output, a Contraptions Wire’s output as its signal; Text shows names too, the rest read numbers, true as 1.

  • SelectedItem (a name). The item in the picked slot, or null if it’s empty.
  • SelectedCount (a whole number). How many of the picked slot’s item it holds: the blocks left to place.
  • Blocks (a whole number, read by a item after a colon, e.g. “Blocks:Dirt”). How many of item (e.g. “Dirt”) its slots hold. Read as “Blocks:Dirt”.

Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.

  • selectedItem: text. The item in the picked slot, or null if it’s empty.
  • selectedCount: a whole number. How many of the picked slot’s item it holds: the blocks left to place.

Scripts use it as Hotbar: its methods, events and values that aren’t saved with the scene.