Created
January 24, 2016 01:19
-
-
Save davidjmerritt/e6e578d44d73e4e77f33 to your computer and use it in GitHub Desktop.
For use with Minecraft Overviewer. This method will look for "#tags" in your in-game signs. For example: "Here is my chest full of #gold." This will populate your Minecraft overviewer.py map with a gold.png.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def customSignFilter(poi): | |
import re | |
if poi['id'] == 'Sign': | |
text_list = [poi['Text1'], poi['Text2'], poi['Text3'], poi['Text4']] | |
tag = None | |
for i in range(0,len(text_list)): | |
if text_list[i].find("#") > -1: | |
text_trunc = text_list[i][text_list[i].find("#"):len(text_list[i])] | |
if text_trunc.find(" ") > -1: | |
tag = str(text_trunc[1:text_trunc.find(" ")]).lower() | |
else: | |
tag = str(text_trunc[1:len(text_trunc)]).lower() | |
tag = re.sub(r'[^\w\\/@+\-:,|#]+', '', tag) | |
if tag != None and tag != "" and tag != " ": | |
poi['icon'] = "icons/"+tag+".png" | |
return "\n".join(text_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment