Allow for textures that aren't 16x16

This commit is contained in:
2026-09-28 16:20:37 -03:00
parent 52ef4e5ca6
commit fe149bb9ad
18 changed files with 268 additions and 136 deletions
+5 -5
View File
@@ -1,6 +1,6 @@
// the immediate mode drawing mods' client scripts get (Graphics in common/mod_api/client.ts), on top of the renderer.
// one per screen, so text inputs keep their text and focus while it's open
import { SLOT_SIZE, TEXTURE_SIZE } from "$/common/constants.ts";
import { SLOT_SIZE } from "$/common/constants.ts";
import { EverythingRegistry, type ItemRegistry } from "$/common/everything_registry.ts";
import { ItemStack } from "$/common/inventory.ts";
import type { Color, Graphics } from "$/common/mod_api/client.ts";
@@ -102,10 +102,10 @@ export class ModGraphics implements Graphics {
const region = get_sprite_region(id);
draw_texture_region(
atlas,
region.x * TEXTURE_SIZE,
region.y * TEXTURE_SIZE,
TEXTURE_SIZE,
TEXTURE_SIZE,
region.x,
region.y,
region.width,
region.height,
x,
y,
w,