Worm bin working with both worms and grubs
This commit is contained in:
+5
-2
@@ -35,6 +35,8 @@ export interface MenuSlot {
|
||||
on_take?: (item: ItemStack) => boolean;
|
||||
// drawn in the slot while it's empty
|
||||
icon?: string;
|
||||
// the most it holds of anything, when that's less than a stack, like minecraft's Slot.getMaxStackSize
|
||||
max_count?: number;
|
||||
// one of the player's own inventory slots, this one
|
||||
inventory?: number;
|
||||
}
|
||||
@@ -79,7 +81,7 @@ export class Menu {
|
||||
// the slot doesn't take what the cursor holds
|
||||
return;
|
||||
} else {
|
||||
click_slot(slot.container, slot.index, cursor, button);
|
||||
click_slot(slot.container, slot.index, cursor, button, slot.max_count);
|
||||
}
|
||||
this.on_changed?.();
|
||||
}
|
||||
@@ -138,11 +140,12 @@ export class Menu {
|
||||
}
|
||||
|
||||
slot_info(): MenuSlotInfo[] {
|
||||
return this.slots.map(({ x, y, output, icon }) => ({
|
||||
return this.slots.map(({ x, y, output, icon, max_count }) => ({
|
||||
x,
|
||||
y,
|
||||
...(output ? { output: true } : {}),
|
||||
...(icon ? { icon } : {}),
|
||||
...(max_count !== undefined ? { max_count } : {}),
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user