resource_packs.py
def parse_terrain_png(self):
        '''
        Parses each block texture into a usable PNG file like terrain.png
        '''
        new_terrain = Image.new("RGBA", (512, 512), None)
        for tex in self.block_image.keys():
            if not self.__stop and tex in textureSlots.keys():
                try:
                    image = self.block_image[tex]
                    if image.mode != "RGBA":
                        image = image.convert("RGBA")
                    slot = textureSlots[tex]
                    new_terrain.paste(image, slot, image)
                    self.propogated_textures.append(slot)
                except Exception as e:
                    try:
                        # Print the resource pack 'raw' name.
                        print "An Exception occurred while trying to parse textures for {}".format(self._pack_name)
                    except:
                        # I for a reason it fails, print the 'representation' of it.
                        print "An Exception occurred while trying to parse textures for {}".format(repr(self._pack_name))
                    traceback.print_stack()
                    print "Exception Message: "+str(e)
                    print "Exception type: "+str(type(e))
                    self.__stop = True
                    self._isEmpty = True
                    pass
        copy = self.old_terrain.copy()

        for t in self.all_texture_slots:
            if t not in self.propogated_textures:
                old_tex = copy.crop((t[0],t[1],t[0]+16,t[1]+16))
                new_terrain.paste(old_tex, t, old_tex)

        new_terrain.save(self._terrain_path)
        try:
            os.remove(self._pack_name.replace(" ", "_")+".png")
        except:
            pass
        if not self.propogated_textures:
            os.remove(self._terrain_path)
            self._isEmpty = True
            #print u"{} did not replace any textures".format(self._pack_name)

        del self.block_image

        Parses each block texture into a usable PNG file like terrain.png
        
Parses each block texture into a usable PNG file like terrain.png
Parses each block texture into a usable PNG file like terrain . png
def parse_terrain_png(self):
        new_terrain = Image.new("RGBA", (512, 512), None)
        for tex in self.block_image.keys():
            if not self.__stop and tex in textureSlots.keys():
                try:
                    image = self.block_image[tex]
                    if image.mode != "RGBA":
                        image = image.convert("RGBA")
                    slot = textureSlots[tex]
                    new_terrain.paste(image, slot, image)
                    self.propogated_textures.append(slot)
                except Exception as e:
                    try:
                        print "An Exception occurred while trying to parse textures for {}".format(self._pack_name)
                    except:
                        print "An Exception occurred while trying to parse textures for {}".format(repr(self._pack_name))
                    traceback.print_stack()
                    print "Exception Message: "+str(e)
                    print "Exception type: "+str(type(e))
                    self.__stop = True
                    self._isEmpty = True
                    pass
        copy = self.old_terrain.copy()
        for t in self.all_texture_slots:
            if t not in self.propogated_textures:
                old_tex = copy.crop((t[0],t[1],t[0]+16,t[1]+16))
                new_terrain.paste(old_tex, t, old_tex)
        new_terrain.save(self._terrain_path)
        try:
            os.remove(self._pack_name.replace(" ", "_")+".png")
        except:
            pass
        if not self.propogated_textures:
            os.remove(self._terrain_path)
            self._isEmpty = True
        del self.block_image
def parse_terrain_png ( self ) : new_terrain = Image . new ( "RGBA" , ( 512 , 512 ) , None ) for tex in self . block_image . keys ( ) : if not self . __stop and tex in textureSlots . keys ( ) : try : image = self . block_image [ tex ] if image . mode != "RGBA" : image = image . convert ( "RGBA" ) slot = textureSlots [ tex ] new_terrain . paste ( image , slot , image ) self . propogated_textures . append ( slot ) except Exception as e : try : print "An Exception occurred while trying to parse textures for {}" . format ( self . _pack_name ) except : print "An Exception occurred while trying to parse textures for {}" . format ( repr ( self . _pack_name ) ) traceback . print_stack ( ) print "Exception Message: " + str ( e ) print "Exception type: " + str ( type ( e ) ) self . __stop = True self . _isEmpty = True pass copy = self . old_terrain . copy ( ) for t in self . all_texture_slots : if t not in self . propogated_textures : old_tex = copy . crop ( ( t [ 0 ] , t [ 1 ] , t [ 0 ] + 16 , t [ 1 ] + 16 ) ) new_terrain . paste ( old_tex , t , old_tex ) new_terrain . save ( self . _terrain_path ) try : os . remove ( self . _pack_name . replace ( " " , "_" ) + ".png" ) except : pass if not self . propogated_textures : os . remove ( self . _terrain_path ) self . _isEmpty = True del self . block_image
Parses each block texture into a usable PNG file like terrain.png
Parses each block texture into a usable PNG file like terrain . png
'''
        Parses each block texture into a usable PNG file like terrain.png
        ''' # Print the resource pack 'raw' name. # I for a reason it fails, print the 'representation' of it. #print u"{} did not replace any textures".format(self._pack_name)
self