コード例 #1
0
ファイル: gui.py プロジェクト: boskee/Minecraft
    def __init__(self, parent, x, y, width, height,
                 sb_width, sb_height,
                 style=0, 
                 background_image=None,
                 scrollbar_image=None, 
                 caption=None, font_size=12, font_name=G.DEFAULT_FONT,
                 batch=None, group=None, label_group=None,
                 pos=0, on_pos_change=None,
                 *args, **kwargs):
        super(ScrollbarWidget, self).__init__(parent, *args, **kwargs)
        parent.push_handlers(self)
        self.batch = pyglet.graphics.Batch() if not batch else batch
        self.group = group
        self.label_group = label_group
        self.x, self.y, self.width, self.height = x, y, width, height
        self.sb_width, self.sb_height = sb_width, sb_height

        self.style = style
        if self.style == 0:
            self.sb_width = self.width
        else:
            self.sb_height = self.height

        self.background = image_sprite(background_image, self.batch, self.group)
        self.background.scale = max(float(self.width) / float(background_image.width), float(self.height) / float(background_image.height))
        self.scrollbar = image_sprite(scrollbar_image, self.batch, self.group)
        self.scrollbar.scale = max(float(self.sb_width) / float(scrollbar_image.width), float(self.sb_height) / float(scrollbar_image.height))

        self.pos = pos
        self.on_pos_change = on_pos_change
        self.caption = caption
        self.label = Label(str(caption) + ":" + str(pos) + "%", font_name, 12, anchor_x='center', anchor_y='center',
            color=(255, 255, 255, 255), batch=self.batch, group=self.label_group) if caption else None
        
        self.move_to(x, y)
コード例 #2
0
ファイル: gui.py プロジェクト: boskee/Minecraft
def init_button_image():
    gui_image = G.texture_pack_list.selected_texture_pack.load_texture(['gui', 'gui.png'])
    image_scale = gui_image.height // 256
    x_size = 200 * image_scale
    y_offset = 66 * image_scale
    y_size = 20 * image_scale
    batch = pyglet.graphics.Batch()
    button_disabled = image_sprite(gui_image, batch, 0, y=gui_image.height - y_offset, height=y_size, x=0, width=x_size)

    y_offset += y_size
    button = image_sprite(gui_image, batch, 0, y=gui_image.height - y_offset, height=y_size, x=0, width=x_size)

    y_offset += y_size
    highlighted_button = image_sprite(gui_image, batch, 0, y=gui_image.height - y_offset, height=y_size, x=0, width=x_size)
    
    button.scale = 1.0
    highlighted_button.scale = 1.0
    button_disabled.scale = 1.0
    button.scale = 1.0 / float(image_scale)
    highlighted_button.scale = 1.0 / float(image_scale)
    button_disabled.scale = 1.0 / float(image_scale)
    button = button.image
    highlighted_button = highlighted_button.image
    button_disabled = button_disabled.image
    return button, highlighted_button, button_disabled
コード例 #3
0
ファイル: views.py プロジェクト: ronmurphy/Minecraft
    def setup(self):
        self.group = pyglet.graphics.OrderedGroup(2)
        self.labels_group = pyglet.graphics.OrderedGroup(3)

        image = frame_image
        self.frame_rect = Rectangle(0, 0, image.width, image.height)
        self.background = image_sprite(backdrop, self.batch, 0)
        self.background.scale = max(float(self.controller.window.get_size()[0]) / self.background.width, float(self.controller.window.get_size()[1]) / self.background.height)
        self.frame = image_sprite(image, self.batch, 1)
コード例 #4
0
ファイル: gui.py プロジェクト: ronmurphy/Minecraft
 def update_items(self):
     self.player.quick_slots.remove_unnecessary_stacks()
     self.icons = []
     for amount_label in self.amount_labels:
         amount_label.delete()
     self.amount_labels = []
     x = self.frame.x + 3
     items = self.player.quick_slots.get_items()
     items = items[:self.max_items]
     for item in items:
         if not item:
             x += (self.icon_size * 0.5) + 3
             continue
         icon = image_sprite(get_block_icon(item.get_object(), self.icon_size, self.world), self.batch, self.group)
         icon.scale = 0.5
         icon.x = x
         icon.y = self.frame.y + 3
         item.quickslots_x = icon.x
         item.quickslots_y = icon.y
         x += (self.icon_size * 0.5) + 3
         if item.max_durability != -1 and item.durability != -1:
             icon.opacity = min(item.max_durability, item.durability + 1) * 255 / item.max_durability
         amount_label = pyglet.text.Label(
             str(item.amount), font_name=G.DEFAULT_FONT, font_size=9,
             x=icon.x + 3, y=icon.y, anchor_x='left', anchor_y='bottom',
             color=item.get_object().amount_label_color, batch=self.batch,
             group=self.labels_group)
         self.amount_labels.append(amount_label)
         self.icons.append(icon)
     self.update_current()
コード例 #5
0
ファイル: gui.py プロジェクト: boskee/Minecraft
    def item(self, value):
        self._item = value
        if self.amount_label:
            self.amount_label.delete()
        self.amount_label = None
        if not value:
            self.icon = None
            return
        img = get_block_icon(self._item.get_object(), self.width, self.world)
        self.icon = image_sprite(img, self.batch, self.group)
        image_scale = 1.0 / (img.width / self.width)
        self.icon.scale = image_scale
        self.icon.x = self.x
        self.icon.y = self.y
        if self.is_quickslot:
            self._item.quickslots_x = self.icon.x
            self._item.quickslots_y = self.icon.y
        if self._item.max_durability != -1 and self._item.durability != -1:
            self.icon.opacity = min(self._item.max_durability, self._item.durability + 1) * 255 // self._item.max_durability

        if self._item.amount > 1:
            self.amount_label = pyglet.text.Label(
                str(self._item.amount), font_name=G.DEFAULT_FONT, font_size=9,
                x=self.icon.x + 8, y=self.icon.y, anchor_x='left', anchor_y='bottom',
                color=self._item.get_object().amount_label_color, batch=self.batch,
                group=self.label_group)
コード例 #6
0
ファイル: gui.py プロジェクト: ronmurphy/Minecraft
    def set_crafting_outcome(self, item):
        if not item:
            self.remove_crafting_outcome()
            return
        self.crafting_outcome = item

        self.crafting_outcome_icon = image_sprite(get_block_icon(item.get_object(), self.icon_size, self.world), self.batch, self.group)
        inventory_rows = floor(self.max_items / 9)
        inventory_height = (inventory_rows * (self.icon_size * 0.5)) + (inventory_rows * 3)
        quick_slots_y = self.frame.y + 4
        inventory_y = quick_slots_y + (42 if self.mode == 0 else 14 if self.mode == 1 else 32)

        x, y = 0, 0
        if self.mode == 0:
            x, y = 270, 62
        elif self.mode == 1:
            x, y = 225, 80
        elif self.mode == 2:
            x, y = 222, 67

        self.crafting_outcome_icon.scale = 0.5
        self.crafting_outcome_icon.x = self.frame.x + x
        self.crafting_outcome_icon.y = inventory_y + inventory_height + y

        self.crafting_outcome_label = pyglet.text.Label(
            str(item.amount), font_name=G.DEFAULT_FONT, font_size=9,
            x= self.crafting_outcome_icon.x + 3, y= self.crafting_outcome_icon.y, anchor_x='left', anchor_y='bottom',
            color=item.get_object().amount_label_color,
            group=self.group)
コード例 #7
0
ファイル: gui.py プロジェクト: ronmurphy/Minecraft
    def set_selected_item(self, item):
        if not item:
            self.remove_selected_item()
            return
        self.selected_item = item

        self.selected_item_icon = image_sprite(get_block_icon(item.get_object(), self.icon_size, self.world), self.batch, self.group)
        self.selected_item_icon.scale = 0.4
コード例 #8
0
ファイル: gui.py プロジェクト: boskee/Minecraft
 def change_image(self):
     image = G.texture_pack_list.selected_texture_pack.load_texture(['gui', 'inventory.png' if self.mode == 0 else 'crafting.png' if self.mode == 1 else 'furnace.png'])
     image_scale = image.height // 256
     x_size = 176 * image_scale
     y_size = 166 * image_scale
     self.frame = image_sprite(image, self.batch[self.mode], 0, y=image.height - y_size, height=y_size, x=0, width=x_size)
     self.frame.scale = (1.0 / image_scale) * 2
     self.frame.x = (self.parent.window.width - self.frame.width) // 2
     self.frame.y = 74
