This commit is contained in:
2026-10-03 16:28:09 -03:00
parent 24fe7cdede
commit 91655c28c5
53 changed files with 1752 additions and 114 deletions
+99
View File
@@ -0,0 +1,99 @@
{
"format_version": 1,
"block": {
"id": "bworld:acacia_fence",
"name": "Acacia Fence",
"textures": {
"side": "bworld:acacia_fence_side",
"top": "bworld:acacia_fence_top"
},
"item_model": "bworld: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": "bworld:fence_post",
"shape": [
[6, 0, 6, 10, 16, 10]
],
"collision_shape": [
[6, 0, 6, 10, 24, 10]
]
},
{
"when": "north=1",
"model": "bworld:fence_side",
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "east=1",
"model": "bworld:fence_side",
"y": 90,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "south=1",
"model": "bworld:fence_side",
"y": 180,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "west=1",
"model": "bworld:fence_side",
"y": 270,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
}
],
"mining": {
"toughness": 3,
"tool": "axe"
},
"drops": "bworld:acacia_fence",
"components": {
"bworld:fence": {
"connects_to": "#bworld:wooden_fences"
}
}
}
}
+99
View File
@@ -0,0 +1,99 @@
{
"format_version": 1,
"block": {
"id": "bworld:birch_fence",
"name": "Birch Fence",
"textures": {
"side": "bworld:birch_fence_side",
"top": "bworld:birch_fence_top"
},
"item_model": "bworld: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": "bworld:fence_post",
"shape": [
[6, 0, 6, 10, 16, 10]
],
"collision_shape": [
[6, 0, 6, 10, 24, 10]
]
},
{
"when": "north=1",
"model": "bworld:fence_side",
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "east=1",
"model": "bworld:fence_side",
"y": 90,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "south=1",
"model": "bworld:fence_side",
"y": 180,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "west=1",
"model": "bworld:fence_side",
"y": 270,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
}
],
"mining": {
"toughness": 3,
"tool": "axe"
},
"drops": "bworld:birch_fence",
"components": {
"bworld:fence": {
"connects_to": "#bworld:wooden_fences"
}
}
}
}
+99
View File
@@ -0,0 +1,99 @@
{
"format_version": 1,
"block": {
"id": "bworld:cherry_fence",
"name": "Cherry Fence",
"textures": {
"side": "bworld:cherry_fence_side",
"top": "bworld:cherry_fence_top"
},
"item_model": "bworld: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": "bworld:fence_post",
"shape": [
[6, 0, 6, 10, 16, 10]
],
"collision_shape": [
[6, 0, 6, 10, 24, 10]
]
},
{
"when": "north=1",
"model": "bworld:fence_side",
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "east=1",
"model": "bworld:fence_side",
"y": 90,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "south=1",
"model": "bworld:fence_side",
"y": 180,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "west=1",
"model": "bworld:fence_side",
"y": 270,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
}
],
"mining": {
"toughness": 3,
"tool": "axe"
},
"drops": "bworld:cherry_fence",
"components": {
"bworld:fence": {
"connects_to": "#bworld:wooden_fences"
}
}
}
}
+99
View File
@@ -0,0 +1,99 @@
{
"format_version": 1,
"block": {
"id": "bworld:dark_oak_fence",
"name": "Dark Oak Fence",
"textures": {
"side": "bworld:dark_oak_fence_side",
"top": "bworld:dark_oak_fence_top"
},
"item_model": "bworld: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": "bworld:fence_post",
"shape": [
[6, 0, 6, 10, 16, 10]
],
"collision_shape": [
[6, 0, 6, 10, 24, 10]
]
},
{
"when": "north=1",
"model": "bworld:fence_side",
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "east=1",
"model": "bworld:fence_side",
"y": 90,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "south=1",
"model": "bworld:fence_side",
"y": 180,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "west=1",
"model": "bworld:fence_side",
"y": 270,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
}
],
"mining": {
"toughness": 3,
"tool": "axe"
},
"drops": "bworld:dark_oak_fence",
"components": {
"bworld:fence": {
"connects_to": "#bworld:wooden_fences"
}
}
}
}
+99
View File
@@ -0,0 +1,99 @@
{
"format_version": 1,
"block": {
"id": "bworld:jungle_fence",
"name": "Jungle Fence",
"textures": {
"side": "bworld:jungle_fence_side",
"top": "bworld:jungle_fence_top"
},
"item_model": "bworld: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": "bworld:fence_post",
"shape": [
[6, 0, 6, 10, 16, 10]
],
"collision_shape": [
[6, 0, 6, 10, 24, 10]
]
},
{
"when": "north=1",
"model": "bworld:fence_side",
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "east=1",
"model": "bworld:fence_side",
"y": 90,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "south=1",
"model": "bworld:fence_side",
"y": 180,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "west=1",
"model": "bworld:fence_side",
"y": 270,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
}
],
"mining": {
"toughness": 3,
"tool": "axe"
},
"drops": "bworld:jungle_fence",
"components": {
"bworld:fence": {
"connects_to": "#bworld:wooden_fences"
}
}
}
}
+99
View File
@@ -0,0 +1,99 @@
{
"format_version": 1,
"block": {
"id": "bworld:oak_fence",
"name": "Oak Fence",
"textures": {
"side": "bworld:oak_fence_side",
"top": "bworld:oak_fence_top"
},
"item_model": "bworld: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": "bworld:fence_post",
"shape": [
[6, 0, 6, 10, 16, 10]
],
"collision_shape": [
[6, 0, 6, 10, 24, 10]
]
},
{
"when": "north=1",
"model": "bworld:fence_side",
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "east=1",
"model": "bworld:fence_side",
"y": 90,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "south=1",
"model": "bworld:fence_side",
"y": 180,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "west=1",
"model": "bworld:fence_side",
"y": 270,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
}
],
"mining": {
"toughness": 3,
"tool": "axe"
},
"drops": "bworld:oak_fence",
"components": {
"bworld:fence": {
"connects_to": "#bworld:wooden_fences"
}
}
}
}
+99
View File
@@ -0,0 +1,99 @@
{
"format_version": 1,
"block": {
"id": "bworld:spruce_fence",
"name": "Spruce Fence",
"textures": {
"side": "bworld:spruce_fence_side",
"top": "bworld:spruce_fence_top"
},
"item_model": "bworld: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": "bworld:fence_post",
"shape": [
[6, 0, 6, 10, 16, 10]
],
"collision_shape": [
[6, 0, 6, 10, 24, 10]
]
},
{
"when": "north=1",
"model": "bworld:fence_side",
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "east=1",
"model": "bworld:fence_side",
"y": 90,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "south=1",
"model": "bworld:fence_side",
"y": 180,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
},
{
"when": "west=1",
"model": "bworld:fence_side",
"y": 270,
"shape": [
[7, 0, 0, 9, 16, 9]
],
"collision_shape": [
[7, 0, 0, 9, 24, 9]
]
}
],
"mining": {
"toughness": 3,
"tool": "axe"
},
"drops": "bworld:spruce_fence",
"components": {
"bworld:fence": {
"connects_to": "#bworld:wooden_fences"
}
}
}
}
+128
View File
@@ -0,0 +1,128 @@
{
"format_version": 1,
"model": {
"id": "bworld: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]
}
}
}
]
}
}
+40
View File
@@ -0,0 +1,40 @@
{
"format_version": 1,
"model": {
"id": "bworld: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"
}
}
}
]
}
}
+62
View File
@@ -0,0 +1,62 @@
{
"format_version": 1,
"model": {
"id": "bworld: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,18 @@
{
"format_version": 1,
"recipe": {
"type": "shaped",
"pattern": [
"PSP",
"PSP"
],
"key": {
"P": "bworld:acacia_planks",
"S": "bworld:stick"
},
"result": {
"id": "bworld:acacia_fence",
"count": 3
}
}
}
@@ -0,0 +1,18 @@
{
"format_version": 1,
"recipe": {
"type": "shaped",
"pattern": [
"PSP",
"PSP"
],
"key": {
"P": "bworld:birch_planks",
"S": "bworld:stick"
},
"result": {
"id": "bworld:birch_fence",
"count": 3
}
}
}
@@ -0,0 +1,18 @@
{
"format_version": 1,
"recipe": {
"type": "shaped",
"pattern": [
"PSP",
"PSP"
],
"key": {
"P": "bworld:cherry_planks",
"S": "bworld:stick"
},
"result": {
"id": "bworld:cherry_fence",
"count": 3
}
}
}
@@ -0,0 +1,18 @@
{
"format_version": 1,
"recipe": {
"type": "shaped",
"pattern": [
"PSP",
"PSP"
],
"key": {
"P": "bworld:dark_oak_planks",
"S": "bworld:stick"
},
"result": {
"id": "bworld:dark_oak_fence",
"count": 3
}
}
}
@@ -0,0 +1,18 @@
{
"format_version": 1,
"recipe": {
"type": "shaped",
"pattern": [
"PSP",
"PSP"
],
"key": {
"P": "bworld:jungle_planks",
"S": "bworld:stick"
},
"result": {
"id": "bworld:jungle_fence",
"count": 3
}
}
}
@@ -0,0 +1,18 @@
{
"format_version": 1,
"recipe": {
"type": "shaped",
"pattern": [
"PSP",
"PSP"
],
"key": {
"P": "bworld:planks",
"S": "bworld:stick"
},
"result": {
"id": "bworld:oak_fence",
"count": 3
}
}
}
@@ -0,0 +1,18 @@
{
"format_version": 1,
"recipe": {
"type": "shaped",
"pattern": [
"PSP",
"PSP"
],
"key": {
"P": "bworld:spruce_planks",
"S": "bworld:stick"
},
"result": {
"id": "bworld:spruce_fence",
"count": 3
}
}
}
+30
View File
@@ -8,6 +8,7 @@ export function setup(ctx: ServerContext) {
register_storage(ctx);
register_furnace(ctx);
register_smithing_table(ctx);
register_fence(ctx);
register_farming(ctx);
register_fishing(ctx);
register_curios(ctx);
@@ -28,6 +29,35 @@ function register_hoeable(ctx: ServerContext) {
});
}
// the sides a fence connects on, and the face of the block there it connects to
const FENCE_SIDES = [
{ state: "north", dx: 0, dz: -1, face: "south" },
{ state: "east", dx: 1, dz: 0, face: "west" },
{ state: "south", dx: 0, dz: 1, face: "north" },
{ state: "west", dx: -1, dz: 0, face: "east" },
] as const;
// a fence joins the fences beside it and the full sides of solid blocks, like minecraft's FenceBlock.connectsTo.
// "connects_to" is the tag of fences it joins, so wooden fences don't join other kinds. leaves are full blocks but
// fences don't join them, like minecraft
function register_fence(ctx: ServerContext) {
const connect = (block: BlockRef, params: { connects_to: string }) => {
for (const side of FENCE_SIDES) {
const [x, y, z] = [block.x + side.dx, block.y, block.z + side.dz];
const id = ctx.world.get_block(x, y, z);
const joins = id !== undefined && (
ctx.tags.has("blocks", params.connects_to, id) ||
(!ctx.tags.has("blocks", "bworld:leaves", id) && ctx.world.is_face_sturdy(x, y, z, side.face))
);
ctx.world.set_state(block.x, block.y, block.z, side.state, joins ? 1 : 0);
}
};
ctx.components.register_block<{ connects_to: string }>("bworld:fence", {
on_create: connect,
on_neighbor_change: connect,
});
}
// the container a block keeps its items in, made the first time it's needed. blocks placed before tile data
// existed don't have one yet
function block_container(ctx: ServerContext, block: BlockRef, size: number): Container {
@@ -0,0 +1,14 @@
{
"format_version": 1,
"tag": {
"values": [
"bworld:oak_fence",
"bworld:spruce_fence",
"bworld:birch_fence",
"bworld:jungle_fence",
"bworld:acacia_fence",
"bworld:dark_oak_fence",
"bworld:cherry_fence"
]
}
}
@@ -0,0 +1,14 @@
{
"format_version": 1,
"tag": {
"values": [
"bworld:oak_fence",
"bworld:spruce_fence",
"bworld:birch_fence",
"bworld:jungle_fence",
"bworld:acacia_fence",
"bworld:dark_oak_fence",
"bworld:cherry_fence"
]
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B