Waterlogging
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
},
|
||||
"item_model": "bworld:fence_inventory",
|
||||
"render_layer": "cutout",
|
||||
"waterloggable": "bworld:water",
|
||||
"states": [
|
||||
{
|
||||
"name": "north",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
},
|
||||
"item_model": "bworld:fence_inventory",
|
||||
"render_layer": "cutout",
|
||||
"waterloggable": "bworld:water",
|
||||
"states": [
|
||||
{
|
||||
"name": "north",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
},
|
||||
"item_model": "bworld:fence_inventory",
|
||||
"render_layer": "cutout",
|
||||
"waterloggable": "bworld:water",
|
||||
"states": [
|
||||
{
|
||||
"name": "north",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
},
|
||||
"item_model": "bworld:fence_inventory",
|
||||
"render_layer": "cutout",
|
||||
"waterloggable": "bworld:water",
|
||||
"states": [
|
||||
{
|
||||
"name": "north",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
},
|
||||
"item_model": "bworld:fence_inventory",
|
||||
"render_layer": "cutout",
|
||||
"waterloggable": "bworld:water",
|
||||
"states": [
|
||||
{
|
||||
"name": "north",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
},
|
||||
"item_model": "bworld:fence_inventory",
|
||||
"render_layer": "cutout",
|
||||
"waterloggable": "bworld:water",
|
||||
"states": [
|
||||
{
|
||||
"name": "north",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
},
|
||||
"item_model": "bworld:fence_inventory",
|
||||
"render_layer": "cutout",
|
||||
"waterloggable": "bworld:water",
|
||||
"states": [
|
||||
{
|
||||
"name": "north",
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
}
|
||||
},
|
||||
"render_layer": "cutout",
|
||||
"waterloggable": "bworld:water",
|
||||
"waterlogged_only": true,
|
||||
"collision": false,
|
||||
"mining": {
|
||||
"toughness": 0
|
||||
|
||||
Reference in New Issue
Block a user