コード例 #9
0
ファイル: gui.py プロジェクト: tfaris/Minecraft
 def __init__(self, parent, x, y, width, height, image=None, image_highlighted=None, caption=None, batch=None, group=None, label_group=None, font_name=G.DEFAULT_FONT):
     super(Button, self).__init__(x, y, width, height)
     parent.push_handlers(self)
     self.batch, self.group, self.label_group = batch, group, label_group
     self.sprite = image_sprite(image, self.batch, self.group)
     self.sprite_highlighted = hidden_image_sprite(image_highlighted, self.batch, self.group)
     self.highlighted = False
     self.label = Label(str(caption), font_name, 12, anchor_x='center', anchor_y='center',
         color=(255, 255, 255, 255), batch=self.batch, group=self.label_group) if caption else None
     self.position = x, y
コード例 #10
0
ファイル: gui.py プロジェクト: ronmurphy/Minecraft
 def change_image(self):
     if self.mode == 0:
         image = load_image('resources', 'textures', 'inventory.png')
     elif self.mode == 1:
         image = load_image('resources', 'textures', 'inventory_when_crafting_table.png')
     elif self.mode == 2:
         image = load_image('resources', 'textures', 'inventory_when_furnace.png')
     self.frame = image_sprite(image, self.batch, 0)
     self.frame.x = (self.parent.window.width - self.frame.width) / 2
     self.frame.y = self.icon_size / 2 - 4
コード例 #11
0
    def show_map(self):
        print("map called...")
        # taken from Nebual's biome_explorer, this is ment to be a full screen map that uses mini tiles to make a full 2d map.
        with open(os.path.join(G.game_dir, "world", "seed"), "rb") as f:
            SEED = f.read()
        b = BiomeGenerator(SEED)
        x, y, z = self.player.position
        curx = x
        cury = y
        xsize = 79
        ysize = 28
        pbatch = pyglet.graphics.Batch()
        pgroup = pyglet.graphics.OrderedGroup(1)
        DESERT, PLAINS, MOUNTAINS, SNOW, FOREST = range(5)
        letters = ["D", "P", "M", "S", "F"]

        #  temp background pic...
        image = load_image('resources', 'textures', 'main_menu_background.png')

        #map_frame = image_sprite(image, pbatch, 0, y=G.WINDOW_WIDTH, height=G.WINDOW_HEIGHT)
        #sprite = pyglet.sprite.Sprite(image)
        #sprite.image(image)
        #sprite.visible = True
        # map_frame.draw()
        # map_frame.visible = True
        for y in range(int(cury), int(cury + ysize)):
            for x in range(int(curx), int(curx + xsize)):
                #string += letters[b.get_biome_type(x,y)]
                tmap = letters[b.get_biome_type(x, y)]
                tile_map = load_image('resources', 'textures', tmap + '.png')
                tile_map.anchor_x = x * 8
                tile_map.anchor_Y = y * 8
                sprite = pyglet.sprite.Sprite(tile_map,
                                              x=x * 8,
                                              y=y * 8,
                                              batch=pbatch)
                game_map = image_sprite(tile_map, pbatch, pgroup, x * 8, y * 8,
                                        8, 8)
                game_map = pyglet.sprite.Sprite(image,
                                                x=G.WINDOW_WIDTH,
                                                y=G.WINDOW_HEIGHT,
                                                batch=pbatch,
                                                group=pgroup)
                game_map = pyglet.sprite.Sprite(tile_map,
                                                x=x * 8,
                                                y=y * 8,
                                                batch=pbatch,
                                                group=pgroup)

                tile_map.blit(x * 8, y * 8)

                #tile_map.draw()
                #map.append(tmap)
                game_map.draw()
                pbatch.draw()
