resource_packs.py
def add_textures(self):
        '''
        Scraps the block textures folder and puts texture data into a dictionary with exactly identical structure as ZipResourcePack
        '''
        base_path = os.path.join(self._full_path, "assets", "minecraft", "textures", "blocks")
        if os.path.exists(base_path):
            files = os.listdir(base_path)
            for tex_file in files:
                if tex_file.endswith(".png") and not tex_file.startswith("._") and tex_file.replace(".png","") in textureSlots:
                    possible_texture = Image.open(os.path.join(base_path, tex_file))
                    block_name = tex_file[:-4]
                    if possible_texture.size == (16, 16):
                        self.block_image[block_name] = possible_texture
                        if block_name.startswith("repeater_") or block_name.startswith("comparator_"):
                            self.block_image[block_name+"_west"] = possible_texture.rotate(-90)
                            self.block_image[block_name+"_north"] = possible_texture.rotate(180)
                            self.block_image[block_name+"_east"] = possible_texture.rotate(90)
                            self.block_image[block_name+"_south"] = possible_texture
                        if block_name == "piston_side":
                            self.block_image["piston_up"] = possible_texture
                            self.block_image["piston_left"] = possible_texture.rotate(90)
                            self.block_image["piston_down"] = possible_texture.rotate(180)
                            self.block_image["piston_right"] = possible_texture.rotate(-90)
                        if block_name == "hay_block_side":
                            self.block_image["hay_block_side_rotated"] = possible_texture.rotate(-90)
                        if block_name == "quartz_block_lines":
                            self.block_image["quartz_block_lines_rotated"] = possible_texture.rotate(-90)
                        if block_name.startswith("bed_"):
                            if block_name == "bed_head_side":
                                self.block_image["bed_head_side_flipped"] = possible_texture.transpose(Image.FLIP_LEFT_RIGHT)
                            if block_name == "bed_feet_side":
                                self.block_image["bed_feet_side_flipped"] = possible_texture.transpose(Image.FLIP_LEFT_RIGHT)
                            if block_name == "bed_head_top":
                                self.block_image["bed_head_top_flipped"] = possible_texture.transpose(Image.FLIP_LEFT_RIGHT)
                                self.block_image["bed_head_top_bottom"] = possible_texture.rotate(-90)
                                self.block_image["bed_head_top_top"] = possible_texture.rotate(90)
                            if block_name == "bed_feet_top":
                                self.block_image["bed_feet_top_flipped"] = possible_texture.transpose(Image.FLIP_LEFT_RIGHT)
                                self.block_image["bed_feet_top_bottom"] = possible_texture.rotate(-90)
                                self.block_image["bed_feet_top_top"] = possible_texture.rotate(90)
                    else:
                        if possible_texture.size == (32, 32):
                            self.block_image[block_name] = possible_texture.resize((16, 16))
                        if possible_texture.size == (64, 64) or possible_texture.size == (128, 128) or possible_texture.size == (256, 256):
                            self.big_textures_counted += 1
                        else:
                            self.block_image[block_name] = possible_texture.crop((0,0,16,16))
        if self.big_textures_counted >= self.big_textures_max:
            self.handle_too_big_packs()
        else:
            self.parse_terrain_png()

        Scraps the block textures folder and puts texture data into a dictionary with exactly identical structure as ZipResourcePack
        
Scraps the block textures folder and puts texture data into a dictionary with exactly identical structure as ZipResourcePack
Scraps the block textures folder and puts texture data into a dictionary with exactly identical structure as ZipResourcePack
def add_textures(self):
        base_path = os.path.join(self._full_path, "assets", "minecraft", "textures", "blocks")
        if os.path.exists(base_path):
            files = os.listdir(base_path)
            for tex_file in files:
                if tex_file.endswith(".png") and not tex_file.startswith("._") and tex_file.replace(".png","") in textureSlots:
                    possible_texture = Image.open(os.path.join(base_path, tex_file))
                    block_name = tex_file[:-4]
                    if possible_texture.size == (16, 16):
                        self.block_image[block_name] = possible_texture
                        if block_name.startswith("repeater_") or block_name.startswith("comparator_"):
                            self.block_image[block_name+"_west"] = possible_texture.rotate(-90)
                            self.block_image[block_name+"_north"] = possible_texture.rotate(180)
                            self.block_image[block_name+"_east"] = possible_texture.rotate(90)
                            self.block_image[block_name+"_south"] = possible_texture
                        if block_name == "piston_side":
                            self.block_image["piston_up"] = possible_texture
                            self.block_image["piston_left"] = possible_texture.rotate(90)
                            self.block_image["piston_down"] = possible_texture.rotate(180)
                            self.block_image["piston_right"] = possible_texture.rotate(-90)
                        if block_name == "hay_block_side":
                            self.block_image["hay_block_side_rotated"] = possible_texture.rotate(-90)
                        if block_name == "quartz_block_lines":
                            self.block_image["quartz_block_lines_rotated"] = possible_texture.rotate(-90)
                        if block_name.startswith("bed_"):
                            if block_name == "bed_head_side":
                                self.block_image["bed_head_side_flipped"] = possible_texture.transpose(Image.FLIP_LEFT_RIGHT)
                            if block_name == "bed_feet_side":
                                self.block_image["bed_feet_side_flipped"] = possible_texture.transpose(Image.FLIP_LEFT_RIGHT)
                            if block_name == "bed_head_top":
                                self.block_image["bed_head_top_flipped"] = possible_texture.transpose(Image.FLIP_LEFT_RIGHT)
                                self.block_image["bed_head_top_bottom"] = possible_texture.rotate(-90)
                                self.block_image["bed_head_top_top"] = possible_texture.rotate(90)
                            if block_name == "bed_feet_top":
                                self.block_image["bed_feet_top_flipped"] = possible_texture.transpose(Image.FLIP_LEFT_RIGHT)
                                self.block_image["bed_feet_top_bottom"] = possible_texture.rotate(-90)
                                self.block_image["bed_feet_top_top"] = possible_texture.rotate(90)
                    else:
                        if possible_texture.size == (32, 32):
                            self.block_image[block_name] = possible_texture.resize((16, 16))
                        if possible_texture.size == (64, 64) or possible_texture.size == (128, 128) or possible_texture.size == (256, 256):
                            self.big_textures_counted += 1
                        else:
                            self.block_image[block_name] = possible_texture.crop((0,0,16,16))
        if self.big_textures_counted >= self.big_textures_max:
            self.handle_too_big_packs()
        else:
            self.parse_terrain_png()
