Rename engine to cubi

This commit is contained in:
2026-11-03 17:17:37 -03:00
parent 68b78f053a
commit 98fa45ebd1
109 changed files with 643 additions and 788 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ a snowy biome.
"format_version": 1,
"block": {
"id": "bworld:cabbages",
"model": "engine:cross",
"model": "cubi:cross",
"textures": { "cross": "bworld:cabbages_stage0" },
"variants": {
"age=1": { "textures": { "cross": "bworld:cabbages_stage1" } },
+15 -15
View File
@@ -30,21 +30,21 @@ of tier 1 (stone or copper) or better.
### Looks
| Field | Default | Meaning |
| ---------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id` | required | The block's id. |
| `name` | from the id | What players see. `copper_tools:copper_block` is "Copper Block" when not set. Its item uses it too. |
| `textures` | required | One texture id for every side, `{ "top", "bottom", "side" }`, or `{ "front", "side" }` (optionally with `top` and `bottom`) for a block that faces a way. With another `model`, the model's texture variables. |
| `model` | `engine:cube` | The [block model](../resources/models.md). |
| `variants` | none | Other models, textures or rotations for some [states](states.md). |
| `parts` | none | Models drawn together depending on [states](states.md), like a fence's post and bars. See [Parts](../resources/models.md#parts). |
| `item_model` | none | The model its item is drawn with. See [Item Models](../resources/models.md#item-models). |
| `render_layer` | `solid` | `solid`; `cutout` for texels that are fully opaque or fully clear, like leaves; `translucent` for blended ones, like water and glass. |
| `cull_same` | see meaning | Hide the faces between two of this block. `true` for translucent blocks, `false` otherwise. |
| `alpha` | `1` | Opacity, for translucent blocks. |
| `tint` | none | Draws its textures in a color, see [below](#tinting). |
| `light_emission` | `0` | Light it gives off, 0-15. A torch is 14. |
| `light_opacity` | see meaning | How much light passing through it loses, 0-15. `15` for solid blocks, `0` otherwise. Leaves and water use `1`. |
| Field | Default | Meaning |
| ---------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id` | required | The block's id. |
| `name` | from the id | What players see. `copper_tools:copper_block` is "Copper Block" when not set. Its item uses it too. |
| `textures` | required | One texture id for every side, `{ "top", "bottom", "side" }`, or `{ "front", "side" }` (optionally with `top` and `bottom`) for a block that faces a way. With another `model`, the model's texture variables. |
| `model` | `cubi:cube` | The [block model](../resources/models.md). |
| `variants` | none | Other models, textures or rotations for some [states](states.md). |
| `parts` | none | Models drawn together depending on [states](states.md), like a fence's post and bars. See [Parts](../resources/models.md#parts). |
| `item_model` | none | The model its item is drawn with. See [Item Models](../resources/models.md#item-models). |
| `render_layer` | `solid` | `solid`; `cutout` for texels that are fully opaque or fully clear, like leaves; `translucent` for blended ones, like water and glass. |
| `cull_same` | see meaning | Hide the faces between two of this block. `true` for translucent blocks, `false` otherwise. |
| `alpha` | `1` | Opacity, for translucent blocks. |
| `tint` | none | Draws its textures in a color, see [below](#tinting). |
| `light_emission` | `0` | Light it gives off, 0-15. A torch is 14. |
| `light_opacity` | see meaning | How much light passing through it loses, 0-15. `15` for solid blocks, `0` otherwise. Leaves and water use `1`. |
Only `solid` blocks hide their neighbors' faces. Blocks that aren't full cubes, like plants, should use `cutout`, or
there will be holes in the world behind them.
+1 -1
View File
@@ -53,7 +53,7 @@ a texture per growth stage:
"format_version": 1,
"block": {
"id": "bworld:wheat",
"model": "engine:crop",
"model": "cubi:crop",
"textures": { "crop": "bworld:wheat_stage_0" },
"variants": {
"age=1": { "textures": { "crop": "bworld:wheat_stage_1" } },
+3 -4
View File
@@ -15,10 +15,9 @@ An id looks like `namespace:name`, like `bworld:cabbage`:
Two namespaces are reserved:
- `bworld` belongs to the base game, `mods/bworld`.
- `engine` belongs to the engine: the missing texture `engine:missing`, the breaking cracks `engine:break_0` to
`engine:break_8`, and the built-in block models `engine:cube`, `engine:cross` and `engine:crop`.
`bworld:air` is the one exception: it's the engine's empty block, but keeps that id because every save has it.
- `cubi` belongs to the engine: the empty block `cubi:air`, the entity types `cubi:player` and `cubi:item`, the
[attributes](../entities/players.md) like `cubi:max_health`, the missing texture `cubi:missing`, the breaking cracks
`cubi:break_0` to `cubi:break_8`, and the built-in block models `cubi:cube`, `cubi:cross` and `cubi:crop`.
[Tags](../resources/tags.md) aren't registered like this: they're lists that every mod can add to, their ids can have
folders (`c:ingots/iron`), and the `c` namespace is shared by every mod.
+1 -1
View File
@@ -18,7 +18,7 @@ game's effects are defined this way, in `mods/bworld/effects`.
"id": "copper_tools:swiftness",
"category": "beneficial",
"icon": "copper_tools:swiftness",
"modifiers": [{ "attribute": "bworld:movement_speed", "amount": 0.1, "operation": "add_multiplied_total" }]
"modifiers": [{ "attribute": "cubi:movement_speed", "amount": 0.1, "operation": "add_multiplied_total" }]
}
}
```
+2 -2
View File
@@ -172,12 +172,12 @@ have a `push` too, see [Players](players.md#pushing).
Minecraft's `getEntitiesOfClass`, only the ones of `type` when it's given. Players aren't among them, they're in
`ctx.players`.
Items lying around are entities of type `bworld:item`. A machine that works on them, like a press, finds them, changes
Items lying around are entities of type `cubi:item`. A machine that works on them, like a press, finds them, changes
them with `set_item`, and adds what it made with `ctx.world.spawn_item`, which lays an item down still where it's put,
unlike `drop_item`, which pops it out of a block:
```ts
const [item] = ctx.world.entities_in({ x, y: y - 1, z }, { x: x + 1, y, z: z + 1 }, "bworld:item");
const [item] = ctx.world.entities_in({ x, y: y - 1, z }, { x: x + 1, y, z: z + 1 }, "cubi:item");
const stack = item?.get_item();
if (stack?.id === "bworld:iron_ingot") {
item.set_item(stack.count > 1 ? { ...stack, count: stack.count - 1 } : undefined);
+13 -13
View File
@@ -35,7 +35,7 @@ interface Player {
teleport(x: number, y: number, z: number): void;
readonly health: number; // out of max_health
readonly max_health: number; // 20, or what the bworld:max_health attribute makes it
readonly max_health: number; // 20, or what the cubi:max_health attribute makes it
readonly food: number; // hunger, out of 20
readonly saturation: number; // never above food
@@ -74,7 +74,7 @@ what a player is looking at, like Minecraft's `getPlayerPOVHitResult`:
```ts
const eye = player.eye_position;
const look = player.look_direction;
const reach = player.attribute("bworld:block_interaction_range");
const reach = player.attribute("cubi:block_interaction_range");
const to = { x: eye.x + look.x * reach, y: eye.y + look.y * reach, z: eye.z + look.z * reach };
const hit = ctx.world.raycast(eye, to, { fluids: "source_only" });
```
@@ -106,17 +106,17 @@ even when their game isn't running, like in a background tab.
A player's stats are attributes, like Minecraft's: a base value that modifiers change without touching it.
| Attribute | Base | Meaning |
| --------------------------------- | ---- | -------------------------------------------------------------------------- |
| `bworld:attack_damage` | 1 | How much their hits do. |
| `bworld:attack_speed` | 4 | Full strength attacks a second. Hitting sooner than that does less damage. |
| `bworld:block_interaction_range` | 6 | How far from their eyes they break and use blocks, in blocks. |
| `bworld:entity_interaction_range` | 3 | How far from their eyes they hit entities, in blocks. |
| Attribute | Base | Meaning |
| ------------------------------- | ---- | -------------------------------------------------------------------------- |
| `cubi:attack_damage` | 1 | How much their hits do. |
| `cubi:attack_speed` | 4 | Full strength attacks a second. Hitting sooner than that does less damage. |
| `cubi:block_interaction_range` | 6 | How far from their eyes they break and use blocks, in blocks. |
| `cubi:entity_interaction_range` | 3 | How far from their eyes they hit entities, in blocks. |
```ts
player.add_modifier("bworld:attack_damage", { id: "my_mod:rage", amount: 2, operation: "add_value" });
player.attribute("bworld:attack_damage"); // 3
player.remove_modifier("bworld:attack_damage", "my_mod:rage");
player.add_modifier("cubi:attack_damage", { id: "my_mod:rage", amount: 2, operation: "add_value" });
player.attribute("cubi:attack_damage"); // 3
player.remove_modifier("cubi:attack_damage", "my_mod:rage");
```
The value is the base, plus every `add_value`, plus that times the amount of each `add_multiplied_base`, then times 1
@@ -136,13 +136,13 @@ reaches further gives a modifier while it's held, like Create's extendo grip:
ctx.events.after.tick.subscribe(() => {
for (const player of ctx.players.all()) {
if (player.held_item?.id === "copper_tools:grabber") {
player.add_modifier("bworld:block_interaction_range", {
player.add_modifier("cubi:block_interaction_range", {
id: "copper_tools:grabber",
amount: 3,
operation: "add_value",
});
} else {
player.remove_modifier("bworld:block_interaction_range", "copper_tools:grabber");
player.remove_modifier("cubi:block_interaction_range", "copper_tools:grabber");
}
}
});
+12 -12
View File
@@ -1,15 +1,15 @@
# Block Models
A block's model is its shape: the boxes it's made of and which texture goes on each face. Blocks use `engine:cube`
unless they set `model`. For entity models, see [Entities](../entities/index.md#entity-models).
A block's model is its shape: the boxes it's made of and which texture goes on each face. Blocks use `cubi:cube` unless
they set `model`. For entity models, see [Entities](../entities/index.md#entity-models).
## Built-In Models
| Model | Texture variables | Shape |
| -------------- | --------------------------------------------------------- | ---------------------------------------------- |
| `engine:cube` | one texture, `{ top, bottom, side }` or `{ front, side }` | A full block. |
| `engine:cross` | `cross` | Two crossed planes, like flowers and saplings. |
| `engine:crop` | `crop` | Four planes in a # shape, like wheat. |
| Model | Texture variables | Shape |
| ------------ | --------------------------------------------------------- | ---------------------------------------------- |
| `cubi:cube` | one texture, `{ top, bottom, side }` or `{ front, side }` | A full block. |
| `cubi:cross` | `cross` | Two crossed planes, like flowers and saplings. |
| `cubi:crop` | `crop` | Four planes in a # shape, like wheat. |
Blocks that aren't full cubes should use the `cutout` or `translucent` [render layer](../blocks/index.md#looks), since
`solid` blocks hide their neighbors' faces. They usually want `"collision": false` too.
@@ -24,13 +24,13 @@ Models name their textures with variables, like `#side`, and blocks fill them in
```json
{
"id": "bworld:sapling",
"model": "engine:cross",
"model": "cubi:cross",
"textures": { "cross": "bworld:sapling" }
}
```
For `engine:cube`, one texture id fills every face. `{ "front", "side" }` puts `front` on the north face and `side` on
the rest. It's for blocks that [face a way](../blocks/states.md#facing), and can also set `top` and `bottom`.
For `cubi:cube`, one texture id fills every face. `{ "front", "side" }` puts `front` on the north face and `side` on the
rest. It's for blocks that [face a way](../blocks/states.md#facing), and can also set `top` and `bottom`.
## Custom Models
@@ -126,7 +126,7 @@ player is standing in its other half, either.
By default it comes from the model: one box per element, turned with the block's `y`. An element turned by its own
`rotation` gets the box around it. Elements that are flat planes aren't boxes, so a model made only of planes, like
`engine:cross` and `engine:crop`, gets one box around all of them, which is what players point at to break the plant.
`cubi:cross` and `cubi:crop`, gets one box around all of them, which is what players point at to break the plant.
A block can set its own with `shape`, a list of boxes in pixels like `from` and `to` put together, as Minecraft's
`Block.box` does. That's for a shape simpler than the model, or one that's different from what's drawn, like a flower
@@ -136,7 +136,7 @@ their own, like a crop that's taller the older it is:
```json
{
"id": "copper_tools:rice",
"model": "engine:crop",
"model": "cubi:crop",
"textures": { "crop": "copper_tools:rice_3" },
"collision": false,
"states": [{ "name": "age", "bits": 2, "default": 0 }],
+4 -4
View File
@@ -63,15 +63,15 @@ than short ones.
## Missing Textures
A texture id that doesn't exist shows the magenta and black checker, `engine:missing`, and `check-mods` warns about it.
It isn't an error, so a mod still loads while its art is unfinished.
A texture id that doesn't exist shows the magenta and black checker, `cubi:missing`, and `check-mods` warns about it. It
isn't an error, so a mod still loads while its art is unfinished.
## Engine Textures
The engine's own textures use the `engine` namespace and come from `assets/`, not from a mod:
- `engine:missing`, the missing texture,
- `engine:break_0` to `engine:break_8`, the cracks drawn on a block being broken.
- `cubi:missing`, the missing texture,
- `cubi:break_0` to `cubi:break_8`, the cracks drawn on a block being broken.
## How Players Get Them
+4 -4
View File
@@ -268,7 +268,7 @@ If the base game can't be written as a mod, the API is missing something, and ot
**The engine** keeps what every game built on it needs: rendering, meshing, lighting and the sky; physics, player
movement and input; networking, saving, the game server and its loop; registries, the mod loader and the Game API;
containers, slot click rules, screens and the GUI toolkit; entities; chat; world time; `/tps`; `bworld:air`; and the
containers, slot click rules, screens and the GUI toolkit; entities; chat; world time; `/tps`; `cubi:air`; and the
engine assets in `assets/`.
**`mods/bworld`** has everything else:
@@ -358,9 +358,9 @@ features that are code or data (bworld's trees and cacti are code, in its worldg
workers (see [Chunk Streaming](#chunk-streaming)). The golden fixture checked every step made the same world block for
block, and the server refuses to start without the `bworld:overworld` generator.
**Done when** searching `client/`, `common/` and `server/` for `"bworld:` finds only `bworld:air`, removing
`mods/bworld` gives an engine that starts and says it needs a terrain generator, the base game uses no engine access,
and a world saved before any of this plays exactly the same.
**Done when** searching `client/`, `common/` and `server/` for `"bworld:` finds only `cubi:air`, removing `mods/bworld`
gives an engine that starts and says it needs a terrain generator, the base game uses no engine access, and a world
saved before any of this plays exactly the same.
## Open Questions