Juicer recipes
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
// every item, right of the inventory and of the recipes screen, like jei's ingredient list overlay: the page and its
|
||||
// arrows on top, the items, and the search box under them
|
||||
import type { ClientContext, Color, Graphics } from "bworld/client";
|
||||
import type { ClientContext, Color, FluidVariant, Graphics } from "bworld/client";
|
||||
import { SLOT } from "./categories.ts";
|
||||
|
||||
const GAP = 5;
|
||||
@@ -13,6 +13,8 @@ export const SLOT_COLOR: Color = [0.07, 0.07, 0.11, 0.6];
|
||||
const HOVER_COLOR: Color = [0.96, 0.76, 0.91, 0.35];
|
||||
export const LABEL_COLOR: Color = [0.65, 0.68, 0.78, 1];
|
||||
const MOD_COLOR: Color = [0.54, 0.71, 0.98, 1];
|
||||
// the engine's for the fluid in an item's tooltip
|
||||
const FLUID_COLOR: Color = [0.55, 0.75, 0.95, 1];
|
||||
|
||||
// show the recipes that make an item, or the ones that use it
|
||||
export type Mode = "recipes" | "uses";
|
||||
@@ -48,6 +50,33 @@ export function item_cell(
|
||||
return true;
|
||||
}
|
||||
|
||||
// an amount of a fluid in a slot, hovered for its name and amount. fluids have no recipes of their own to open
|
||||
export function fluid_cell(
|
||||
g: Graphics,
|
||||
ctx: ClientContext,
|
||||
fluid: FluidVariant,
|
||||
amount: number,
|
||||
x: number,
|
||||
y: number,
|
||||
tooltip: string[] = [],
|
||||
) {
|
||||
g.rect(x, y, SLOT, SLOT, SLOT_COLOR);
|
||||
g.fluid(fluid, x, y);
|
||||
const { mouse } = g;
|
||||
if (mouse.x < x || mouse.y < y || mouse.x >= x + SLOT || mouse.y >= y + SLOT) return;
|
||||
g.rect(x, y, SLOT, SLOT, HOVER_COLOR);
|
||||
g.tooltip(
|
||||
[
|
||||
ctx.fluids.name(fluid),
|
||||
{ text: `${amount} mB`, color: FLUID_COLOR },
|
||||
...tooltip.map((text) => ({ text, color: LABEL_COLOR })),
|
||||
{ text: fluid.id, color: LABEL_COLOR },
|
||||
],
|
||||
mouse.x,
|
||||
mouse.y,
|
||||
);
|
||||
}
|
||||
|
||||
export class ItemList {
|
||||
// kept between screens, like jei
|
||||
page = 0;
|
||||
|
||||
Reference in New Issue
Block a user