Fluid containers

This commit is contained in:
2026-10-25 15:02:31 -03:00
parent fc27771a92
commit 26b59a1899
24 changed files with 486 additions and 82 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
// SPDX-License-Identifier: AGPL-3.0-or-later
import { type ItemData, ItemStack } from "$/common/inventory.ts";
import { type ItemData, ItemStack, same_stack } from "$/common/inventory.ts";
import type { EntityInfo } from "$/common/protocol.ts";
import { TICK_DELTA } from "$/common/constants.ts";
import { physics } from "$/common/physics.ts";
@@ -126,7 +126,7 @@ export class ItemEntity extends Entity {
can_merge_with(other: ItemEntity) {
return other !== this && !other.removed && other.item.type_id === this.item.type_id &&
this.item.amount < this.item.max_amount && other.item.amount < other.item.max_amount &&
(other.item.data === this.item.data || JSON.stringify(other.item.data) === JSON.stringify(this.item.data));
same_stack(other.item, this.item);
}
// the smaller stack goes into the bigger one, like minecraft's ItemEntity.tryToMerge