コード例 #12
0
ファイル: gui.py プロジェクト: boskee/Minecraft
    def set_selected_item(self, item, x=0, y=0):
        if not item:
            self.remove_selected_item()
            return

        self.selected_item = item
        img = get_block_icon(item.get_object(), self.icon_size, self.world)
        self.selected_item_icon = image_sprite(img, self.batch[self.mode], self.group[self.mode])
        image_scale = 0.8 / (img.width / self.icon_size)
        self.selected_item_icon.scale = image_scale
        self.selected_item_icon.x = x - (self.selected_item_icon.width // 2)
        self.selected_item_icon.y = y - (self.selected_item_icon.height // 2)
コード例 #13
0
ファイル: gui.py プロジェクト: ronmurphy/Minecraft
    def __init__(self, parent, player, world, *args, **kwargs):
        super(ItemSelector, self).__init__(parent, *args, **kwargs)
        self.amount_labels = []
        self.world = world
        self.player = player
        self.max_items = 9
        self.icon_size = self.world.group.texture.width / G.TILESET_SIZE
        self.visible = True
        self.num_keys = [getattr(G, 'INVENTORY_%d_KEY' % i)
                         for i in range(1, 10)]

        image = load_image('resources', 'textures', 'slots.png')
        heart_image = load_image('resources', 'textures', 'heart.png')
        frame_size = image.height / 2
        self.frame = image_sprite(image, self.batch, 0, y=frame_size, height=frame_size)
        self.active = image_sprite(image, self.batch, 2, width=frame_size, height=frame_size)
        self.hearts = []
        for i in range(0, 10):
            heart = image_sprite(heart_image, self.batch, 0)
            self.hearts.append(heart)
        self.current_block_label = None
コード例 #14
0
    def __init__(self, parent, player, world, *args, **kwargs):
        super(ItemSelector, self).__init__(parent, *args, **kwargs)
        self.world = world
        self.player = player
        self.max_items = 9
        self.icon_size = 32
        self.visible = True
        self.num_keys = [getattr(G, 'INVENTORY_%d_KEY' % i)
                         for i in range(1, 10)]

        image = G.texture_pack_list.selected_texture_pack.load_texture(['gui', 'gui.png'])
        image_scale = image.height / 256
        x_size = 182 * image_scale
        y_size = 22 * image_scale
        self.frame = image_sprite(image, self.batch, 0, y=image.height - y_size, height=y_size, x=0, width=x_size)
        self.frame.scale = (1.0 / image_scale) * 2
        self.frame.x = (self.parent.window.width - self.frame.width) / 2

        heart_image = load_image('resources', 'gui', 'heart.png')
        frame_size = image.height / 2

        x_size = 24 * image_scale
        y_size = 22 * image_scale

        self.active = image_sprite(image, self.batch, 0, y=(image.height - (y_size + (22 * image_scale))), height=y_size, x=0, width=x_size)
        self.active.scale = (1.0 / image_scale) * 2
        self.slots = []
        
        slot_x = self.frame.x + 8
        slot_y = self.frame.y + 8
        for i in range(1, self.max_items + 1):
            self.slots.append(Slot(self, slot_x, slot_y, self.icon_size, self.icon_size, inventory=self.player.quick_slots, index=i-1, is_quickslot=True, world=self.world, batch=self.batch, group=self.group, label_group=self.labels_group))
            slot_x += self.icon_size + 8

        self.hearts = []

        for i in range(0, 10):
            heart = image_sprite(heart_image, self.batch, 0)
            self.hearts.append(heart)
        self.current_block_label = None
コード例 #15
0
ファイル: gui.py プロジェクト: boskee/Minecraft
 def __init__(self, parent, background_pic, foreground_pic,
             x, y, width, height, progress_updater = None, progress = 0, text_color = (0, 0, 0, 255), 
             *args, **kwargs):
     super(ProgressBarWidget, self).__init__(parent, *args, **kwargs)
     self.batch = pyglet.graphics.Batch()
     self.group = pyglet.graphics.OrderedGroup(1)
     self.background_pic = image_sprite(background_pic, self.batch, self.group)
     self.foreground_pic = foreground_pic
     self.progress_pic = None
     self.progress_pic.x = x
     self.progress_pic.y = y
     self.text_color = text_color
     self.x = x
     self.y = y
     self.height = height
     self.width = width
     self.progress_updater = progress_updater
     self.progress = progress
コード例 #16
0
ファイル: controllers.py プロジェクト: hilbix/Minecraft
    def show_map(self):
        print("map called...")
         # taken from Nebual's biome_explorer, this is ment to be a full screen map that uses mini tiles to make a full 2d map.
        with open(os.path.join(G.game_dir, "world", "seed"), "rb") as f:
            SEED = f.read()
        b = BiomeGenerator(SEED)
        x, y, z = self.player.position
        curx =  x
        cury = y
        xsize = 79
        ysize = 28
        pbatch = pyglet.graphics.Batch()
        pgroup = pyglet.graphics.OrderedGroup(1)
        DESERT, PLAINS, MOUNTAINS, SNOW, FOREST = range(5)
        letters = ["D","P","M","S","F"]

        #  temp background pic...
        image = load_image('resources', 'textures', 'main_menu_background.png')

        #map_frame = image_sprite(image, pbatch, 0, y=G.WINDOW_WIDTH, height=G.WINDOW_HEIGHT)
        #sprite = pyglet.sprite.Sprite(image)
        #sprite.image(image)
        #sprite.visible = True
       # map_frame.draw()
       # map_frame.visible = True
        for y in range(int(cury),int(cury+ysize)):
         for x in range(int(curx),int(curx+xsize)):
             #string += letters[b.get_biome_type(x,y)]
            tmap = letters[b.get_biome_type(x,y)]
            tile_map = load_image('resources', 'textures', tmap +'.png')
            tile_map.anchor_x = x * 8
            tile_map.anchor_Y = y * 8
            sprite = pyglet.sprite.Sprite(tile_map, x=x * 8, y=y * 8, batch=pbatch)
            game_map = image_sprite(tile_map, pbatch, pgroup, x * 8, y * 8, 8, 8)
            game_map = pyglet.sprite.Sprite(image,x=G.WINDOW_WIDTH, y=G.WINDOW_HEIGHT,batch=pbatch, group=pgroup)
            game_map = pyglet.sprite.Sprite(tile_map,x=x*8, y=y*8,batch=pbatch, group=pgroup)

            tile_map.blit(x *8, y * 8)

            #tile_map.draw()
            #map.append(tmap)
            game_map.draw()
            pbatch.draw()
コード例 #17
0
ファイル: gui.py プロジェクト: boskee/Minecraft
    def update_progress(self):
        if self.progress_updater is not None:
            self.progress = self.progress_updater()

        self.progress_pic = image_sprite(self.foreground_pic, self.batch, self.group, x=0, y=0,
                width=floor(self.width * self.progress), height=self.height)
コード例 #18
0
ファイル: gui.py プロジェクト: ronmurphy/Minecraft
    def update_items(self):
        rows = floor(self.max_items / 9)
        inventory_y = 43
        inventory_height = (rows * (self.icon_size * 0.5)) + ((rows+1) * 3)
        self.icons = []
        for amount_label in self.amount_labels:
            amount_label.delete()
        self.amount_labels = []
        x = self.frame.x + 7
        y = self.frame.y + inventory_y + inventory_height
        items = self.player.inventory.get_items()
        items = items[:self.max_items]
        for i, item in enumerate(items):
            if not item:
                x += (self.icon_size * 0.5) + 3
                if x >= (self.frame.x + self.frame.width) - 7:
                    x = self.frame.x + 7
                    y -= (self.icon_size * 0.5) + 3
                continue
            icon = image_sprite(get_block_icon(item.get_object(), self.icon_size, self.world), self.batch, self.group)
            icon.scale = 0.5
            icon.x = x
            icon.y = y - icon.height
            x += (self.icon_size * 0.5) + 3
            if x >= (self.frame.x + self.frame.width) - 7:
                x = self.frame.x + 7
                y -= (self.icon_size * 0.5) + 3
            if item.max_durability != -1 and item.durability != -1:
                icon.opacity = min(item.max_durability, item.durability + 1) * 255 / item.max_durability
            amount_label = pyglet.text.Label(
                str(item.amount), font_name=G.DEFAULT_FONT, font_size=9,
                x=icon.x + 3, y=icon.y, anchor_x='left', anchor_y='bottom',
                color=item.get_object().amount_label_color, batch=self.batch,
                group=self.labels_group)
            self.amount_labels.append(amount_label)
            self.icons.append(icon)

        items = self.player.quick_slots.get_items()
        items = items[:self.player.quick_slots.slot_count]
        for i, item in enumerate(items):
            if not item:
                x += (self.icon_size * 0.5) + 3
                continue
            icon = image_sprite(get_block_icon(item.get_object(), self.icon_size, self.world), self.batch, self.group)
            icon.scale = 0.5
            icon.x = x
            icon.y = self.frame.y + 7
            item.quickslots_x = icon.x
            item.quickslots_y = icon.y
            x += (self.icon_size * 0.5) + 3
            if item.max_durability != -1 and item.durability != -1:
                icon.opacity = min(item.max_durability, item.durability + 1) * 255 / item.max_durability
            amount_label = pyglet.text.Label(
                str(item.amount), font_name=G.DEFAULT_FONT, font_size=9,
                x=icon.x + 3, y=icon.y, anchor_x='left', anchor_y='bottom',
                color=item.get_object().amount_label_color, batch=self.batch,
                group=self.labels_group)
            self.amount_labels.append(amount_label)
            self.icons.append(icon)

        items = self.player.armor.get_items()
        items = items[:4]
        x = self.frame.x + 7
        y = inventory_y + inventory_height + 10 + 4 * self.icon_size * 0.5 + 9
        for i, item in enumerate(items):
            if not item:
                y -= (self.icon_size * 0.5) + 3
                continue
            icon = image_sprite(get_block_icon(item.get_object(), self.icon_size, self.world), self.batch, self.group)
            icon.scale = 0.5
            icon.x = x
            icon.y = y
            if item.max_durability != -1 and item.durability != -1:
                icon.opacity = min(item.max_durability, item.durability + 1) * 255 / item.max_durability
            amount_label = pyglet.text.Label(
                str(item.amount), font_name=G.DEFAULT_FONT, font_size=9,
                x=icon.x + 3, y=icon.y, anchor_x='left', anchor_y='bottom',
                color=item.get_object().amount_label_color, batch=self.batch,
                group=self.labels_group)
            self.amount_labels.append(amount_label)
            self.icons.append(icon)

        crafting_y = inventory_y + inventory_height + (42 if self.mode == 0 else 14 if self.mode == 1 else 32)
        crafting_rows = (2 if self.mode == 0 else 3 if self.mode == 1 else 2)
        crafting_height = (crafting_rows * (self.icon_size * 0.5)) + (crafting_rows * 3)
        x = self.frame.x + (165 if self.mode == 0 else 72 if self.mode == 1 else 63)
        y = self.frame.y + crafting_y + crafting_height
        items = self.crafting_panel.get_items() if self.mode == 0 else self.crafting_table_panel.get_items() if self.mode == 1 else self.furnace_panel.get_items()
        items = items[:self.crafting_panel.slot_count] if self.mode == 0 else items[:self.crafting_table_panel.slot_count] if self.mode == 1 else items[:self.furnace_panel.slot_count]
        # NOTE: each line in the crafting panel should be a sub-list in the crafting ingredient list
        crafting_ingredients = [[], []] if self.mode == 0 else [[], [], []] if self.mode == 1 else [[], []]
        for i, item in enumerate(items):
            if not item:
                # placeholder
                crafting_ingredients[int(floor(i / (2 if self.mode == 0 else 3 if self.mode == 1 else 1)))].append(air_block)
                x += (self.icon_size * 0.5) + 3
                if x >= (self.frame.x + (165 if self.mode == 0 else 72 if self.mode == 1 else 63)) + 35 * ((2 if self.mode == 0 else 3 if self.mode == 1 else 1)):
                    x = self.frame.x + (165 if self.mode == 0 else 72 if self.mode == 1 else 63)
                    y -= (self.icon_size * 0.5) + 3
                continue
            icon = image_sprite(get_block_icon(item.get_object(), self.icon_size, self.world), self.batch, self.group)
            icon.scale = 0.5
            icon.x = x
            icon.y = y - icon.height
            item.quickslots_x = icon.x
            item.quickslots_y = icon.y
            x += (self.icon_size * 0.5) + 3
            if x >= (self.frame.x + (165 if self.mode == 0 else 72 if self.mode == 1 else 63)) + 35 * ((2 if self.mode == 0 else 3 if self.mode == 1 else 1)):
                x = self.frame.x + (165 if self.mode == 0 else 72 if self.mode == 1 else 63)
                y -= (self.icon_size * 0.5) + 3
            if item.max_durability != -1 and item.durability != -1:
                icon.opacity = min(item.max_durability, item.durability + 1) * 255 / item.max_durability
            amount_label = pyglet.text.Label(
                str(item.amount), font_name=G.DEFAULT_FONT, font_size=9,
                x=icon.x + 3, y=icon.y, anchor_x='left', anchor_y='bottom',
                color=item.get_object().amount_label_color, batch=self.batch,
                group=self.labels_group)
            self.amount_labels.append(amount_label)
            self.icons.append(icon)
            if item.get_object().id > 0:
                crafting_ingredients[int(floor(i / (2 if self.mode == 0 else 3 if self.mode == 1 else 1)))].append(item.get_object())

        if len(crafting_ingredients) > 0 and self.mode < 2:
            outcome = G.recipes.craft(crafting_ingredients)
            if outcome:
                self.set_crafting_outcome(outcome)
            elif self.crafting_outcome:
                self.remove_crafting_outcome()
        elif len(crafting_ingredients) > 0 and self.mode == 2:
            outcome = self.furnace_panel.get_smelt_outcome()
            if outcome:
                self.set_crafting_outcome(outcome)
            elif self.crafting_outcome:
                self.remove_crafting_outcome()