Change whole gui system
This commit is contained in:
+4
-3
@@ -3,7 +3,7 @@ import { AIR, FACE_OFFSETS, TICK_DELTA } from "$/common/constants.ts";
|
||||
import type { Client } from "./client.ts";
|
||||
import type { BlockHitResult } from "./level/client_level.ts";
|
||||
import type { Container } from "$/common/inventory.ts";
|
||||
import { AIR_ID, type ContainerKey } from "$/common/protocol.ts";
|
||||
import { AIR_ID } from "$/common/protocol.ts";
|
||||
import { box_overlaps_block, can_place, placement_target } from "$/common/utils.ts";
|
||||
import type { EntityJson } from "$/common/mod_data.ts";
|
||||
import { RemoteEntity } from "./entity/remote_entity.ts";
|
||||
@@ -86,12 +86,13 @@ export class MultiPlayerGameMode {
|
||||
}
|
||||
|
||||
// q on a slot: throws one, or the whole stack. the server spawns the item, this only takes it out right away
|
||||
drop_item(container: Container, key: ContainerKey, index: number, all: boolean) {
|
||||
// q on a menu's slot, whose item is in container at index on this client
|
||||
drop_item(container: Container, index: number, menu: number, slot: number, all: boolean) {
|
||||
const item = container.get_item(index);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
this.client.connection.send({ type: "drop_item", container: key, index, all });
|
||||
this.client.connection.send({ type: "drop_item", menu, slot, all });
|
||||
item.amount = all ? 0 : item.amount - 1;
|
||||
container.set_item(index, item.amount > 0 ? item : undefined);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user