Actually implement mod code into server
This commit is contained in:
+8
-4
@@ -49,7 +49,7 @@ export class ContainerSlot {
|
||||
#item_stack: ItemStack | undefined;
|
||||
|
||||
has_item() {
|
||||
return this.#item_stack !== undefined;
|
||||
return this.get_item() !== undefined;
|
||||
}
|
||||
|
||||
set_item(item_stack: ItemStack | undefined) {
|
||||
@@ -60,11 +60,15 @@ export class ContainerSlot {
|
||||
}
|
||||
|
||||
get_item() {
|
||||
// scripts can count a stack down to nothing, it's gone then
|
||||
if (this.#item_stack && this.#item_stack.amount <= 0) {
|
||||
this.#item_stack = undefined;
|
||||
}
|
||||
return this.#item_stack;
|
||||
}
|
||||
|
||||
get type_id() {
|
||||
return this.#item_stack?.type_id;
|
||||
return this.get_item()?.type_id;
|
||||
}
|
||||
|
||||
set amount(new_amount: number) {
|
||||
@@ -77,11 +81,11 @@ export class ContainerSlot {
|
||||
}
|
||||
|
||||
get amount(): number | undefined {
|
||||
return this.#item_stack?.amount;
|
||||
return this.get_item()?.amount;
|
||||
}
|
||||
|
||||
get max_amount() {
|
||||
return this.#item_stack?.max_amount;
|
||||
return this.get_item()?.max_amount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user