Waterlogging
This commit is contained in:
+13
-7
@@ -4,7 +4,7 @@ import type { Client } from "./client.ts";
|
||||
import type { BlockHitResult } from "./level/client_level.ts";
|
||||
import type { Container } from "$/common/inventory.ts";
|
||||
import { AIR_ID } from "$/common/protocol.ts";
|
||||
import { box_overlaps_block, can_place, placement_target } from "$/common/utils.ts";
|
||||
import { box_overlaps_block, can_place, placement_target, waterlog_placement } from "$/common/utils.ts";
|
||||
import { block_rules, predict_neighbors } from "./mods.ts";
|
||||
import { collision_shape_at } from "$/common/block_shapes.ts";
|
||||
import type { EntityJson } from "$/common/mod_data.ts";
|
||||
@@ -81,16 +81,22 @@ export class MultiPlayerGameMode {
|
||||
const place_block = place_id !== undefined
|
||||
? EverythingRegistry.get<BlockRegistry>("blocks", place_id)
|
||||
: undefined;
|
||||
// with the states the server will give it, see BlockRules.placement_value
|
||||
// with the states the server will give it, see BlockRules.placement_value, and holding the liquid it goes into
|
||||
const value = place_block &&
|
||||
block_rules.placement_value(place_block, this.client.player.yaw, {
|
||||
...target,
|
||||
face: hit.face,
|
||||
hit: hit.hit,
|
||||
});
|
||||
waterlog_placement(
|
||||
block_rules.placement_value(place_block, this.client.player.yaw, {
|
||||
...target,
|
||||
face: hit.face,
|
||||
hit: hit.hit,
|
||||
}),
|
||||
place_block,
|
||||
level.get_block_value(target.x, target.y, target.z),
|
||||
EverythingRegistry.get_by_id<BlockRegistry>("blocks", current),
|
||||
);
|
||||
const placeable = place_id !== undefined && can_place(
|
||||
place_block,
|
||||
current === AIR ? undefined : EverythingRegistry.get_by_id<BlockRegistry>("blocks", current),
|
||||
level.get_block_value(target.x, target.y, target.z),
|
||||
below_id,
|
||||
) && !(place_block?.has_collision && this.#occupied(target.x, target.y, target.z, place_block, value!));
|
||||
if (!block_info.interactive && place_id && placeable) {
|
||||
|
||||
Reference in New Issue
Block a user