class BlockType: NONE = 0 STONE = 1 WOOD = 2 GRASS = 3 class Block: def __init__(self, id: int, durability: int = 0, type: int = BlockType.NONE): self.id: int = id self.durability: int = durability self.type: int = type class BlockAir(Block): def __init__(self): super().__init__(0) class BlockStone(Block): def __init__(self): super().__init__(1, 20, BlockType.STONE) class BlockDirt(Block): def __init__(self): super().__init__(2, 10, BlockType.GRASS) class BlockGrass(Block): def __init__(self): super().__init__(3, 10, BlockType.GRASS) class BlockCoal(Block): def __init__(self): super().__init__(4, 25, BlockType.STONE) class BlockIron(Block): def __init__(self): super().__init__(5, 30, BlockType.STONE) class BlockGold(Block): def __init__(self): super().__init__(6, 35, BlockType.STONE) class BlockDiamond(Block): def __init__(self): super().__init__(7, 40, BlockType.STONE) class BlockLog(Block): def __init__(self): super().__init__(8, 10, BlockType.WOOD) class BlockLeaf(Block): def __init__(self): super().__init__(9, 10, BlockType.NONE) BLOCKS_ID = [ lambda: BlockAir(), lambda: BlockStone(), lambda: BlockDirt(), lambda: BlockGrass(), lambda: BlockCoal(), lambda: BlockIron(), lambda: BlockGold(), lambda: BlockDiamond(), lambda: BlockLog(), lambda: BlockLeaf(), ] def with_id(id): return BLOCKS_ID[id]()