Missing blocks

This commit is contained in:
2026-11-22 13:55:30 -03:00
parent 784bac7dd2
commit b9deda1a55
30 changed files with 1320 additions and 11 deletions
+10
View File
@@ -0,0 +1,10 @@
{
"format_version": 1,
"block": {
"id": "dangerous_business:chain",
"textures": { "chain": "dangerous_business:iron_chain" },
"model": "dangerous_business:chain",
"render_layer": "cutout",
"shape": [[6.5, 0, 6.5, 9.5, 16, 9.5]]
}
}
@@ -0,0 +1,61 @@
{
"format_version": 1,
"block": {
"id": "dangerous_business:deepslate_tile_wall",
"textures": {
"wall": "dangerous_business:deepslate_tiles"
},
"item_model": "dangerous_business:wall_inventory",
"states": [
{
"name": "north",
"bits": 1,
"default": 0
},
{
"name": "east",
"bits": 1,
"default": 0
},
{
"name": "south",
"bits": 1,
"default": 0
},
{
"name": "west",
"bits": 1,
"default": 0
}
],
"parts": [
{
"model": "dangerous_business:template_wall_post"
},
{
"when": "north=1",
"model": "dangerous_business:template_wall_side"
},
{
"when": "east=1",
"model": "dangerous_business:template_wall_side",
"y": 90
},
{
"when": "south=1",
"model": "dangerous_business:template_wall_side",
"y": 180
},
{
"when": "west=1",
"model": "dangerous_business:template_wall_side",
"y": 270
}
],
"components": {
"dangerous_business:connects": {
"solid": true
}
}
}
}
@@ -0,0 +1,81 @@
{
"format_version": 1,
"block": {
"id": "dangerous_business:iron_bars",
"textures": {
"pane": "dangerous_business:iron_bars",
"edge": "dangerous_business:iron_bars"
},
"render_layer": "cutout",
"states": [
{
"name": "north",
"bits": 1,
"default": 0
},
{
"name": "east",
"bits": 1,
"default": 0
},
{
"name": "south",
"bits": 1,
"default": 0
},
{
"name": "west",
"bits": 1,
"default": 0
}
],
"parts": [
{
"model": "dangerous_business:template_glass_pane_post"
},
{
"when": "north=1",
"model": "dangerous_business:template_glass_pane_side"
},
{
"when": "north=0",
"model": "dangerous_business:template_glass_pane_noside"
},
{
"when": "east=1",
"model": "dangerous_business:template_glass_pane_side",
"y": 90
},
{
"when": "east=0",
"model": "dangerous_business:template_glass_pane_noside",
"y": 90
},
{
"when": "south=1",
"model": "dangerous_business:template_glass_pane_side",
"y": 180
},
{
"when": "south=0",
"model": "dangerous_business:template_glass_pane_noside",
"y": 180
},
{
"when": "west=1",
"model": "dangerous_business:template_glass_pane_side",
"y": 270
},
{
"when": "west=0",
"model": "dangerous_business:template_glass_pane_noside",
"y": 270
}
],
"components": {
"dangerous_business:connects": {
"solid": true
}
}
}
}
@@ -0,0 +1,7 @@
{
"format_version": 1,
"block": {
"id": "dangerous_business:iron_block",
"textures": "dangerous_business:iron_block"
}
}
@@ -0,0 +1,7 @@
{
"format_version": 1,
"block": {
"id": "dangerous_business:polished_andesite",
"textures": "dangerous_business:polished_andesite"
}
}
@@ -0,0 +1,57 @@
{
"format_version": 1,
"block": {
"id": "dangerous_business:purpur_stairs",
"textures": "dangerous_business:purpur_block",
"model": "dangerous_business:stairs",
"item_model": "dangerous_business:stairs",
"states": [
{
"name": "facing",
"bits": 2,
"default": 0
},
{
"name": "half",
"bits": 1,
"default": 0
}
],
"variants": {
"facing=0": {
"y": 270,
"uvlock": true
},
"facing=2": {
"y": 90,
"uvlock": true
},
"facing=3": {
"y": 180,
"uvlock": true
},
"half=1": {
"x": 180,
"uvlock": true,
"shape": [
[
0,
8,
0,
16,
16,
16
],
[
8,
0,
0,
16,
8,
16
]
]
}
}
}
}
@@ -0,0 +1,57 @@
{
"format_version": 1,
"block": {
"id": "dangerous_business:smooth_sandstone_stairs",
"textures": "dangerous_business:smooth_sandstone",
"model": "dangerous_business:stairs",
"item_model": "dangerous_business:stairs",
"states": [
{
"name": "facing",
"bits": 2,
"default": 0
},
{
"name": "half",
"bits": 1,
"default": 0
}
],
"variants": {
"facing=0": {
"y": 270,
"uvlock": true
},
"facing=2": {
"y": 90,
"uvlock": true
},
"facing=3": {
"y": 180,
"uvlock": true
},
"half=1": {
"x": 180,
"uvlock": true,
"shape": [
[
0,
8,
0,
16,
16,
16
],
[
8,
0,
0,
16,
8,
16
]
]
}
}
}
}
@@ -0,0 +1,163 @@
{
"format_version": 1,
"block": {
"id": "dangerous_business:spruce_fence",
"textures": {
"side": "dangerous_business:spruce_fence_side",
"top": "dangerous_business:spruce_fence_side"
},
"item_model": "dangerous_business:fence_inventory",
"render_layer": "cutout",
"states": [
{
"name": "north",
"bits": 1,
"default": 0
},
{
"name": "east",
"bits": 1,
"default": 0
},
{
"name": "south",
"bits": 1,
"default": 0
},
{
"name": "west",
"bits": 1,
"default": 0
}
],
"parts": [
{
"model": "dangerous_business:fence_post",
"shape": [
[
6,
0,
6,
10,
16,
10
]
],
"collision_shape": [
[
6,
0,
6,
10,
24,
10
]
]
},
{
"when": "north=1",
"model": "dangerous_business:fence_side",
"shape": [
[
7,
0,
0,
9,
16,
9
]
],
"collision_shape": [
[
7,
0,
0,
9,
24,
9
]
]
},
{
"when": "east=1",
"model": "dangerous_business:fence_side",
"shape": [
[
7,
0,
0,
9,
16,
9
]
],
"collision_shape": [
[
7,
0,
0,
9,
24,
9
]
],
"y": 90
},
{
"when": "south=1",
"model": "dangerous_business:fence_side",
"shape": [
[
7,
0,
0,
9,
16,
9
]
],
"collision_shape": [
[
7,
0,
0,
9,
24,
9
]
],
"y": 180
},
{
"when": "west=1",
"model": "dangerous_business:fence_side",
"shape": [
[
7,
0,
0,
9,
16,
9
]
],
"collision_shape": [
[
7,
0,
0,
9,
24,
9
]
],
"y": 270
}
],
"components": {
"dangerous_business:connects": {
"solid": true
}
}
}
}
+28
View File
@@ -0,0 +1,28 @@
{
"format_version": 1,
"model": {
"id": "dangerous_business:chain",
"elements": [
{
"from": [6.5, 0, 8],
"to": [9.5, 16, 8],
"rotation": { "origin": [8, 8, 8], "axis": "y", "angle": 45 },
"shade": false,
"faces": {
"north": { "texture": "#chain", "uv": [3, 0, 0, 16] },
"south": { "texture": "#chain", "uv": [0, 0, 3, 16] }
}
},
{
"from": [8, 0, 6.5],
"to": [8, 16, 9.5],
"rotation": { "origin": [8, 8, 8], "axis": "y", "angle": 45 },
"shade": false,
"faces": {
"east": { "texture": "#chain", "uv": [3, 0, 6, 16] },
"west": { "texture": "#chain", "uv": [6, 0, 3, 16] }
}
}
]
}
}
@@ -0,0 +1,280 @@
{
"format_version": 1,
"model": {
"id": "dangerous_business:fence_inventory",
"elements": [
{
"from": [
6,
0,
0
],
"to": [
10,
16,
4
],
"faces": {
"north": {
"texture": "#side",
"uv": [
6,
0,
10,
16
]
},
"south": {
"texture": "#side",
"uv": [
6,
0,
10,
16
]
},
"east": {
"texture": "#side",
"uv": [
6,
0,
10,
16
]
},
"west": {
"texture": "#side",
"uv": [
6,
0,
10,
16
]
},
"top": {
"texture": "#top",
"uv": [
6,
6,
10,
10
]
},
"bottom": {
"texture": "#top",
"uv": [
6,
6,
10,
10
]
}
}
},
{
"from": [
6,
0,
12
],
"to": [
10,
16,
16
],
"faces": {
"north": {
"texture": "#side",
"uv": [
6,
0,
10,
16
]
},
"south": {
"texture": "#side",
"uv": [
6,
0,
10,
16
]
},
"east": {
"texture": "#side",
"uv": [
6,
0,
10,
16
]
},
"west": {
"texture": "#side",
"uv": [
6,
0,
10,
16
]
},
"top": {
"texture": "#top",
"uv": [
6,
6,
10,
10
]
},
"bottom": {
"texture": "#top",
"uv": [
6,
6,
10,
10
]
}
}
},
{
"from": [
7,
12,
0
],
"to": [
9,
15,
16
],
"faces": {
"north": {
"texture": "#side",
"uv": [
7,
1,
9,
4
]
},
"south": {
"texture": "#side",
"uv": [
7,
1,
9,
4
]
},
"east": {
"texture": "#side",
"uv": [
0,
1,
16,
4
]
},
"west": {
"texture": "#side",
"uv": [
0,
1,
16,
4
]
},
"top": {
"texture": "#top",
"uv": [
7,
0,
9,
16
]
},
"bottom": {
"texture": "#top",
"uv": [
7,
0,
9,
16
]
}
}
},
{
"from": [
7,
6,
0
],
"to": [
9,
9,
16
],
"faces": {
"north": {
"texture": "#side",
"uv": [
7,
7,
9,
10
]
},
"south": {
"texture": "#side",
"uv": [
7,
7,
9,
10
]
},
"east": {
"texture": "#side",
"uv": [
0,
7,
16,
10
]
},
"west": {
"texture": "#side",
"uv": [
0,
7,
16,
10
]
},
"top": {
"texture": "#top",
"uv": [
7,
0,
9,
16
]
},
"bottom": {
"texture": "#top",
"uv": [
7,
0,
9,
16
]
}
}
}
]
}
}
@@ -0,0 +1,78 @@
{
"format_version": 1,
"model": {
"id": "dangerous_business:fence_post",
"elements": [
{
"from": [
6,
0,
6
],
"to": [
10,
16,
10
],
"faces": {
"north": {
"texture": "#side",
"uv": [
6,
0,
10,
16
]
},
"east": {
"texture": "#side",
"uv": [
6,
0,
10,
16
]
},
"south": {
"texture": "#side",
"uv": [
6,
0,
10,
16
]
},
"west": {
"texture": "#side",
"uv": [
6,
0,
10,
16
]
},
"top": {
"texture": "#top",
"uv": [
6,
6,
10,
10
],
"cullface": "top"
},
"bottom": {
"texture": "#top",
"uv": [
6,
6,
10,
10
],
"cullface": "bottom"
}
}
}
]
}
}
@@ -0,0 +1,128 @@
{
"format_version": 1,
"model": {
"id": "dangerous_business:fence_side",
"elements": [
{
"from": [
7,
12,
0
],
"to": [
9,
15,
9
],
"faces": {
"north": {
"texture": "#side",
"uv": [
7,
1,
9,
4
],
"cullface": "north"
},
"east": {
"texture": "#side",
"uv": [
7,
1,
16,
4
]
},
"west": {
"texture": "#side",
"uv": [
0,
1,
9,
4
]
},
"top": {
"texture": "#top",
"uv": [
7,
0,
9,
9
]
},
"bottom": {
"texture": "#top",
"uv": [
7,
0,
9,
9
]
}
}
},
{
"from": [
7,
6,
0
],
"to": [
9,
9,
9
],
"faces": {
"north": {
"texture": "#side",
"uv": [
7,
7,
9,
10
],
"cullface": "north"
},
"east": {
"texture": "#side",
"uv": [
7,
7,
16,
10
]
},
"west": {
"texture": "#side",
"uv": [
0,
7,
9,
10
]
},
"top": {
"texture": "#top",
"uv": [
7,
0,
9,
9
]
},
"bottom": {
"texture": "#top",
"uv": [
7,
0,
9,
9
]
}
}
}
]
}
}
@@ -0,0 +1,78 @@
{
"format_version": 1,
"model": {
"id": "dangerous_business:stairs",
"elements": [
{
"from": [
0,
0,
0
],
"to": [
16,
8,
16
],
"faces": {
"bottom": {
"texture": "#bottom",
"cullface": "bottom"
},
"top": {
"texture": "#top"
},
"north": {
"texture": "#side",
"cullface": "north"
},
"south": {
"texture": "#side",
"cullface": "south"
},
"west": {
"texture": "#side",
"cullface": "west"
},
"east": {
"texture": "#side",
"cullface": "east"
}
}
},
{
"from": [
8,
8,
0
],
"to": [
16,
16,
16
],
"faces": {
"top": {
"texture": "#top",
"cullface": "top"
},
"north": {
"texture": "#side",
"cullface": "north"
},
"south": {
"texture": "#side",
"cullface": "south"
},
"west": {
"texture": "#side"
},
"east": {
"texture": "#side",
"cullface": "east"
}
}
}
]
}
}
@@ -0,0 +1,25 @@
{
"format_version": 1,
"model": {
"id": "dangerous_business:template_glass_pane_noside",
"elements": [
{
"from": [
7,
0,
7
],
"to": [
9,
16,
9
],
"faces": {
"north": {
"texture": "#pane"
}
}
}
]
}
}
@@ -0,0 +1,30 @@
{
"format_version": 1,
"model": {
"id": "dangerous_business:template_glass_pane_post",
"elements": [
{
"from": [
7,
0,
7
],
"to": [
9,
16,
9
],
"faces": {
"bottom": {
"texture": "#edge",
"cullface": "bottom"
},
"top": {
"texture": "#edge",
"cullface": "top"
}
}
}
]
}
}
@@ -0,0 +1,40 @@
{
"format_version": 1,
"model": {
"id": "dangerous_business:template_glass_pane_side",
"elements": [
{
"from": [
7,
0,
0
],
"to": [
9,
16,
7
],
"faces": {
"bottom": {
"texture": "#edge",
"cullface": "bottom"
},
"top": {
"texture": "#edge",
"cullface": "top"
},
"north": {
"texture": "#edge",
"cullface": "north"
},
"west": {
"texture": "#pane"
},
"east": {
"texture": "#pane"
}
}
}
]
}
}
@@ -0,0 +1,42 @@
{
"format_version": 1,
"model": {
"id": "dangerous_business:template_wall_post",
"elements": [
{
"from": [
4,
0,
4
],
"to": [
12,
16,
12
],
"faces": {
"bottom": {
"texture": "#wall",
"cullface": "bottom"
},
"top": {
"texture": "#wall",
"cullface": "top"
},
"north": {
"texture": "#wall"
},
"south": {
"texture": "#wall"
},
"west": {
"texture": "#wall"
},
"east": {
"texture": "#wall"
}
}
}
]
}
}
@@ -0,0 +1,39 @@
{
"format_version": 1,
"model": {
"id": "dangerous_business:template_wall_side",
"elements": [
{
"from": [
5,
0,
0
],
"to": [
11,
14,
8
],
"faces": {
"bottom": {
"texture": "#wall",
"cullface": "bottom"
},
"top": {
"texture": "#wall"
},
"north": {
"texture": "#wall",
"cullface": "north"
},
"west": {
"texture": "#wall"
},
"east": {
"texture": "#wall"
}
}
}
]
}
}
@@ -0,0 +1,76 @@
{
"format_version": 1,
"model": {
"id": "dangerous_business:wall_inventory",
"elements": [
{
"from": [
4,
0,
4
],
"to": [
12,
16,
12
],
"faces": {
"bottom": {
"texture": "#wall",
"cullface": "bottom"
},
"top": {
"texture": "#wall",
"cullface": "top"
},
"north": {
"texture": "#wall"
},
"south": {
"texture": "#wall"
},
"west": {
"texture": "#wall"
},
"east": {
"texture": "#wall"
}
}
},
{
"from": [
5,
0,
0
],
"to": [
11,
13,
16
],
"faces": {
"bottom": {
"texture": "#wall"
},
"top": {
"texture": "#wall"
},
"north": {
"texture": "#wall",
"cullface": "north"
},
"south": {
"texture": "#wall",
"cullface": "south"
},
"west": {
"texture": "#wall"
},
"east": {
"texture": "#wall"
}
}
}
]
}
}
Binary file not shown.
+20 -11
View File
@@ -1,4 +1,4 @@
import type { SharedContext } from "cubi/shared";
import type { Face, SharedContext } from "cubi/shared";
export const FACILITY_DOOR = "dangerous_business:facility_door";
export const DOOR = "dangerous_business:door";
@@ -41,26 +41,35 @@ function register_pipe(ctx: SharedContext) {
}
// sets its north, east, south and west states (and top, with "up") to 1 where the same block is beside it, so it can
// hide its edges there, like floor grates joining into one floor
// hide its edges there, like floor grates joining into one floor. with "solid" it joins the full sides of other blocks
// beside it too, like iron bars, fences and walls set into a wall
interface ConnectsParams {
up?: boolean;
solid?: boolean;
}
function register_connects(ctx: SharedContext) {
const sides = (id: string | undefined, x: number, y: number, z: number, up: boolean) => {
const sides = (id: string | undefined, x: number, y: number, z: number, params: ConnectsParams) => {
const same = (dx: number, dy: number, dz: number) => ctx.world.get_block(x + dx, y + dy, z + dz) === id ? 1 : 0;
// the side of the block there that faces this one
const joins = (dx: number, dz: number, face: Face) =>
same(dx, 0, dz) || (params.solid && ctx.world.is_face_sturdy(x + dx, y, z + dz, face)) ? 1 : 0;
const states: Record<string, number> = {
north: same(0, 0, -1),
east: same(1, 0, 0),
south: same(0, 0, 1),
west: same(-1, 0, 0),
north: joins(0, -1, "south"),
east: joins(1, 0, "west"),
south: joins(0, 1, "north"),
west: joins(-1, 0, "east"),
};
if (up) states.top = same(0, 1, 0);
if (params.up) states.top = same(0, 1, 0);
return states;
};
ctx.components.register_block<{ up?: boolean }>("dangerous_business:connects", {
ctx.components.register_block<ConnectsParams>("dangerous_business:connects", {
// the block being placed is the item's
state_for_placement: (placement, params) =>
sides(placement.item, placement.x, placement.y, placement.z, params.up ?? false),
sides(placement.item, placement.x, placement.y, placement.z, params),
on_neighbor_change(block, params) {
const id = ctx.world.get_block(block.x, block.y, block.z);
for (const [state, value] of Object.entries(sides(id, block.x, block.y, block.z, params.up ?? false))) {
for (const [state, value] of Object.entries(sides(id, block.x, block.y, block.z, params))) {
ctx.world.set_state(block.x, block.y, block.z, state, value);
}
},
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

+13
View File
@@ -92,6 +92,19 @@ Deno.test("a connecting block joins the same block beside it, and parts when it'
assertEquals(state(0, 100, 0, "east"), 0);
});
Deno.test("a connecting block that joins solid blocks joins the full side of another block too", async () => {
const { t, hold, state } = await setup();
t.send(1, { type: "chat", text: "/give dangerous_business:iron_bars" });
hold(4);
t.game.set_block(1, 100, 0, FLOOR);
t.send(1, { type: "use_block", x: 0, y: 99, z: 0, face: "top", hit: [0.5, 1, 0.5] });
assertEquals(state(0, 100, 0, "east"), 1);
assertEquals(state(0, 100, 0, "west"), 0);
t.game.set_block(1, 100, 0, "cubi:air");
assertEquals(state(0, 100, 0, "east"), 0);
});
Deno.test("a block with a random look picks the same one wherever it's placed again", async () => {
const { t, hold, state } = await setup();
hold(2);