def _trigger_crafting(self, craft_type): """Activates the crafting window for a grid of size""" print(f"Crafting with {craft_type}") # self._crafting_window.protocol("WM_DELETE_WINDOW", self._exit) if craft_type == "basic": if self._crafting_open: self._crafting_window.destroy() self._crafting_open = False else: self.crafter = GridCrafter(CRAFTING_RECIPES_2x2) self._crafting_window = CraftingWindow(root, "Inventory & Crafting", self._hot_bar, self._inventory, self.crafter) self._crafting_window.bind( "e", lambda e: self.run_effect(('crafting', 'basic'))) self._crafting_open = True else: if self._crafting_open: print("open") self._crafting_window.destroy() self._crafting_open = False else: self.crafter == GridCrafter(CRAFTING_RECIPES_3x3, rows=3, columns=3) self._crafting_window = CraftingWindow( root, "Crafting Table", self._hot_bar, self._inventory, GridCrafter(CRAFTING_RECIPES_3x3, rows=3, columns=3)) self._crafting_window.bind( "e", lambda e: self.run_effect(('crafting', 'basic'))) self._crafting_open = True
def _trigger_crafting(self, craft_type): print(f"Crafting with {craft_type}") CRAFTING_RECIPES_2x2 = [ (((None, 'wood'), (None, 'wood')), Stack(create_item('stick'), 4)), ((('wood', 'wood'), ('wood', 'wood')), Stack(create_item('crafting_table'), 1)), ((('dirt', 'dirt'), ('dirt', 'dirt')), Stack(create_item('wood'), 1)), ((('stone', 'stone'), ('stone', 'stone')), Stack(create_item('diamond'), 1)), ((('apple', 'apple'), ('apple', 'apple')), Stack(create_item('honey'), 1)), ] CRAFTING_RECIPES_3x3 = { (((None, None, None), (None, 'wood', None), (None, 'wood', None)), Stack(create_item('stick'), 16)), ((('wood', 'wood', 'wood'), (None, 'stick', None), (None, 'stick', None)), Stack(create_item('pickaxe', 'wood'), 1)), ((('stone', 'stone', 'stone'), (None, 'stick', None), (None, 'stick', None)), Stack(create_item('pickaxe', 'stone'), 1)), ((('diamond', 'diamond', 'diamond'), (None, 'stick', None), (None, 'stick', None)), Stack(create_item('pickaxe', 'diamond'), 1)), ((('wood', 'wood', None), ('wood', 'stick', None), (None, 'stick', None)), Stack(create_item('axe', 'wood'), 1)), ((('stone', 'stone', None), ('wood', 'stick', None), (None, 'stick', None)), Stack(create_item('axe', 'stone'), 1)), (((None, 'wood', None), (None, 'stick', None), (None, 'stick', None)), Stack(create_item('shovel', 'wood'), 1)), (((None, 'stone', None), (None, 'stick', None), (None, 'stick', None)), Stack(create_item('shovel', 'stone'), 1)), (((None, 'wood', None), (None, 'wood', None), (None, 'stick', None)), Stack(create_item('sword', 'wood'), 1)), (((None, 'stone', None), (None, 'stone', None), (None, 'stick', None)), Stack(create_item('sword', 'stone'), 1)), (((None, None, None), ('wool', 'wool', 'wool'), ('wood', 'wood', 'wood')), Stack(create_item('bed'), 1)), ((('stone', 'stone', 'stone'), ('stone', None, 'stone'), ('stone', 'stone', 'stone')), Stack(create_item('furnace'), 1)) } if craft_type == "basic": crafter = GridCrafter(CRAFTING_RECIPES_2x2, 2, 2) else: crafter = GridCrafter(CRAFTING_RECIPES_3x3, 3, 3) self._crafting_window = CraftingWindow(self._master, craft_type, hot_bar=self._hot_bar, inventory=self._inventory, crafter=crafter)
def _trigger_crafting(self, craft_type): print(f"Crafting with {craft_type}") if craft_type == "crafting_table": crafter = GridCrafter(CRAFTING_RECIPES_3x3, rows=3, columns=3) elif craft_type == "furnace": crafter = GridCrafter(FURNACE_RECIPES_2x1, rows=2, columns=1) else: crafter = GridCrafter(CRAFTING_RECIPES_2x2) self._craft_window = CraftingWindow(self._master, "Crafting", self._hot_bar, self._inventory, crafter) self._craft_window.bind('e', lambda e: self._craft_window.destroy())
def _trigger_crafting(self, craft_type): print(f"Crafting with {craft_type}") if craft_type in ("basic", "crafting_table", "furnace"): if craft_type == "basic": crafter = GridCrafter(CRAFTING_RECIPES_2x2) elif craft_type == "crafting_table": crafter = GridCrafter(CRAFTING_RECIPES_3x3, rows=3, columns=3) elif craft_type == "furnace": crafter = GridCrafter(SMELTING_RECIPES_1x2, rows=1, columns=2) self._crafting_window = CraftingWindow( self._master, "Smelt", self._hot_bar, self._inventory, crafter, mode="smelting" if craft_type == "furnace" else "normal")
def _trigger_crafting(self, craft_type): print(f"Crafting with {craft_type}") # Initialise the crafting window if craft_type == "basic": crafter = GridCrafter(CRAFTING_RECIPES_2x2) self.crafter_window = CraftingWindow(self._master, "Basic Crafter", self._hot_bar, self._inventory,crafter) # close the crafting window by pressing "e" self.crafter_window.bind("e", lambda e: self.crafter_window.destroy()) # Initialise the crafting table elif craft_type == "crafting_table": crafter = GridCrafter(CRAFTING_RECIPES_3x3,rows=3,columns=3) self.crafter_window = CraftingWindow(self._master,"Advanced Crafter", self._hot_bar, self._inventory, crafter) # close the crafting window by pressing "e" self.crafter_window.bind("e", lambda e: self.crafter_window.destroy())
def _trigger_crafting(self, craft_type): CRAFTING_RECIPES_2x2 = [ (((None, 'wood'), (None, 'wood')), Stack(create_item("stick"), 4)), (((None, 'dirt'), (None, 'wood')), Stack(create_item("stone"), 4)), (((None, 'dirt'), (None, 'dirt')), Stack(create_item("wood"), 4)), ((("wood", 'dirt'), ("wood", 'dirt')), Stack(create_item("apple"), 4)) ] print(f"Crafting with {craft_type}") crafter = GridCrafter(CRAFTING_RECIPES_2x2) show_crafter = CraftingWindow(self._master, "crafting", self._hot_bar, self._inventory, crafter)
def _trigger_crafting(self, craft_type): print(f"Crafting with {craft_type}") crafter = GridCrafter(CRAFTING_RECIPES_2x2) craft_window = CraftingWindow(self._master, 'CraftingWindow', self._hot_bar, self._inventory, crafter)