def add_textures ( self ) : base_path = os . path . join ( self . _full_path , "assets" , "minecraft" , "textures" , "blocks" ) if os . path . exists ( base_path ) : files = os . listdir ( base_path ) for tex_file in files : if tex_file . endswith ( ".png" ) and not tex_file . startswith ( "._" ) and tex_file . replace ( ".png" , "" ) in textureSlots : possible_texture = Image . open ( os . path . join ( base_path , tex_file ) ) block_name = tex_file [ : - 4 ] if possible_texture . size == ( 16 , 16 ) : self . block_image [ block_name ] = possible_texture if block_name . startswith ( "repeater_" ) or block_name . startswith ( "comparator_" ) : self . block_image [ block_name + "_west" ] = possible_texture . rotate ( - 90 ) self . block_image [ block_name + "_north" ] = possible_texture . rotate ( 180 ) self . block_image [ block_name + "_east" ] = possible_texture . rotate ( 90 ) self . block_image [ block_name + "_south" ] = possible_texture if block_name == "piston_side" : self . block_image [ "piston_up" ] = possible_texture self . block_image [ "piston_left" ] = possible_texture . rotate ( 90 ) self . block_image [ "piston_down" ] = possible_texture . rotate ( 180 ) self . block_image [ "piston_right" ] = possible_texture . rotate ( - 90 ) if block_name == "hay_block_side" : self . block_image [ "hay_block_side_rotated" ] = possible_texture . rotate ( - 90 ) if block_name == "quartz_block_lines" : self . block_image [ "quartz_block_lines_rotated" ] = possible_texture . rotate ( - 90 ) if block_name . startswith ( "bed_" ) : if block_name == "bed_head_side" : self . block_image [ "bed_head_side_flipped" ] = possible_texture . transpose ( Image . FLIP_LEFT_RIGHT ) if block_name == "bed_feet_side" : self . block_image [ "bed_feet_side_flipped" ] = possible_texture . transpose ( Image . FLIP_LEFT_RIGHT ) if block_name == "bed_head_top" : self . block_image [ "bed_head_top_flipped" ] = possible_texture . transpose ( Image . FLIP_LEFT_RIGHT ) self . block_image [ "bed_head_top_bottom" ] = possible_texture . rotate ( - 90 ) self . block_image [ "bed_head_top_top" ] = possible_texture . rotate ( 90 ) if block_name == "bed_feet_top" : self . block_image [ "bed_feet_top_flipped" ] = possible_texture . transpose ( Image . FLIP_LEFT_RIGHT ) self . block_image [ "bed_feet_top_bottom" ] = possible_texture . rotate ( - 90 ) self . block_image [ "bed_feet_top_top" ] = possible_texture . rotate ( 90 ) else : if possible_texture . size == ( 32 , 32 ) : self . block_image [ block_name ] = possible_texture . resize ( ( 16 , 16 ) ) if possible_texture . size == ( 64 , 64 ) or possible_texture . size == ( 128 , 128 ) or possible_texture . size == ( 256 , 256 ) : self . big_textures_counted += 1 else : self . block_image [ block_name ] = possible_texture . crop ( ( 0 , 0 , 16 , 16 ) ) if self . big_textures_counted >= self . big_textures_max : self . handle_too_big_packs ( ) else : self . parse_terrain_png ( )
Scraps the block textures folder and puts texture data into a dictionary with exactly identical structure as ZipResourcePack
Scraps the block textures folder and puts texture data into a dictionary with exactly identical structure as ZipResourcePack
'''
        Scraps the block textures folder and puts texture data into a dictionary with exactly identical structure as ZipResourcePack
        '''
self