Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- from Bo3_Bulkedit_Lib_ObjectLayout import DefaultObject_Start, DefaultObject_End
- from Bo3_Bulkedit_Lib_MatDictionary import MaterialDic
- import os;
- import glob
- import thread
- import sys
- import nbt
- import time
- #####################
- ### - Functions - ###
- #####################
- wait_text = {}
- wait_text[0] = "[INFO]"
- wait_text[1] = "[INFO]"+" Work it, ..."
- wait_text[2] = "[INFO]"+" Make it, ..."
- wait_text[3] = "[INFO]"+" Do it, ..."
- wait_text[4] = "[INFO]"+" Makes us, ..."
- wait_text[5] = "[INFO]"
- wait_text[6] = "[INFO]"+" Harder, "
- wait_text[7] = "[INFO]"+" Better, "
- wait_text[8] = "[INFO]"+" Faster, "
- wait_text[9] = "[INFO]"+" Stronger, "
- wait_text[10] = "[INFO]"
- wait_text[11] = "[INFO]"+" More than, "
- wait_text[12] = "[INFO]"+" Hour, "
- wait_text[13] = "[INFO]"+" Our, "
- wait_text[14] = "[INFO]"+" Never, "
- wait_text[15] = "[INFO]"+" Ever, "
- wait_text[16] = "[INFO]"+" After, "
- wait_text[17] = "[INFO]"+" Work is, "
- wait_text[18] = "[INFO]"+" Over, "
- wait_text[19] = "[INFO]"
- wait_text[20] = "[INFO]"+" Work it harder, "
- wait_text[21] = "[INFO]"+" Make it better, "
- wait_text[22] = "[INFO]"+" Do it faster, "
- wait_text[23] = "[INFO]"+" Makes us stronger, "
- wait_text[24] = "[INFO]"
- wait_text[25] = "[INFO]"+" More than ever, "
- wait_text[26] = "[INFO]"+" Hour after, "
- wait_text[27] = "[INFO]"+" Our work is, "
- wait_text[28] = "[INFO]"+" Never over, "
- def iterate_nbt(nbt_object):
- def cycle_data(nbt, depth, list):
- data = ""
- string = ""
- name = ""
- string_add = ""
- name_add = ""
- indend = ""
- for i in range(0, depth): indend = indend+" "
- depth += 1
- id = 0
- for data in nbt:
- if list == True:
- key = id
- else:
- key = data
- string_add = ""
- data_type = str(type(nbt[key]))[str(type(nbt[key])).find("TAG",0):len(str(type(nbt[key])))-2]
- if data_type not in known_tags:
- print nbt[key].tag_info()
- print data_type
- print string
- raw_input()
- if data_type in value_tags:
- #if str(nbt[key]) != "0" and str(nbt[key]) != "0.0":
- if id >=1 : string = string+","
- if list == True:
- string = string+''+str(nbt[key])+''
- else:
- string = string+str(key)+":"+''+str(nbt[key])+''
- id += 1
- elif data_type == "TAG_List":
- data_add , string_add , name_add = cycle_data(nbt[key] , 1 , True)
- #if "["+string_add+"]" != "[]":
- if id >=1 : string = string+","
- string += key+":["+string_add+"]"
- id += 1
- elif data_type == "TAG_Compound":
- try:
- if "'" in str(nbt[key].tag_info()):
- comp_name = str(nbt[key].tag_info())
- comp_name = comp_name[comp_name.find("'",0)+1:]
- comp_name = comp_name[:comp_name.find("'",0)]
- else:
- comp_name = ""
- except:
- comp_name = ""
- data_add , string_add , name_add = cycle_data(nbt[key] , 1 , False)
- #if "{"+string_add+"}" != "{}":
- if id >=1 : string+=","
- if comp_name != "":
- string +=comp_name+":{"+string_add+"}"
- else:
- string +="{"+string_add+"}"
- id += 1
- elif data_type == "TAG_String":
- if str(nbt[key]) != "":
- if id >=1 : string = string+","
- string = string+str(key)+":"+'"'+str(nbt[key])+'"'
- id += 1
- elif data_type == "TAG_Float":
- #if str(nbt[key]) != "0" and str(nbt[key]) != "0.0":
- if id >=1 : string = string+","
- if list == True:
- string = string+''+str(nbt[key])+''
- else:
- string = string+str(key)+":"+''+str(nbt[key])+'f'
- id += 1
- string_add = ""
- return data, string, name
- newNBT = nbt.NBTFile()
- string = "{"
- string_add = ""
- name_add = ""
- try:
- name = str(nbt_object["id"])[str(nbt_object["id"]).find(":",0)+1:]
- except:
- name = ""
- id = 0
- known_tags = ["TAG_Byte","TAG_Long","TAG_Int","TAG_Short","TAG_Double","TAG_List","TAG_Compound","TAG_String","TAG_Float"]
- value_tags = ["TAG_Byte","TAG_Long","TAG_Int","TAG_Short","TAG_Double"]
- ignore_tags = ["x","y","z","Spigot.ticksLived","UUIDLeast","UUIDMost","WorldUUIDLeast","WorldUUIDMost","Pos","Bukkit.updateLevel","PortalCooldown","OnGround","Dimension","Air","Fire","HurtTime","HurtByTimestamp"]
- for data in nbt_object:
- if data not in ignore_tags:
- string_add = ""
- newNBT.tags.append(nbt_object[data])
- data_type = str(type(nbt_object[data]))[str(type(nbt_object[data])).find("TAG",0):len(str(type(nbt_object[data])))-2]
- if data_type not in known_tags:
- print nbt_object[data].tag_info()
- print data_type
- print string
- raw_input()
- if data_type in value_tags:
- #if str(nbt_object[data]) != "0" and str(nbt_object[data]) != "0.0":
- if id >=1 : string = string+","
- string = string+str(data)+":"+''+str(nbt_object[data])+''
- id += 1
- elif data_type == "TAG_List":
- data_add , string_add , name_add = cycle_data(nbt_object[data] , 1 , True)
- #if "["+string_add+"]" != "[]":
- if id >=1 : string = string+","
- string += data+":["+string_add+"]"
- id += 1
- elif data_type == "TAG_Compound":
- try:
- if "'" in str(nbt_object[data].tag_info()):
- comp_name = str(nbt_object[data].tag_info())
- comp_name = comp_name[comp_name.find("'",0)+1:]
- comp_name = comp_name[:comp_name.find("'",0)]
- else:
- comp_name = ""
- except:
- comp_name = ""
- data_add , string_add , name_add = cycle_data(nbt_object[data] , 1 , False)
- #if "{"+string_add+"}" != "{}":
- if id >=1 : string+=","
- if comp_name != "":
- string +=comp_name+":{"+string_add+"}"
- else:
- string +="{"+string_add+"}"
- id += 1
- elif data_type == "TAG_String":
- if str(nbt_object[data]) != "":
- if id >=1 : string = string+","
- string = string+str(data)+":"+'"'+str(nbt_object[data])+'"'
- id += 1
- elif data_type == "TAG_Float":
- #if str(nbt_object[data]) != "0" and str(nbt_object[data]) != "0.0" and str(nbt_object[data]) != "":
- if id >=1 : string = string+","
- string = string+str(data)+":"+''+str(nbt_object[data])+'f'
- id += 1
- name = name+name_add
- string = string+"}"
- if "minecraft:" in str(newNBT["id"]):
- newNBT["id"].value = str(nbt_object["id"])[str(nbt_object["id"]).find(":",0)+1:]
- return newNBT, string, name
- def busy_progress():
- global progress_time
- global progress_time_first
- global progress_time_amt
- global wait_text
- global debug
- if debug != "true":
- if progress_time_first == False:
- if time.time() > progress_time + 10:
- progress_time_first = True
- print "[INFO] This is taking much Work, ..."
- progress_time = time.time()
- else:
- if time.time() > progress_time + 10:
- print wait_text[progress_time_amt]
- progress_time_amt = progress_time_amt + 1
- progress_time = time.time()
- if progress_time_amt > 28:
- progress_time_amt = 20
- def find_nth(haystack, needle, n):
- start = haystack.find(needle)
- while start >= 0 and n > 1:
- start = haystack.find(needle, start+len(needle))
- n -= 1
- return start
- def indexstring(value):
- if value < 10:
- return str("0" + str(value))
- else:
- return str(value)
- def create_settings(name):
- Object_Comments[name] = "-NONE-"
- Object_Splits[name] = "False"
- Object_Desc[name] = "-NONE-"
- Object_Tree[name] = "-NONE-"
- Object_Freq[name] = "-NONE-"
- Object_Rare[name] = "-NONE-"
- Object_Rot[name] = "-NONE-"
- Object_Spawn[name] = "-NONE-"
- Object_Offset[name] = "-NONE-"
- Object_Var[name] = "-NONE-"
- Object_Min[name] = "-NONE-"
- Object_Max[name] = "-NONE-"
- Object_Ext[name] = "-NONE-"
- Object_ExtBlocks[name] = "-NONE-"
- Object_Branches[name] = "-NONE-"
- Object_Biomes[name] = "-NONE-"
- Object_SourceBlocks[name] = "-NONE-"
- Object_SourcePercent[name] = "-NONE-"
- Object_SourcePlacement[name] = "-NONE-"
- Object_Shift_X[name] = 0
- Object_Shift_Y[name] = 0
- Object_Shift_Z[name] = 0
- Object_Preview[name] = 0
- counter = 0
- listaddress = name + "_" + str(counter)
- PlaceHolder_Air[name] = ""
- PlaceHolder_Remove[name] = ""
- PlaceHolder_Check[name] = ""
- PlaceHolder_Branch[name] = ""
- PlaceHolder_Center[name] = ""
- Change_Operation[name] = 0
- Change_Type[listaddress] = "-NONE-"
- Change_Type_To[listaddress] = "-NONE-"
- Change_Block[listaddress] = "-NONE-"
- Change_Block_To[listaddress] = "-NONE-"
- ########################
- ### Funny Start Text ###
- ########################
- print "\n\n\n\n"
- print "#####".center(50, " ")
- print "###########".center(50, " ")
- print "###################".center(50, " ")
- print "Starting - Sanctuary BO3-Editor".center(50, " ")
- print "###################".center(50, " ")
- print "###########".center(50, " ")
- print "#####".center(50, " ")
- print "\n"
- print "___...--{Bastard AI from Hell at your Service}--...___".center(50, " ")
- print "\n\n"
- print "\n\n"
- error = "false"
- ############################
- ### - Creating Folders - ###
- ############################
- ### - Object Folder - ###
- if os.path.exists("./Objects/"):
- pathexist = "true"
- else:
- try:
- os.mkdir("./Objects/")
- print "[INFO] I created a Folder 'Objects'."
- print "[INFO] Move your *.Bo3 files to that Folder'."
- print "[INFO] BulkEdit will modify all *.Bo3 files located there.'"
- except:
- error = "true"
- print "[--!Error!--] I could not Create a Neccessary Folder."
- print "[INFO] Create a Folder Called 'Objects' at this location."
- print "[INFO] Move your *.Bo3 files to that Folder'."
- print "[INFO] BulkEdit will modify all *.Bo3 files located there.'"
- ### - Result Folder - ###
- if os.path.exists("./Results/"):
- pathexist = "true"
- else:
- try:
- os.mkdir("./Results/")
- print "[INFO] I created a Folder 'Results'."
- print "[INFO] Processed Objects will be placed there."
- except:
- error = "true"
- print "[--!Error!--] I could not Create a Neccessary Folder."
- print "[INFO] Create a Folder Called 'Results' at this location."
- print "[INFO] Processed Objects will be placed there."
- if os.path.exists("./Results/NBT/"):
- pathexist = "true"
- else:
- try:
- os.mkdir("./Results/NBT/")
- print "[INFO] I created a Folder 'NBT'."
- print "[INFO] Processed NBT data will be placed there."
- except:
- error = "true"
- print "[--!Error!--] I could not Create a Neccessary Folder."
- print "[INFO] Create a Folder Called 'Results/NBT/' at this location."
- print "[INFO] Processed Objects will be placed there."
- if os.path.exists("./Results/Preview/"):
- pathexist = "true"
- else:
- try:
- os.mkdir("./Results/Preview/")
- print "[INFO] I created a Folder 'Results'."
- print "[INFO] Processed Objects will be placed there."
- except:
- error = "true"
- print "[--!Error!--] I could not Create a Neccessary Folder."
- print "[INFO] Create a Folder Called 'Results/Preview/' at this location."
- print "[INFO] Processed Previews will be placed there."
- #############################################
- ### - Reading and Generating ConfigFile - ###
- #############################################
- debug = "false"
- debug_msg = []
- debug_faulty = []
- progress_time = time.time()
- progress_time_amt = 0
- progress_time_first = False
- object_region = {}
- branchspace = []
- naming_Block = ["Block(", "block(", "BLOCK(", "b(", "B("]
- naming_RandomBlock = ["RandomBlock(", "randomblock(", "RANDOMBLOCK(", "rb(", "RB("]
- naming_Branch = ["Branch(", "branch(", "BRANCH(", "br(", "BR"]
- naming_WeightedBranch = ["WeightedBranch(", "weightedbranch(", "WEIGHTEDBRANCH(", "wbr(", "WBR("]
- naming_Object = ["MinecraftObject(", "minecraftobject(", "MINECRAFTOBJECT(", "mco(", "MCO("]
- naming_BlockCheck = ["BlockCheck(", "blockcheck(", "BLOCKCHECK(", "bc(", "BC("]
- naming_BlockCheckNot = ["BlockCheckNot(", "blockchecknot(", "BLOCKCHECKNOT(", "bcn(", "BCN("]
- naming_LightCheck = ["LightCheck(", "lightcheck(", "LIGHTCHECK(", "lc(", "LC("]
- naming_Entity = ["Entity(", "entity(", "ENTITY(", "e(", "E("]
- naming_list = naming_Block + naming_RandomBlock + naming_Branch + naming_WeightedBranch + naming_Object + naming_BlockCheck + naming_BlockCheckNot + naming_LightCheck + naming_Entity
- ### Preparing Variables ###
- ### --- BO3 Settings --- ###
- ### Main Object Settings ###
- BlackList_NBT = []
- Blacklist_Entity = []
- Object_Settings = []
- Object_Comments = {}
- Object_Splits = {}
- Object_SplitSize = {}
- Object_Desc = {}
- Object_Tree = {}
- Object_Freq = {}
- Object_Rare = {}
- Object_Rot = {}
- Object_Spawn = {}
- Object_Offset = {}
- Object_Var = {}
- Object_Min = {}
- Object_Max = {}
- Object_Ext = {}
- Object_ExtBlocks = {}
- Object_Branches = {}
- Object_Biomes = {}
- Object_SourceBlocks = {}
- Object_SourcePercent = {}
- Object_SourcePlacement = {}
- Object_Shift_X = {}
- Object_Shift_Y = {}
- Object_Shift_Z = {}
- Object_Preview = {}
- ### PlaceHolders ###
- PlaceHolder_Air = {}
- PlaceHolder_Remove = {}
- PlaceHolder_Check = {}
- PlaceHolder_Branch = {}
- PlaceHolder_Center = {}
- ### Changes ###
- Change_Operation = {}
- Change_Type = {}
- Change_Type_To = {}
- Change_Block = {}
- Change_Block_To = {}
- ### Material list ###
- BulkeEdit_Materials = {}
- Missing_ID_List = []
- Missing_Image_List = []
- Config_Version = ""
- global temp_file
- if debug == "true":
- for line in debug_msg:
- print "[DEBUG] " + line
- del debug_msg[:]
- raw_input()
- ##########################
- ####Read Material List####
- ##########################
- BulkeEdit_Materials, debug_add = MaterialDic(debug)
- debug_msg + debug_add
- ##########################
- #### Read Config File ####
- ##########################
- Settings_Current = ""
- try:
- File_Settings = open('./Bo3_BulkEdit_Settings.ini', 'r')
- for line in File_Settings:
- line = line.strip('\n')
- if line.startswith("Version: "):
- Config_Version = line[line.find(":",0)+2:]
- if "#" not in line[0:10]:
- if "Obj_" in line[0:4]:
- debug_msg.append("Found new Setting:" + line[4:line.find(":",0)])
- Object_Settings.append(line[4:line.find(":",0)])
- Settings_Current = line[4:line.find(":",0)]
- create_settings(Settings_Current)
- Change_Counter = 0
- if "BlackList_NBT:" in line:
- BlackList_NBT = line[line.find(":",0)+2:].split(" ")
- debug_msg.append("Changed BlackList_NBT to [" + str(BlackList_NBT) +"]")
- if "Blacklist_Entity:" in line:
- Blacklist_Entity = line[line.find(":",0)+2:].split(" ")
- debug_msg.append("Changed Blacklist_Entity to [" + str(Blacklist_Entity) +"]")
- if "RemoveComments:" in line:
- Object_Comments[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed RemoveComments to [" + line[line.find(":",0)+2:] +"]")
- if "SplitObjects:" in line:
- Object_Splits[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed SplitObjects to [" + line[line.find(":",0)+2:] +"]")
- if "SplitSize:" in line:
- Object_SplitSize[Settings_Current] = int(line[line.find(":",0)+2:])
- debug_msg.append("Changed SplitSize to [" + line[line.find(":",0)+2:] +"]")
- if "Description:" in line:
- Object_Desc[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed Description to [" + line[line.find(":",0)+2:] +"]")
- if "Tree:" in line:
- Object_Tree[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed Tree to [" + line[line.find(":",0)+2:] +"]")
- if "Frequency:" in line:
- Object_Freq[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed Frequency to [" + line[line.find(":",0)+2:] +"]")
- if "Rarity:" in line:
- Object_Rare[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed Rarity to [" + line[line.find(":",0)+2:] +"]")
- if "RotateRandomly:" in line:
- Object_Rot[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed RotateRandomly to [" + line[line.find(":",0)+2:] +"]")
- if "SpawnHeight:" in line:
- Object_Spawn[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed SpawnHeight to [" + line[line.find(":",0)+2:] +"]")
- if "SpawnHeightOffset:" in line:
- Object_Offset[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed SpawnHeightOffset to [" + line[line.find(":",0)+2:] +"]")
- if "SpawnHeightVariance:" in line:
- Object_Var[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed SpawnHeightVariance to [" + line[line.find(":",0)+2:] +"]")
- if "MinHeight:" in line:
- Object_Min[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed MinHeight to [" + line[line.find(":",0)+2:] +"]")
- if "MaxHeight:" in line:
- Object_Max[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed MaxHeight to [" + line[line.find(":",0)+2:] +"]")
- if "ExtrudeMode:" in line:
- Object_Ext[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed ExtrudeMode to [" + line[line.find(":",0)+2:] +"]")
- if "ExtrudeThroughBlocks:" in line:
- Object_ExtBlocks[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed ExtrudeThroughBlocks to [" + line[line.find(":",0)+2:] +"]")
- if "MaxBranchDepth:" in line:
- Object_Branches[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed MaxBranchDepth to [" + line[line.find(":",0)+2:] +"]")
- if "ExcludedBiomes:" in line:
- Object_Biomes[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed ExcludedBiomes to [" + line[line.find(":",0)+2:] +"]")
- if "SourceBlocks:" in line:
- Object_SourceBlocks[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed SourceBlocks to [" + line[line.find(":",0)+2:] +"]")
- if "MaxPercentageOutsideSourceBlock:" in line:
- Object_SourcePercent[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed MaxPercentageOutsideSourceBlock to [" + line[line.find(":",0)+2:] +"]")
- if "OutsideSourceBlock:" in line:
- Object_SourcePlacement[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed OutsideSourceBlock to [" + line[line.find(":",0)+2:] +"]")
- if "Shift_X:" in line:
- Object_Shift_X[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed Shift X to [" + line[line.find(":",0)+2:] +"]")
- if "Shift_Y:" in line:
- Object_Shift_Y[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed Shift Y to [" + line[line.find(":",0)+2:] +"]")
- if "Shift_Z:" in line:
- Object_Shift_Z[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed Shift Z to [" + line[line.find(":",0)+2:] +"]")
- if "Preview:" in line:
- Object_Preview[Settings_Current] = line[line.find(":",0)+2:]
- debug_msg.append("Changed Preview to [" + line[line.find(":",0)+2:] +"]")
- ### PlaceHolders ###
- if "AIR_Block:" in line:
- PlaceHolder_Air[Settings_Current] += ","+line[line.find(":",0)+2:]
- if ":" not in line[line.find(":",0)+2:]:
- PlaceHolder_Air[Settings_Current] += ","+line[line.find(":",0)+2:]+":0"
- debug_msg.append("Changed Air Placeholder to [" + PlaceHolder_Air[Settings_Current] +"]")
- if "REMOVE_Block:" in line:
- PlaceHolder_Remove[Settings_Current] += ","+line[line.find(":",0)+2:]
- if ":" not in line[line.find(":",0)+2:]:
- PlaceHolder_Remove[Settings_Current] += ","+line[line.find(":",0)+2:]+":0"
- debug_msg.append("Changed Remove Placeholder to [" + PlaceHolder_Remove[Settings_Current] +"]")
- if "CHECK_Block:" in line:
- PlaceHolder_Check[Settings_Current] += ","+line[line.find(":",0)+2:]
- if ":" not in line[line.find(":",0)+2:]:
- PlaceHolder_Check[Settings_Current] += ","+line[line.find(":",0)+2:]+":0"
- debug_msg.append("Changed BlockCheck Placeholder to [" + PlaceHolder_Check[Settings_Current] +"]")
- if "BRANCH_Block:" in line:
- PlaceHolder_Branch[Settings_Current] += ","+line[line.find(":",0)+2:]
- if ":" not in line[line.find(":",0)+2:]:
- PlaceHolder_Branch[Settings_Current] += ","+line[line.find(":",0)+2:]+":0"
- debug_msg.append("Changed Branch Placeholder to [" + PlaceHolder_Branch[Settings_Current] +"]")
- if "CENTER_Block:" in line:
- PlaceHolder_Center[Settings_Current] += ","+line[line.find(":",0)+2:]
- if ":" not in line[line.find(":",0)+2:]:
- PlaceHolder_Center[Settings_Current] += ","+line[line.find(":",0)+2:]+":0"
- debug_msg.append("Changed Center Placeholder to [" + PlaceHolder_Center[Settings_Current] +"]")
- ### Changes ###
- if "Change:" in line:
- listaddress = Settings_Current + "_" + str(Change_Counter)
- Change_Operation[Settings_Current] = Change_Counter
- Change_Counter += 1
- Change_Type[listaddress] = line[line.find(":",0)+2:find_nth(line, "->", 1)-1]
- Change_Type_To[listaddress] = line[find_nth(line, "->", 1)+3:find_nth(line, "|", 1)-1]
- Change_Block[listaddress] = line[find_nth(line, "|", 1)+2:find_nth(line, "->", 2)-1]
- Change_Block_To[listaddress] = line[find_nth(line, "->", 2)+3:]
- debug_msg.append(str(Change_Operation[Settings_Current]) + ":" + Change_Type[listaddress] + "->" + Change_Type_To[listaddress] + " | " + Change_Block[listaddress] + "->" + Change_Block_To[listaddress])
- File_Settings.close()
- except:
- print "[WARN] Config File missing or contains Errors."
- print "[WARN] Config File will be Regenerated."
- print "[INFO] Press ANY-Key to continue."
- raw_input()
- print "[INFO] Writing..."
- create_settings("default")
- Object_Settings.append("default")
- File_Settings = open("./Bo3_BulkEdit_Settings.ini", "wb")
- File_Settings.write("### Default Settings ###\n");
- File_Settings.write("Version: 1.05\n");
- File_Settings.write("Obj_default:\n");
- File_Settings.write(" ######################\n");
- File_Settings.write(" ### Basic Settings ###\n");
- File_Settings.write(" ######################\n");
- File_Settings.write(" RemoveComments: false\n");
- File_Settings.write(" SplitObjects: true\n");
- File_Settings.write(" Description: -NONE-\n");
- File_Settings.write(" Tree: -NONE-\n");
- File_Settings.write(" Frequency: -NONE-\n");
- File_Settings.write(" Rarity: -NONE-\n");
- File_Settings.write(" RotateRandomly: -NONE-\n");
- File_Settings.write(" SpawnHeight: -NONE-\n");
- File_Settings.write(" SpawnHeightOffset: -NONE-\n");
- File_Settings.write(" SpawnHeightVariance: -NONE-\n");
- File_Settings.write(" MinHeight: -NONE-\n");
- File_Settings.write(" MaxHeight: -NONE-\n");
- File_Settings.write(" ExtrudeMode: -NONE-\n");
- File_Settings.write(" ExtrudeThroughBlocks: -NONE-\n");
- File_Settings.write(" MaxBranchDepth: -NONE-\n");
- File_Settings.write(" ExcludedBiomes: -NONE-\n");
- File_Settings.write(" SourceBlocks: -NONE-\n");
- File_Settings.write(" MaxPercentageOutsideSourceBlock: -NONE-\n");
- File_Settings.write(" OutsideSourceBlock: -NONE-\n");
- File_Settings.write(" ### Preview - BO3 Bulk Edit will generate an Object Preview ###\n");
- File_Settings.write(" Preview: false\n");
- File_Settings.write(" #################################################\n");
- File_Settings.write(" ### PlaceHolder Settings ###\n");
- File_Settings.write(" ### You may use these Settings Multiple times ###\n");
- File_Settings.write(" #################################################\n");
- File_Settings.write(" AIR_Block: SPONGE:1\n");
- File_Settings.write(" REMOVE_Block: IRON_BLOCK\n");
- File_Settings.write(" CHECK_Block: EMERALD_BLOCK\n");
- File_Settings.write(" BRANCH_Block: GOLD_BLOCK\n");
- File_Settings.write(" CENTER_Block: DIAMOND_BLOCK\n");
- File_Settings.write(" ###############################\n");
- File_Settings.write(" ### Shift Object ###\n");
- File_Settings.write(" ### Moves the Object around ###\n");
- File_Settings.write(" ###############################\n");
- File_Settings.write(" Shift_X: 0\n");
- File_Settings.write(" Shift_Y: 0\n");
- File_Settings.write(" Shift_Z: 0\n");
- File_Settings.write(" ######################################################################################################\n");
- File_Settings.write(" ### Block Changes: ###\n");
- File_Settings.write(" ### EXAMPLE: Change: Block -> RandomBlock | SMOOTH_BRICK:1 -> SMOOTH_BRICK:1,50,SMOOTH_BRICK:2,100 ###\n");
- File_Settings.write(" ######################################################################################################\n");
- File_Settings.write(" Change: Block -> RandomBlock | SMOOTH_BRICK:1 -> SMOOTH_BRICK,40,SMOOTH_BRICK:1,50,SMOOTH_BRICK:2,40,COBBLESTONE,100\n");
- File_Settings.close()
- print "[INFO] Done."
- #############################
- #### Process Objects ####
- #############################
- if debug == "true":
- for line in debug_msg:
- print "[DEBUG] " + line
- del debug_msg[:]
- raw_input()
- if error == "false":
- print "[INFO] Reading Objects, ..."
- Processed_Blocks = 0
- Processed_Objects = 0
- Processed_Remove = 0
- Processed_Checks = 0
- Processed_Branches = 0
- BlockChecks = []
- Branches = []
- Object_Blocks = {}
- temp_file = []
- Object_Files = glob.glob('.\Objects\*.bo3')
- Object_Files.extend(glob.glob('.\Objects\*.schematic'))
- Object_Files.extend(glob.glob('.\Objects\*.bo2'))
- for object in Object_Files:
- ### - Getting Object Name and Type - ###
- Use_Settings = "default"
- object_name = object[10:]
- debug_msg.append("Starting Object: "+ object_name +".")
- Is_Schematic = False
- Is_BO2 = False
- if ".schematic".lower() in object_name.lower():
- object_name = object_name[:object_name.find(".",0)]+".bo3"
- debug_msg.append("Dropping '.schematic' Extension.")
- Is_Schematic = True
- if ".bo2".lower() in object_name.lower():
- object_name = object_name[:object_name.find(".",0)]+".bo3"
- debug_msg.append("Dropping '.bo2' Extension.")
- Is_BO2 = True
- if "we-" in object_name[0:3]:
- object_name = object_name[3:]
- debug_msg.append("Dropping 'we-' prefix.")
- if "Obj-" in object_name[0:4]:
- Use_Settings = object_name[4:object_name.find("_",0)]
- debug_msg.append("Attempting to use Settings:[" + Use_Settings + "]")
- if Use_Settings not in Object_Settings:
- debug_msg.append("Settings dont Exist:[" + Use_Settings + "]")
- print "[WARN] Settings for '" + Use_Settings + "' are not set. Using default"
- Use_Settings = "default"
- object_name = object_name[object_name.find("_",0)+1:]
- ############################
- ### List Object Settings ###
- ############################
- if Object_Desc[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [Description: " + Object_Desc[Use_Settings] + "]")
- if Object_Tree[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [Tree: " + Object_Tree[Use_Settings] + "]")
- if Object_Freq[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [Frequency: " + Object_Freq[Use_Settings] + "]")
- if Object_Rare[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [Rarity: " + Object_Rare[Use_Settings] + "]")
- if Object_Rot[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [RotateRandomly: " + Object_Rot[Use_Settings] + "]")
- if Object_Spawn[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [SpawnHeight: " + Object_Spawn[Use_Settings] + "]")
- if Object_Offset[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [SpawnHeightOffset: " + Object_Offset[Use_Settings] + "]")
- if Object_Var[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [SpawnHeightVariance: " + Object_Var[Use_Settings] + "]")
- if Object_Min[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [MinHeight: " + Object_Min[Use_Settings] + "]")
- if Object_Max[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [MaxHeight: " + Object_Max[Use_Settings] + "]")
- if Object_Ext[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [ExtrudeMode: " + Object_Ext[Use_Settings] + "]")
- if Object_ExtBlocks[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [ExtrudeThroughBlocks: " + Object_ExtBlocks[Use_Settings] + "]")
- if Object_Branches[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [MaxBranchDepth: " + Object_Branches[Use_Settings] + "]")
- if Object_Biomes[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [ExcludedBiomes: " + Object_Biomes[Use_Settings] + "]")
- if Object_SourceBlocks[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [SourceBlocks: " + Object_SourceBlocks[Use_Settings] + "]")
- if Object_SourcePercent[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [MaxPercentageOutsideSourceBlock: " + Object_SourcePercent[Use_Settings] + "]")
- if Object_SourcePlacement[Use_Settings] != "-NONE-":
- debug_msg.append("Adjusting Setting: [OutsideSourceBlock: " + Object_SourcePlacement[Use_Settings] + "]")
- ############################
- ############################
- ############################
- debug_msg.append("Object will be saved as:[" + object_name + "]")
- ### - Processing of Object - ###
- print "[INFO] Object: " + object_name
- with open(object, 'r') as object_file, open("./Results/" + object_name, 'wb') as new_object:
- ### - First Read Through for Center Blocks - ###
- progress_time_first = False
- del temp_file[:]
- del BlockChecks[:]
- del Branches[:]
- Processed_Objects += 1
- bo2_lines = 0
- Object_DimX0 = 0
- Object_DimX1 = 0
- Object_DimY0 = 0
- Object_DimY1 = 0
- Object_DimZ0 = 0
- Object_DimZ1 = 0
- Obj_Block_amt = 0
- Shift_X = int(Object_Shift_X[Use_Settings])
- Shift_Y = int(Object_Shift_Y[Use_Settings])
- Shift_Z = int(Object_Shift_Z[Use_Settings])
- if debug == "true":
- i = 0
- while i <= Change_Operation[Use_Settings]:
- address = Use_Settings + "_" + str(i)
- debug_msg.append("Using these BlockChange Settings:")
- debug_msg.append("[" + str(i) + "] " + Change_Type[address] + " -> " + Change_Type_To[address] + " | " + Change_Block[address] + " -> " + Change_Block_To[address] + "")
- i += 1
- for line in debug_msg:
- print "[DEBUG] " + line
- del debug_msg[:]
- raw_input()
- if Is_BO2 == True:
- debug_msg.append("Converting BO2 Object for use.")
- temp_file = temp_file + DefaultObject_Start()
- BO2_Data = False
- progress_time = time.time()
- for line in object_file:
- busy_progress()
- bo2_lines += 1
- line = line.strip('\n')
- BO2_Blocks = True
- if "=" in line:
- BO2_Blocks = False
- if "spawnOnBlockType=" in line:
- SpawnOnBlocks = str(line[line.find("=",0)+1:]).split(",")
- SpawnOnBlock = ""
- for sourceblock in SpawnOnBlocks:
- try:
- sourceblock = str(BulkeEdit_Materials[str(sourceblock)])
- except:
- sourceblock = str(sourceblock)
- print '[WARN] Material: "' +sourceblock+ '" is not regocnized. Will not be Changed.'
- if str(sourceblock) not in Missing_ID_List:
- Missing_ID_List.append(str(sourceblock))
- if object_name not in debug_faulty:
- debug_faulty.append(object_name + "(BO2 Conversion)")
- if SpawnOnBlock != "":
- SpawnOnBlock += "," + sourceblock
- else:
- SpawnOnBlock = sourceblock
- debug_msg.append("" + SpawnOnBlock +" is found as BlockCheck")
- BlockChecks.append("BlockCheck(0,-1,0," + SpawnOnBlock + ")\n")
- if "tree=" in line:
- BO2_Tree = str(line[line.find("=",0)+1:])
- debug_msg.append("Relevant Setting found: tree=" + BO2_Tree +"")
- if "randomRotation=" in line:
- BO2_Rotate = str(line[line.find("=",0)+1:])
- debug_msg.append("Relevant Setting found: randomRotation=" + BO2_Rotate +"")
- if "rarity=" in line:
- BO2_Rarity = str(line[line.find("=",0)+1:])
- debug_msg.append("Relevant Setting found: rarity=" + BO2_Rarity +"")
- if "collisionPercentage=" in line:
- BO2_Collision = str(line[line.find("=",0)+1:])
- debug_msg.append("Relevant Setting found: collisionPercentage=" + BO2_Collision +"")
- if "spawnElevationMin=" in line:
- BO2_YMin = str(line[line.find("=",0)+1:])
- debug_msg.append("Relevant Setting found: spawnElevationMin=" + BO2_YMin +"")
- if "spawnElevationMax=" in line:
- BO2_YMax = str(line[line.find("=",0)+1:])
- debug_msg.append("Relevant Setting found: spawnElevationMax=" + BO2_YMax +"")
- if "[DATA]" in line:
- BO2_Data = True
- BO2_Blocks = False
- debug_msg.append("Relevant Setting found: [Data] Starting to Collect Blocks")
- if BO2_Data == True and BO2_Blocks == True and "," in line and ":" in line:
- x = line[:find_nth(line, ",", 1)]
- z = line[find_nth(line, ",", 1)+1:find_nth(line, ",", 2)]
- y = line[find_nth(line, ",", 2)+1:find_nth(line, ":", 1)]
- if "." in line:
- process_block_a = line[find_nth(line, ":", 1)+1:find_nth(line, ".", 1)]
- process_block_b = line[find_nth(line, ".", 1)+1:]
- else:
- process_block_a = line[find_nth(line, ":", 1)+1:]
- process_block_b = ""
- try:
- process_block = str(BulkeEdit_Materials[str(process_block_a)])
- except:
- process_block = str(process_block_a)
- if str(process_block_a) not in Missing_ID_List:
- print '[WARN] Material: "' +process_block_a+ '" is not regocnized. Will not be Changed.'
- Missing_ID_List.append(str(process_block_a))
- if object_name not in debug_faulty:
- debug_faulty.append(object_name + "(Missing Blocknames)")
- if str(process_block_a) != "0" and process_block_b != "":
- process_block = process_block +":"+ str(process_block_b)
- else:
- process_block = process_block
- newline = "Block("+str(x)+","+str(y)+","+str(z)+","+str(process_block)+")"
- debug_msg.append("Add Block: " + newline +"")
- temp_file.append(newline)
- temp_file = temp_file + DefaultObject_End()
- #del object_file[:]
- object_file = temp_file[:]
- del temp_file[:]
- if Is_Schematic == False:
- debug_msg.append("File is Object -> Object Processing")
- progress_time = time.time()
- for line in object_file:
- busy_progress()
- if any(x in line for x in ["Block(","RandomBlock(","MinecraftObject(","B(","RB(","block(","randomblock(","minecraftobject(","b(","rb("]):
- process_type = line[:line.find("(",0)]
- x = line[find_nth(line, "(", 1)+1:find_nth(line, ",", 1)]
- y = line[find_nth(line, ",", 1)+1:find_nth(line, ",", 2)]
- z = line[find_nth(line, ",", 2)+1:find_nth(line, ",", 3)]
- process_block = line[find_nth(line, ",", 3)+1:find_nth(line, ")", 1)]
- if process_type == "Block" and process_block in PlaceHolder_Center[Use_Settings]:
- Shift_X -= int(x)
- Shift_Y -= int(y)
- Shift_Z -= int(z)
- debug_msg.append("Adjusting Object: [" + str(Shift_X) + "," + str(Shift_Y) + "," + str(Shift_Z) + "]")
- temp_file.append(line)
- else:
- debug_msg.append("File is Schematic -> Schematic Processing")
- temp_file = temp_file + DefaultObject_Start()
- Object_Schematic = nbt.NBTFile(object)
- debug_msg.append("Opening Schematic")
- Schematic_Height = int(Object_Schematic['Height'].value)
- debug_msg.append("Schematic Height:" + str(Schematic_Height))
- Schematic_Length = int(Object_Schematic['Length'].value)
- debug_msg.append("Schematic Length:" + str(Schematic_Length))
- Schematic_Width = int(Object_Schematic['Width'].value)
- debug_msg.append("Schematic Width:" + str(Schematic_Width))
- moddedblocks = True
- try:
- Schematic_Blocks_B = bytearray(Object_Schematic['AddBlocks'])
- Schematic_Blocks = Object_Schematic['Blocks']
- Schematic_Data = Object_Schematic['Data']
- except:
- Schematic_Blocks = Object_Schematic['Blocks']
- Schematic_Data = Object_Schematic['Data']
- moddedblocks = False
- #####################
- ### Read NBT Data ###
- #####################
- try:
- NBT_Blocks = Object_Schematic['TileEntities']
- NBT_strings = {}
- NBT_strings_list = []
- NBT_name = {}
- for Block in NBT_Blocks:
- try:
- nbt_placement = str(Block["x"].value)+","+str(Block["y"].value)+","+str(Block["z"].value)
- NBT_Block_temp, NBT_string_temp, NBT_name_temp = iterate_nbt(Block)
- #print NBT_name_temp+":"+NBT_string_temp
- #print NBT_strings
- if NBT_string_temp != "{}" and NBT_name_temp not in BlackList_NBT:
- if NBT_name_temp+":"+NBT_string_temp in NBT_strings_list:
- NBT_name[nbt_placement] = list(NBT_strings.keys())[list(NBT_strings.values()).index(NBT_name_temp+":"+NBT_string_temp)]
- else:
- number = 0
- while True:
- if NBT_name_temp+"_"+str(number) in NBT_strings.keys():
- number += 1
- else:
- NBT_strings[NBT_name_temp+"_"+str(number)] = NBT_name_temp+":"+NBT_string_temp
- NBT_strings_list.append(NBT_name_temp+":"+NBT_string_temp)
- NBT_Block_temp.write_file("./Results/NBT/"+NBT_name_temp+"_"+str(number)+".nbt")
- NBT_name[nbt_placement] = str(NBT_name_temp+"_"+str(number))
- break
- except:
- debug_msg.append("Error Reading Specific Block NBT Data")
- except:
- debug_msg.append("Error Reading Block NBT Data")
- if debug == "true":
- for line in debug_msg:
- print "[DEBUG] " + line
- del debug_msg[:]
- raw_input()
- #####################
- ### Read Entity Data ###
- #####################
- #try:
- Entity_List = []
- del Entity_List[:]
- NBT_Entity = Object_Schematic['Entities']
- NBT_strings = {}
- NBT_strings_list = []
- NBT_Entity_name = {}
- for Entity in NBT_Entity:
- #try:
- entity_temp_x = int(str(Entity["Pos"][0])[:str(Entity["Pos"][0]).find(".",0)]) - int(str(Object_Schematic['WEOriginX']))
- entity_temp_y = int(str(Entity["Pos"][1])[:str(Entity["Pos"][1]).find(".",0)]) - int(str(Object_Schematic['WEOriginY']))
- entity_temp_z = int(str(Entity["Pos"][2])[:str(Entity["Pos"][2]).find(".",0)]) - int(str(Object_Schematic['WEOriginZ'])) - 1
- nbt_placement = str(entity_temp_x)+","+str(entity_temp_y)+","+str(entity_temp_z)
- NBT_Block_temp, NBT_string_temp, NBT_name_temp = iterate_nbt(Entity)
- #print NBT_name_temp+":"+NBT_string_temp
- #print NBT_strings
- if NBT_string_temp != "{}" and NBT_name_temp not in Blacklist_Entity:
- if NBT_name_temp+":"+NBT_string_temp in NBT_strings_list:
- NBT_Entity_name[nbt_placement] = list(NBT_strings.keys())[list(NBT_strings.values()).index(NBT_name_temp+":"+NBT_string_temp)]
- else:
- number = 0
- while True:
- if NBT_name_temp+"_"+str(number) in NBT_strings.keys():
- number += 1
- else:
- NBT_strings[NBT_name_temp+"_"+str(number)] = NBT_name_temp+":"+NBT_string_temp
- NBT_strings_list.append(NBT_name_temp+":"+NBT_string_temp)
- nbt_file = open("./Results/NBT/"+NBT_name_temp+"_"+str(number)+".txt", "wb")
- nbt_file.write(NBT_string_temp);
- nbt_file.close()
- NBT_Block_temp.write_file("./Results/NBT/"+NBT_name_temp+"_"+str(number)+".nbt")
- NBT_Entity_name[nbt_placement] = str(NBT_name_temp+"_"+str(number))
- break
- Entity_List.append(nbt_placement+","+str(Entity["id"].value)[str(Entity["id"]).find(":",0)+1:]+",1,./NBT/"+str(NBT_name_temp+"_"+str(number))+".txt")
- #except:
- # debug_msg.append("Error Reading Specific Entity NBT Data")
- #except:
- # debug_msg.append("Error Reading Entity NBT Data")
- if debug == "true":
- for line in debug_msg:
- print "[DEBUG] " + line
- del debug_msg[:]
- raw_input()
- #Schematic_Blocks = Schematic_Blocks.split(" ")
- #Schematic_Data = Schematic_Blocks.split(" ")
- x = 0
- y = 0
- z = 0
- byte_pos_A = 0
- byte_pos_B = 0
- process_ID = 0
- progress_time = time.time()
- tmp_conversion_centerfound = False
- for Schematic_Block in Schematic_Blocks:
- busy_progress()
- if moddedblocks == True:
- byte_pos_hl = int(byte_pos_A%2)
- if byte_pos_A > 0:
- byte_pos_B = int(byte_pos_A/2)
- high, low = Schematic_Blocks_B[byte_pos_B] >> 4, Schematic_Blocks_B[byte_pos_B] & 0x0F
- if byte_pos_hl == 0:
- Schematic_Block = int(Schematic_Block + (low << 8))
- if byte_pos_hl == 1:
- Schematic_Block = int(Schematic_Block + (high << 8))
- byte_pos_A = byte_pos_A + 1
- try:
- process_block = str(BulkeEdit_Materials[str(Schematic_Block)])
- except:
- process_block = str(Schematic_Block)
- if str(Schematic_Block) not in Missing_ID_List:
- print '[WARN] Material: "' +str(Schematic_Block)+ '" is not regocnized. Will not be Changed.'
- Missing_ID_List.append(str(Schematic_Block))
- if object_name + "(Missing Blocknames)" not in debug_faulty:
- debug_faulty.append(object_name + "(Missing Blocknames)")
- if str(Schematic_Data[process_ID]) != "0":
- process_block = process_block +":"+ str(Schematic_Data[process_ID])
- else:
- process_block = process_block +":"+ str(Schematic_Data[process_ID])
- if x > Schematic_Width - 1:
- z += 1
- x = 0
- if z > Schematic_Length - 1:
- y += 1
- z = 0
- if process_block in PlaceHolder_Center[Use_Settings]:
- print "Center Found"
- tmp_conversion_centerfound = True
- Shift_X -= int(x)
- Shift_Y -= int(y)
- Shift_Z -= int(z)
- debug_msg.append("Adjusting Object: [" + str(Shift_X) + "," + str(Shift_Y) + "," + str(Shift_Z) + "]")
- #### Add NBT ####
- if process_block not in BlackList_NBT:
- try:
- process_block = process_block+",./NBT/"+NBT_name[str(x)+","+str(y)+","+str(z)]+".nbt"
- except:
- process_block = process_block
- line = "Block("+str(x)+","+str(y)+","+str(z)+","+str(process_block)+")"
- debug_msg.append(line)
- x += 1
- process_ID += 1
- temp_file.append(line)
- for Entity in Entity_List:
- temp_file.append("Entity("+Entity+")")
- if tmp_conversion_centerfound == False:
- Shift_X -= 0 + int(Schematic_Width/2)
- Shift_Y -= 0
- Shift_Z -= 0 + int(Schematic_Length/2)
- temp_file = temp_file + DefaultObject_End()
- cursor = "settings"
- branches_written = "false"
- checks_written = "false"
- if debug == "true":
- for line in debug_msg:
- print "[DEBUG] " + line
- del debug_msg[:]
- raw_input()
- progress_time = time.time()
- for line in temp_file:
- busy_progress()
- ### - Modify Object - ###
- line = line.strip('\n')
- skip = "false"
- if "#" in line[0:1] and Object_Comments[Use_Settings] == "true":
- ### - Removing Comments - ###
- skip = "true"
- debug_msg.append("Removing Comment: [" + line + "]")
- if line == "" and Object_Comments[Use_Settings] == "true":
- skip = "true"
- if "#" not in line[0:1]:
- ###################################
- ### - Chaning Settings to BO3 - ###
- ###################################
- if Is_BO2 == True:
- try:
- if "Rarity:" in line[0:30]:
- line = "Rarity: " + BO2_Rarity
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "RotateRandomly:" in line[0:30]:
- line = "RotateRandomly: " + BO2_Rotate
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "MinHeight:" in line[0:30]:
- line = "MinHeight: " + BO2_YMin
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "MaxHeight:" in line[0:30]:
- line = "MaxHeight: " + BO2_YMax
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "MaxPercentageOutsideSourceBlock:" in line[0:56]:
- line = "MaxPercentageOutsideSourceBlock: " + BO2_Collision
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "Tree:" in line[0:30] and Object_Tree[Use_Settings] != "-NONE-":
- line = "Tree: " + BO2_Tree
- debug_msg.append("Adjusting Setting: [" + line + "]")
- except:
- print '[WARN] There was an Error with your BO2 settings.'
- if object_name not in debug_faulty:
- debug_faulty.append(object_name + "(BO2 Conversion)")
- if "Description:" in line[0:30] and Object_Desc[Use_Settings] != "-NONE-":
- line = "Description: " + Object_Desc[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "Tree:" in line[0:30] and Object_Tree[Use_Settings] != "-NONE-":
- line = "Tree: " + Object_Tree[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "Frequency:" in line[0:30] and Object_Freq[Use_Settings] != "-NONE-":
- line = "Frequency: " + Object_Freq[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "Rarity:" in line[0:30] and Object_Rare[Use_Settings] != "-NONE-":
- line = "Rarity: " + Object_Rare[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "RotateRandomly:" in line[0:30] and Object_Rot[Use_Settings] != "-NONE-":
- line = "RotateRandomly: " + Object_Rot[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "SpawnHeight:" in line[0:30] and Object_Spawn[Use_Settings] != "-NONE-":
- line = "SpawnHeight: " + Object_Spawn[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "SpawnHeightOffset:" in line[0:30] and Object_Offset[Use_Settings] != "-NONE-":
- line = "SpawnHeightOffset: " + Object_Offset[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "SpawnHeightVariance:" in line[0:30] and Object_Var[Use_Settings] != "-NONE-":
- line = "SpawnHeightVariance: " + Object_Var[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "MinHeight:" in line[0:30] and Object_Min[Use_Settings] != "-NONE-":
- line = "MinHeight: " + Object_Min[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "MaxHeight:" in line[0:30] and Object_Max[Use_Settings] != "-NONE-":
- line = "MaxHeight: " + Object_Max[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "ExtrudeMode:" in line[0:30] and Object_Ext[Use_Settings] != "-NONE-":
- line = "ExtrudeMode: " + Object_Ext[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "ExtrudeThroughBlocks:" in line[0:30] and Object_ExtBlocks[Use_Settings] != "-NONE-":
- line = "ExtrudeThroughBlocks: " + Object_ExtBlocks[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "MaxBranchDepth:" in line[0:30] and Object_Branches[Use_Settings] != "-NONE-":
- line = "MaxBranchDepth: " + Object_Branches[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "ExcludedBiomes:" in line[0:30] and Object_Biomes[Use_Settings] != "-NONE-":
- line = "ExcludedBiomes: " + Object_Biomes[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "SourceBlocks:" in line[0:30] and Object_SourceBlocks[Use_Settings] != "-NONE-":
- line = "SourceBlocks: " + Object_SourceBlocks[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "MaxPercentageOutsideSourceBlock:" in line[0:56] and Object_SourcePercent[Use_Settings] != "-NONE-":
- line = "MaxPercentageOutsideSourceBlock: " + Object_SourcePercent[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- if "OutsideSourceBlock:" in line[0:30] and Object_SourcePlacement[Use_Settings] != "-NONE-":
- line = "OutsideSourceBlock: " + Object_SourcePlacement[Use_Settings]
- debug_msg.append("Adjusting Setting: [" + line + "]")
- ###############################
- ### - Chaning Blocks here - ###
- ###############################
- #if any(x in line for x in ["Block(","RandomBlock(","MinecraftObject(","Entity(","B(","RB(","block(","randomblock(","minecraftobject(","b(","rb(","entity(", "E", "e", "mco", "MCO"]):
- if line.startswith(tuple(naming_list)):
- Processed_Blocks += 1
- cursor = "blocks"
- process_type = line[:line.find("(",0)]
- x = int(line[find_nth(line, "(", 1)+1:find_nth(line, ",", 1)]) + Shift_X
- y = int(line[find_nth(line, ",", 1)+1:find_nth(line, ",", 2)]) + Shift_Y
- z = int(line[find_nth(line, ",", 2)+1:find_nth(line, ",", 3)]) + Shift_Z
- process_block = line[find_nth(line, ",", 3)+1:find_nth(line, ")", 1)]
- if process_type == "Block":
- if process_block in PlaceHolder_Remove[Use_Settings]:
- Processed_Remove += 1
- skip = "true"
- if process_block in PlaceHolder_Air[Use_Settings]: process_block = "AIR"
- if process_block in PlaceHolder_Center[Use_Settings]: skip = "true"
- if process_block in PlaceHolder_Check[Use_Settings]:
- Processed_Checks += 1
- BlockChecks.append("BlockCheck("+str(x)+","+str(y)+","+str(z)+",Solid)\n")
- skip = "true"
- if process_block in PlaceHolder_Branch[Use_Settings]:
- Processed_Branches += 1
- Branches.append("Branch("+str(x)+","+str(y)+","+str(z)+",<Branch>,NORTH,100)\n")
- skip = "true"
- i = 0
- Entity_Placement = False
- while i <= Change_Operation[Use_Settings]:
- address = Use_Settings + "_" + str(i)
- i += 1
- short_type = "false"
- if process_type == "B" or process_type == "b":
- process_type = "Block"
- short_type = "true"
- if process_type == "RB" or process_type == "rb":
- process_type = "RandomBlock"
- short_type = "true"
- if Change_Type[address] == process_type:
- if Change_Block[address] == process_block or Change_Block[address]+":0" == process_block:
- process_type = Change_Type_To[address]
- process_block = Change_Block_To[address]
- if Change_Type_To[address] == "Entity":
- Entity_Placement = True
- if short_type == "true":
- if process_type == "Block" or process_type == "block":
- process_type = "B"
- if process_type == "RandomBlock" or process_type == "randomblock":
- process_type = "RB"
- if Entity_Placement == True:
- line = "Block" + "("+str(x)+","+str(y)+","+str(z)+","+ "AIR" +")\n"+ process_type + "("+str(x)+","+str(y)+","+str(z)+","+ process_block +")"
- else:
- line = process_type + "("+str(x)+","+str(y)+","+str(z)+","+ process_block +")"
- coords = str(x) + "," + str(y) + "," + str(z)
- if Object_DimX0 > x: Object_DimX0 = x
- if Object_DimX1 < x: Object_DimX1 = x
- if Object_DimY0 > y: Object_DimY0 = y
- if Object_DimY1 < y: Object_DimY1 = y
- if Object_DimZ0 > z: Object_DimZ0 = z
- if Object_DimZ1 < z: Object_DimZ1 = z
- if any(x in line for x in ["Block(","RandomBlock(","B(","RB(","block(","randomblock(","b(","rb("]) and skip == "false":
- if "," in process_block:
- Object_Blocks[coords] = process_block[0:process_block.find(",",0)]
- else:
- Object_Blocks[coords] = process_block
- if skip != "true": Obj_Block_amt +=1
- if cursor == "checks" and any(x in line for x in ["BlockCheckNot(","LightCheck(","BlockCheck("]):
- process_type = line[:line.find("(",0)]
- x = int(line[find_nth(line, "(", 1)+1:find_nth(line, ",", 1)]) + Shift_X
- y = int(line[find_nth(line, ",", 1)+1:find_nth(line, ",", 2)]) + Shift_Y
- z = int(line[find_nth(line, ",", 2)+1:find_nth(line, ",", 3)]) + Shift_Z
- process_block = line[find_nth(line, ",", 3)+1:find_nth(line, ")", 1)]
- line = process_type + "("+str(x)+","+str(y)+","+str(z)+","+ process_block +")"
- if cursor == "checks" and any(x not in line for x in ["BlockCheckNot(","LightCheck(","BlockCheck("]):
- for check in BlockChecks:
- line += check
- debug_msg.append(check)
- checks_written = "true"
- if cursor == "branches" and any(x in line for x in ["Branch(","WeightedBranch("]):
- process_type = line[:line.find("(",0)]
- x = int(line[find_nth(line, "(", 1)+1:find_nth(line, ",", 1)]) + Shift_X
- y = int(line[find_nth(line, ",", 1)+1:find_nth(line, ",", 2)]) + Shift_Y
- z = int(line[find_nth(line, ",", 2)+1:find_nth(line, ",", 3)]) + Shift_Z
- process_block = line[find_nth(line, ",", 3)+1:find_nth(line, ")", 1)]
- line = process_type + "("+str(x)+","+str(y)+","+str(z)+","+ process_block +")"
- if cursor == "branches" and any(x not in line for x in ["Branch(","WeightedBranch("]):
- for branch in Branches:
- line += branch
- debug_msg.append(branch)
- branches_written = "true"
- if cursor == "checks" and any(x not in line for x in ["Block(","RandomBlock(","MinecraftObject(","BlockCheckNot(","LightCheck(","BlockCheck(","B(","RB(","block(","randomblock(","b(","rb("]) and Object_Comments[Use_Settings] == "true" and skip == "false":
- cursor = "branches"
- #line += "\n"
- if cursor == "blocks" and any(x not in line for x in ["Block(","RandomBlock(","MinecraftObject(","minecraftobject(","B(","RB(","block(","randomblock(","b(","rb("]) and Object_Comments[Use_Settings] == "true" and skip == "false":
- cursor = "checks"
- #line += "\n"
- if "# LightCheck(0,0,0,0,1) Require almost complete darkness just below the object" in line[0:1] and Object_Comments[Use_Settings] != "true":
- cursor = "checks"
- if "# MaxChanceOutOf - The chance all branches have to spawn out of, assumed to be 100 when left blank" in line[0:1] and Object_Comments[Use_Settings] != "true":
- cursor = "branches"
- if skip == "false":
- new_object.write(line + "\n");
- if checks_written == "false":
- for check in BlockChecks:
- line = check
- debug_msg.append(check)
- new_object.write(line);
- if branches_written == "false":
- for branch in Branches:
- line = branch
- debug_msg.append(branch)
- new_object.write(line);
- print "[INFO] Done: " + object_name + " with [" + str(Obj_Block_amt) + "] Blocks"
- if debug == "true":
- for line in debug_msg:
- print "[DEBUG] " + line
- del debug_msg[:]
- raw_input()
- new_object.close()
- #############################
- #### - Split up Object - ####
- #############################
- object_will_split = "False"
- try:
- object_split_size = int(Object_SplitSize[Use_Settings] / 2)
- except:
- object_split_size = 8
- print object_split_size
- print "I dont have a Valid Setting here"
- object_region.clear()
- del branchspace[:]
- object_region_size_x = 0
- object_region_size_z = 0
- object_region_center_x = 0
- object_region_center_z = 0
- if Object_DimX1 > -1 + object_split_size:
- object_will_split = "True"
- if Object_DimX0 < 0 - object_split_size:
- object_will_split = "True"
- if Object_DimZ1 > -1 + object_split_size:
- object_will_split = "True"
- if Object_DimZ0 < 0 - object_split_size:
- object_will_split = "True"
- if Object_Splits[Use_Settings] == "true":
- if object_will_split == "True":
- print "[INFO] Object: " + object_name + " will be Split into a Structure"
- debug_msg.append("Calculating Object Size")
- tmp = Object_DimX1
- while tmp > -1 + object_split_size:
- object_region_size_x += 1
- tmp -= object_split_size * 2
- tmp = Object_DimZ1
- while tmp > -1 + object_split_size:
- object_region_size_z += 1
- tmp -= object_split_size * 2
- tmp = Object_DimX0
- while tmp < 0 - object_split_size:
- object_region_size_x += 1
- object_region_center_x += 1
- tmp += object_split_size * 2
- tmp = Object_DimZ0
- while tmp < 0 - object_split_size:
- object_region_size_z += 1
- object_region_center_z += 1
- tmp += object_split_size * 2
- debug_msg.append("Structure will be: [" + str(object_region_size_x+1) + "x" + str(object_region_size_z+1) + "] in size.")
- if debug == "true":
- for line in debug_msg:
- print "[DEBUG] " + line
- del debug_msg[:]
- raw_input()
- debug_msg.append("Generate Object Index")
- counter_x = 0
- counter_z = 0
- while counter_z <= object_region_size_z:
- counter_x = 0
- if counter_z < 10:
- index_z = str("0" + str(counter_z))
- else:
- index_z = str(counter_z)
- while counter_x <= object_region_size_x:
- if counter_x < 10:
- index_x = str("0" + str(counter_x))
- else:
- index_x = str(counter_x)
- object_region[str(index_x) + "_" + str(index_z)] = []
- object_region[str(index_x) + "_" + str(index_z)] += DefaultObject_Start()
- if debug == "true":
- for line in debug_msg:
- print "[DEBUG] " + line
- del debug_msg[:]
- counter_x += 1
- counter_z += 1
- debug_msg.append("Reading Object")
- if debug == "true":
- for line in debug_msg:
- print "[DEBUG] " + line
- del debug_msg[:]
- structure_whole = open("./Results/" + object_name, 'r')
- structure_main = []
- for line in structure_whole.readlines():
- if line.startswith(tuple(naming_list)):
- process_type = line[:line.find("(",0)]
- x = int(line[find_nth(line, "(", 1)+1:find_nth(line, ",", 1)])
- y = int(line[find_nth(line, ",", 1)+1:find_nth(line, ",", 2)])
- z = int(line[find_nth(line, ",", 2)+1:find_nth(line, ",", 3)])
- process_block = line[find_nth(line, ",", 3)+1:find_nth(line, ")", 1)]
- coords_x = object_region_center_x
- coords_z = object_region_center_z
- while x < (0 - object_split_size) or x > (-1 + object_split_size):
- if x < (0 - object_split_size):
- x += object_split_size*2
- coords_x -= 1
- if x > (-1 + object_split_size):
- x -= object_split_size*2
- coords_x += 1
- while z < (0 - object_split_size) or z > (-1 + object_split_size):
- if z < (0 - object_split_size):
- z += object_split_size*2
- coords_z -= 1
- if z > (-1 + object_split_size):
- z -= object_split_size*2
- coords_z += 1
- if coords_x < 10:
- index_x = str("0" + str(coords_x))
- else:
- index_x = str(coords_x)
- if coords_z < 10:
- index_z = str("0" + str(coords_z))
- else:
- index_z = str(coords_z)
- line = process_type + "("+str(x+object_split_size)+","+str(y)+","+str(z+object_split_size)+","+ process_block +")"
- object_region[str(index_x) + "_" + str(index_z)].append(line)
- else:
- structure_main.append(line)
- ### Creating Objects ###
- debug_msg.append("Generating Object")
- if debug == "true":
- for line in debug_msg:
- print "[DEBUG] " + line
- del debug_msg[:]
- object = object_name[:object_name.find(".",0)]
- structure_whole.close();
- process_x = object_region_center_x
- while process_x >= 0:
- process_z = object_region_center_z
- if not indexstring(process_x-1) + "-" + str(indexstring(process_z)) in branchspace and process_x > 0:
- line = "Branch(" + str(0 - object_split_size*2) + ",0,0,"+ object +"_" + indexstring(process_x-1) + "-" + str(indexstring(process_z)) + ",NORTH,100)"
- object_region[str(indexstring(process_x)) + "_" + str(indexstring(process_z))].append(line)
- branchspace.append(indexstring(process_x-1) + "-" + str(indexstring(process_z)))
- while process_z > 0:
- if not indexstring(process_x) + "-" + str(indexstring(process_z-1)) in branchspace:
- line = "Branch(0,0," + str(0 - object_split_size*2) + ","+ object +"_" + indexstring(process_x) + "-" + str(indexstring(process_z-1)) + ",NORTH,100)"
- object_region[str(indexstring(process_x)) + "_" + str(indexstring(process_z))].append(line)
- branchspace.append(indexstring(process_x) + "-" + str(indexstring(process_z-1)))
- process_z -= 1
- process_z = object_region_center_z
- while process_z < object_region_size_z:
- if not indexstring(process_x) + "-" + str(indexstring(process_z+1)) in branchspace:
- line = "Branch(0,0," + str(0 + object_split_size*2) + ","+ object +"_" + indexstring(process_x) + "-" + str(indexstring(process_z+1)) + ",NORTH,100)"
- object_region[str(indexstring(process_x)) + "_" + str(indexstring(process_z))].append(line)
- branchspace.append(indexstring(process_x) + "-" + str(indexstring(process_z+1)))
- process_z += 1
- process_x -=1
- process_x = object_region_center_x
- while process_x <= object_region_size_x:
- process_z = object_region_center_z
- if not indexstring(process_x+1) + "-" + str(indexstring(process_z)) in branchspace and process_x < object_region_size_x:
- line = "Branch(" + str(0 + object_split_size*2) + ",0,0,"+ object +"_" + indexstring(process_x+1) + "-" + str(indexstring(process_z)) + ",NORTH,100)"
- object_region[str(indexstring(process_x)) + "_" + str(indexstring(process_z))].append(line)
- branchspace.append(indexstring(process_x+1) + "-" + str(indexstring(process_z)))
- while process_z > 0:
- if not indexstring(process_x) + "-" + str(indexstring(process_z-1)) in branchspace:
- line = "Branch(0,0," + str(0 - object_split_size*2) + ","+ object +"_" + indexstring(process_x) + "-" + str(indexstring(process_z-1)) + ",NORTH,100)"
- object_region[str(indexstring(process_x)) + "_" + str(indexstring(process_z))].append(line)
- branchspace.append(indexstring(process_x) + "-" + str(indexstring(process_z-1)))
- process_z -= 1
- process_z = object_region_center_z
- while process_z < object_region_size_z:
- if not indexstring(process_x) + "-" + str(indexstring(process_z+1)) in branchspace:
- line = "Branch(0,0," + str(0 + object_split_size*2) + ","+ object +"_" + indexstring(process_x) + "-" + str(indexstring(process_z+1)) + ",NORTH,100)"
- object_region[str(indexstring(process_x)) + "_" + str(indexstring(process_z))].append(line)
- branchspace.append(indexstring(process_x) + "-" + str(indexstring(process_z+1)))
- process_z += 1
- process_x +=1
- count_x = 0
- count_z = 0
- debug_msg.append("Creating Files")
- if debug == "true":
- for line in debug_msg:
- print "[DEBUG] " + line
- del debug_msg[:]
- count_z = 0
- while count_z <= object_region_size_z:
- count_x = 0
- while count_x <= object_region_size_x:
- if not os.path.exists("./Results/"+ object +"/"):
- try:
- os.mkdir("./Results/"+ object +"/")
- except:
- error = "true"
- print "[--!Error!--] I could not Create a Neccessary Folder."
- new_file = open("./Results/"+ object +"/" + object + "_" + indexstring(count_x) + "-" + str(indexstring(count_z)) + ".bo3" , 'wb')
- debug_msg.append("File:" + object + "_" + indexstring(count_x) + "-" + str(indexstring(count_z)) + ".bo3")
- for line in object_region[str(indexstring(count_x)) + "_" + str(indexstring(count_z))]:
- new_file.write(line+"\n");
- new_file.close();
- count_x +=1
- count_z +=1
- new_file = open("./Results/" + object + ".bo3" , 'wb')
- structure_main.append("\nBranch(0,0,0,"+ object +"_" + indexstring(object_region_center_x) + "-" + str(indexstring(object_region_center_z)) + ",NORTH,100)")
- for line in structure_main:
- new_file.write(line);
- new_file.close();
- print "[INFO] "+ object_name + " was split into: " + str((object_region_size_x+1)*(object_region_size_z+1)) + " parts."
- else:
- if object_will_split == "True":
- print "[INFO] Object: " + object_name + " is so Large it Should be Split"
- print '[WARN] Object Splitting is Disabled, your Object might cause problems or wont spawn at all.'
- if object_name not in debug_faulty:
- debug_faulty.append(object_name + "(To Large)")
- if debug == "true":
- for line in debug_msg:
- print "[DEBUG] " + line
- del debug_msg[:]
- raw_input()
- ########################
- #### - Draw Image - ####
- ########################
- if Object_Preview[Use_Settings] == "true":
- print "[INFO] Generating Image"
- Object_Size_X = 1 + (Object_DimX1 - Object_DimX0)
- Object_Size_Y = 1 + (Object_DimY1 - Object_DimY0)
- Object_Size_Z = 1 + (Object_DimZ1 - Object_DimZ0)
- pic_size_x = (Object_Size_X * 14) + (Object_Size_Z * 14) + 32
- pic_size_y = (Object_Size_Y * 16) + (Object_Size_X * 8) + (Object_Size_Z * 8) + 32
- pic_center_x = (pic_size_x / 2) - (Object_DimX0 * 14) + (Object_DimZ0 * 14)
- pic_center_y = (pic_size_y - 16) + (Object_DimY0 * 16) + (Object_DimX0 * 7) + (Object_DimZ0 * 7) - 16
- debug_msg.append("Object Size: " + str(Object_Size_X) + "," + str(Object_Size_Y) + "," + str(Object_Size_Z) +"")
- background = Image.new('RGBA', (pic_size_x, pic_size_y), (0, 0, 0, 0))
- x = Object_DimX0
- y = Object_DimY0
- z = Object_DimZ0
- air = 0
- render_amt = 0
- percent = 0
- print '[INFO] Progres: ' + str(Obj_Block_amt) +'Blocks'
- sys.stdout.write('[')
- sys.stdout.flush()
- #mask = Image.open('./Images/STONE.png', 'r')
- while y <= Object_DimY1:
- z = Object_DimZ0
- while z <= Object_DimZ1:
- x = Object_DimX0
- while x <= Object_DimX1:
- #print str(render_amt) + "/" + str(Obj_Block_amt) + "=" + str(render_amt / Obj_Block_amt)
- if int((render_amt * 10) / (Obj_Block_amt + 1)) > percent:
- for i in (percent,int((render_amt * 10) / (Obj_Block_amt + 1))):
- sys.stdout.write('|')
- percent = int((render_amt * 10) / (Obj_Block_amt + 1))
- sys.stdout.flush()
- coords = str(x) + "," + str(y) + "," + str(z)
- blockfound = "false"
- try:
- if Object_Blocks[coords] != "":
- blockfound = "true"
- except:
- air += 1
- if blockfound == "true":
- try:
- Object_Blocks[coords] = str(BulkeEdit_Materials[str(Object_Blocks[coords])])
- except:
- Object_Blocks[coords] = str(Object_Blocks[coords])
- try:
- Object_Blocks_Base = Object_Blocks[coords]
- block = Image.open("./Images/" + Object_Blocks_Base.replace(":", "-") + ".png", 'r').convert('RGBA')
- except:
- try:
- Object_Blocks_Base = Object_Blocks[coords]
- block = Image.open("./Images/" + Object_Blocks_Base[:Object_Blocks_Base.find(":",0)] + ".png", 'r').convert('RGBA')
- except:
- try:
- Object_Blocks_Base = Object_Blocks[coords]
- Object_Blocks_Base = Object_Blocks_Base[Object_Blocks_Base.find(":",1)+1:]
- block = Image.open("./Images/" + Object_Blocks_Base.replace(":", "-") + ".png", 'r').convert('RGBA')
- except:
- try:
- Object_Blocks_Base = Object_Blocks[coords]
- Object_Blocks_Base = Object_Blocks_Base[Object_Blocks_Base.find(":",1)+1:]
- block = Image.open("./Images/" + Object_Blocks_Base[:Object_Blocks_Base.find(":",0)] + ".png", 'r').convert('RGBA')
- except:
- if str(Object_Blocks_Base) not in Missing_Image_List:
- Missing_Image_List.append(str(Object_Blocks_Base))
- block = Image.open('./Images/MISSING.png', 'r').convert('RGBA')
- offset = (pic_center_x - (x * 14) + (z * 14))-16, (pic_center_y - (y * 16) + (x * 7)+ (z * 7))-16
- background.paste(block, offset, block)
- render_amt += 1
- x += 1
- z+= 1
- y+= 1
- print ']'
- background.save('./Results/Preview/' + object_name + '.png')
- Object_Blocks.clear()
- print "[INFO] Done"
- print "[INFO] Total [" + str(Processed_Objects) + "] Objects Processed."
- print "[INFO] Total [" + str(Processed_Remove) + "] Blocks Removed."
- print "[INFO] Total [" + str(Processed_Checks) + "] BlockChecks created."
- print "[INFO] Total [" + str(Processed_Branches) + "] Branches created."
- if len(debug_faulty) > 0:
- counter = 0
- print "[INFO] Faulty Objects [" + str(len(debug_faulty)) + "] These Objects had some kind of Error"
- sys.stdout.write("[LIST] ")
- for item in debug_faulty:
- if counter > 0:
- sys.stdout.write(', ')
- sys.stdout.write(item)
- counter += 1
- sys.stdout.write('\n')
- if len(Missing_ID_List) > 0:
- counter = 0
- print "[INFO] There were some BlockIDs that I did not understood. You should add them to the Material List:"
- sys.stdout.write("[LIST] ")
- for item in Missing_ID_List:
- if counter > 0:
- sys.stdout.write(', ')
- sys.stdout.write(item)
- counter += 1
- sys.stdout.write('\n')
- if len(Missing_Image_List) > 0:
- counter = 0
- print "[INFO] I didnt have Images for these Blocks:"
- sys.stdout.write("[LIST] ")
- for item in Missing_Image_List:
- if counter > 0:
- sys.stdout.write(', ')
- sys.stdout.write(item)
- counter += 1
- sys.stdout.write('\n')
- if Config_Version != "1.05":
- print ""
- print ""
- print "[INFO] Your Configuration is Out of Date. I will regenerate it if you Remove or Rename it."
- print "[INFO] You can also update your Configuration manually."
- print "[INFO] Check the WikiPage on the OTG wiki for Changes."
- raw_input()
- if debug == "true":
- for line in debug_msg:
- print "[DEBUG] " + line
- del debug_msg[:]
- raw_input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement