0
0
mirror of https://github.com/Pumpkin-MC/Pumpkin synced 2025-04-12 22:13:03 +00:00

Extractor: Parse and use screens.json

This commit is contained in:
Snowiiii
2024-11-03 11:25:15 +01:00
parent 9e7adec16b
commit 8f90b29cfe
16 changed files with 288 additions and 153 deletions
assets
extractor/src/main/kotlin/de/snowii/extractor
pumpkin-inventory
pumpkin-macros/src
pumpkin/src

@ -1,6 +1,7 @@
use crate::container_click::MouseClick;
use crate::player::PlayerInventory;
use num_derive::{FromPrimitive, ToPrimitive};
use pumpkin_macros::screen;
use pumpkin_world::item::ItemStack;
pub mod container_click;
@ -15,42 +16,43 @@ pub use open_container::OpenContainer;
/// https://wiki.vg/Inventory
#[derive(Debug, ToPrimitive, FromPrimitive, Clone, Copy, Eq, PartialEq)]
#[repr(u16)]
pub enum WindowType {
// not used
Generic9x1,
Generic9x1 = screen!("minecraft:generic_9x1"),
// not used
Generic9x2,
Generic9x2 = screen!("minecraft:generic_9x2"),
// General-purpose 3-row inventory. Used by Chest, minecart with chest, ender chest, and barrel
Generic9x3,
Generic9x3 = screen!("minecraft:generic_9x3"),
// not used
Generic9x4,
Generic9x4 = screen!("minecraft:generic_9x4"),
// not used
Generic9x5,
Generic9x5 = screen!("minecraft:generic_9x5"),
// Used by large chests
Generic9x6,
Generic9x6 = screen!("minecraft:generic_9x6"),
// General-purpose 3-by-3 square inventory, used by Dispenser and Dropper
Generic3x3,
Generic3x3 = screen!("minecraft:generic_3x3"),
// General-purpose 3-by-3 square inventory, used by the Crafter
Craft3x3,
Anvil,
Beacon,
BlastFurnace,
BrewingStand,
CraftingTable,
EnchantmentTable,
Furnace,
Grindstone,
Craft3x3 = screen!("minecraft:crafter_3x3"),
Anvil = screen!("minecraft:anvil"),
Beacon = screen!("minecraft:beacon"),
BlastFurnace = screen!("minecraft:blast_furnace"),
BrewingStand = screen!("minecraft:brewing_stand"),
CraftingTable = screen!("minecraft:crafting"),
EnchantmentTable = screen!("minecraft:enchantment"),
Furnace = screen!("minecraft:furnace"),
Grindstone = screen!("minecraft:grindstone"),
// Hopper or minecart with hopper
Hopper,
Lectern,
Loom,
Hopper = screen!("minecraft:hopper"),
Lectern = screen!("minecraft:lectern"),
Loom = screen!("minecraft:loom"),
// Villager, Wandering Trader
Merchant,
ShulkerBox,
SmithingTable,
Smoker,
CartographyTable,
Stonecutter,
Merchant = screen!("minecraft:merchant"),
ShulkerBox = screen!("minecraft:shulker_box"),
SmithingTable = screen!("minecraft:smithing"),
Smoker = screen!("minecraft:smoker"),
CartographyTable = screen!("minecraft:cartography_table"),
Stonecutter = screen!("minecraft:stonecutter"),
}
pub struct ContainerStruct<const SLOTS: usize>([Option<ItemStack>; SLOTS]);