Waterlogging

This commit is contained in:
2026-10-07 20:56:24 -03:00
parent 78117f65c9
commit 757ee74bc7
26 changed files with 459 additions and 73 deletions
+1
View File
@@ -9,6 +9,7 @@
},
"item_model": "bworld:fence_inventory",
"render_layer": "cutout",
"waterloggable": "bworld:water",
"states": [
{
"name": "north",
+1
View File
@@ -9,6 +9,7 @@
},
"item_model": "bworld:fence_inventory",
"render_layer": "cutout",
"waterloggable": "bworld:water",
"states": [
{
"name": "north",
+1
View File
@@ -9,6 +9,7 @@
},
"item_model": "bworld:fence_inventory",
"render_layer": "cutout",
"waterloggable": "bworld:water",
"states": [
{
"name": "north",
+1
View File
@@ -9,6 +9,7 @@
},
"item_model": "bworld:fence_inventory",
"render_layer": "cutout",
"waterloggable": "bworld:water",
"states": [
{
"name": "north",
+1
View File
@@ -9,6 +9,7 @@
},
"item_model": "bworld:fence_inventory",
"render_layer": "cutout",
"waterloggable": "bworld:water",
"states": [
{
"name": "north",
+1
View File
@@ -9,6 +9,7 @@
},
"item_model": "bworld:fence_inventory",
"render_layer": "cutout",
"waterloggable": "bworld:water",
"states": [
{
"name": "north",
+1
View File
@@ -9,6 +9,7 @@
},
"item_model": "bworld:fence_inventory",
"render_layer": "cutout",
"waterloggable": "bworld:water",
"states": [
{
"name": "north",
+9 -3
View File
@@ -595,9 +595,15 @@ function register_buckets(ctx: ServerContext) {
on_interact(block, params, player) {
const bucket = player.held_item;
if (bucket?.id !== BUCKET) return false;
// only a liquid's source fills it, not where it's flowing
if ((ctx.world.get_state(block.x, block.y, block.z, "level") ?? 0) !== 0) return false;
ctx.world.set_block(block.x, block.y, block.z, "bworld:air");
const { x, y, z } = block;
if (ctx.world.get_block(x, y, z) === block.id) {
// only a liquid's source fills it, not where it's flowing
if ((ctx.world.get_state(x, y, z, "level") ?? 0) !== 0) return false;
ctx.world.set_block(x, y, z, "bworld:air");
} else {
// the liquid in a waterlogged block, like a fence in water, which stays
ctx.world.set_state(x, y, z, "waterlogged", 0);
}
bucket.count -= 1;
// the last one becomes the filled bucket in the hand, from a stack it goes in the inventory
if (bucket.count <= 0) player.inventory.set(player.selected_slot, { id: params.into, count: 1 });
+2
View File
@@ -34,6 +34,8 @@
}
},
"render_layer": "cutout",
"waterloggable": "bworld:water",
"waterlogged_only": true,
"collision": false,
"mining": {
"toughness": 0