-
-
Save Tirpitz93/74748e4e7e14c55bbfefcf014024d681 to your computer and use it in GitHub Desktop.
def barrelFilter(poi): | |
import ast, collections | |
if poi['id'].lower().find("barrel") != -1: | |
if poi.get("LootTable"): | |
return | |
print("processing barrel") | |
from pprint import pprint | |
pprint(poi) | |
_items = 0 | |
_string_value = "Empty Barrel" | |
if poi.get('Items'): | |
_string_value = " " | |
compact_dict = collections.OrderedDict() | |
for i in poi['Items']: | |
try: | |
__name = "<em> {0} </em>".format(ast.literal_eval(i["tag"]["display"]["Name"])["text"]) | |
except: | |
__name = i["id"].replace("_", " ").title()[i["id"].find(":") + 1:] | |
print(__name) | |
if str(i["id"].lower()).find("shulker_box") != -1: | |
print("found shulker in Barrel") | |
packed_shulter_string = " with {1} items </br> {2}" | |
string_value = "" | |
_s_compact_dict = collections.OrderedDict() | |
_chest_shulker_item_name = "" | |
try: | |
i.get("tag").get("BlockEntityTag").get("Items") # box has items | |
for j in i["tag"]["BlockEntityTag"]['Items']: | |
try: | |
_chest_shulker_item_name = "<em> {0} </em>".format(ast.literal_eval(j.get("tag").get( | |
"display").get("Name"))["text"]) | |
except: | |
_chest_shulker_item_name = j["id"].replace("_", " ").title()[j["id"].find(":") + 1:] | |
print(_chest_shulker_item_name) | |
# print(_chest_shulker_item_name) | |
if _chest_shulker_item_name not in _s_compact_dict: | |
_s_compact_dict[_chest_shulker_item_name] = j['Count'] | |
else: | |
_s_compact_dict[_chest_shulker_item_name] += j['Count'] | |
for k, v in _s_compact_dict.items(): | |
string_value = string_value + "    {0} {1} {2}".format( | |
k, v, "</br>") | |
except: | |
pass | |
shulker_string = packed_shulter_string.format(_chest_shulker_item_name, len(_s_compact_dict.items()), | |
string_value) | |
print(shulker_string) | |
if _s_compact_dict.get(_chest_shulker_item_name): | |
_n = 1 | |
while _s_compact_dict.get(_chest_shulker_item_name): | |
kp = _s_compact_dict.popitem(_chest_shulker_item_name) | |
_n += kp[1] | |
pprint(_s_compact_dict) | |
print(len(_s_compact_dict)) | |
print(_chest_shulker_item_name, _n) | |
_chest_shulker_item_name = _chest_shulker_item_name + " " + str(_n) | |
compact_dict[__name] = shulker_string | |
elif __name not in compact_dict: | |
compact_dict[__name] = i['Count'] | |
else: | |
compact_dict[__name] += i['Count'] | |
for k, v in compact_dict.items(): | |
_string_value = _string_value + ("{0} {1}{2}".format(v, k, "</br>\n")) | |
_items = len(compact_dict.items()) | |
else: | |
_items = 0 | |
print("Done processing Barrel") | |
return ( "Barrel with %d items" % len(poi.get('Items', [])), _string_value) |
def chestFilter(poi): | |
import ast, collections | |
if poi['id'].lower().find("chest") != -1: | |
if poi.get("LootTable"): | |
return | |
print("processing chest") | |
from pprint import pprint | |
pprint(poi) | |
_items = 0 | |
_string_value = "Empty Chest" | |
if poi.get('Items'): | |
_string_value = " " | |
compact_dict = collections.OrderedDict() | |
for i in poi['Items']: | |
try: | |
__name = "<em> {0} </em>".format(ast.literal_eval(i["tag"]["display"]["Name"])["text"]) | |
except: | |
__name = i["id"].replace("_", " ").title()[i["id"].find(":") + 1:] | |
print(__name) | |
if str(i["id"].lower()).find("shulker_box") != -1: | |
print("found shulker in chest") | |
packed_shulter_string = " with {1} items </br> {2}" | |
string_value = "" | |
_s_compact_dict = collections.OrderedDict() | |
_chest_shulker_item_name = "" | |
try: | |
i.get("tag").get("BlockEntityTag").get("Items") # box has items | |
for j in i["tag"]["BlockEntityTag"]['Items']: | |
try: | |
_chest_shulker_item_name = "<em> {0} </em>".format(ast.literal_eval(j.get("tag").get( | |
"display").get("Name"))["text"]) | |
except: | |
_chest_shulker_item_name = j["id"].replace("_", " ").title()[j["id"].find(":") + 1:] | |
print(_chest_shulker_item_name) | |
# print(_chest_shulker_item_name) | |
if _chest_shulker_item_name not in _s_compact_dict: | |
_s_compact_dict[_chest_shulker_item_name] = j['Count'] | |
else: | |
_s_compact_dict[_chest_shulker_item_name] += j['Count'] | |
for k, v in _s_compact_dict.items(): | |
string_value = string_value + "    {0} {1} {2}".format( | |
k, v, "</br>") | |
except: | |
pass | |
shulker_string = packed_shulter_string.format(_chest_shulker_item_name, len(_s_compact_dict.items()), | |
string_value) | |
print(shulker_string) | |
if _s_compact_dict.get(_chest_shulker_item_name): | |
_n = 1 | |
while _s_compact_dict.get(_chest_shulker_item_name): | |
kp = _s_compact_dict.popitem(_chest_shulker_item_name) | |
_n += kp[1] | |
pprint(_s_compact_dict) | |
print(len(_s_compact_dict)) | |
print(_chest_shulker_item_name, _n) | |
_chest_shulker_item_name = _chest_shulker_item_name + " " + str(_n) | |
compact_dict[__name] = shulker_string | |
elif __name not in compact_dict: | |
compact_dict[__name] = i['Count'] | |
else: | |
compact_dict[__name] += i['Count'] | |
for k, v in compact_dict.items(): | |
_string_value = _string_value + ("{0} {1}{2}".format(v, k, "</br>\n")) | |
_items = len(compact_dict.items()) | |
else: | |
_items = 0 | |
print("Done processing Chest") | |
return ( "Chest with %d items" % len(poi.get('Items', [])), _string_value) | |
.leaflet-popup-content { | |
max-height: 200pt; | |
overflow-y: auto; | |
} |
def enderChestFilter(poi): | |
if poi['id'] == "ender_chest" or poi['id'] == 'minecraft:ender_chest': | |
return ("Ender Chest", "Ender Chest") |
global_markers = [dict(name="All signs", filterFunction=signFilter, icon="signpost_icon.png"), | |
dict(name="Players", filterFunction=playerIcons), | |
dict(name="Ender Chests", filterFunction=enderChestFilter,icon="/sprites/2132.png"), | |
dict(name="Chests", filterFunction=chestFilter,icon="/sprites/2134.png"), | |
dict(name="Shulker Box", filterFunction=shulkerFilter,icon="/sprites/1098.png"), | |
] | |
def playerIcons(poi): | |
from pprint import pprint | |
import ast, collections | |
packed_shulter_string = " with {1} items </br> {2}" | |
# print(poi) | |
if poi['id'] == 'Player': | |
# print(poi) | |
# pprint(poi) | |
print("processing player") | |
ender_items_str = "" | |
inv_item_string = "" | |
_ender_item_dict = collections.OrderedDict() | |
_inv_item_dict = collections.OrderedDict() | |
if poi.get("EnderItems"): | |
print("precessing EnderItems") | |
for i in poi["EnderItems"]: | |
#pprint.pprint(i) | |
try: | |
# print(i.get("tag").get("display").get("Name")) | |
_ender_item_name ="<em> {0} </em>".format( ast.literal_eval(i.get("tag").get("display").get( | |
"Name"))["text"]) | |
except: | |
_ender_item_name = i["id"].replace("_", " ").title()[i["id"].find(":") + 1:] | |
# print(_ender_item_name) | |
if str(i["id"].lower()).find("shulker_box") != -1: | |
string_value = "" | |
# processShulkerBox(i) | |
print("Found shulker box in ender items") | |
# print(i["id"]) | |
_s_compact_dict = collections.OrderedDict() | |
# print(i) | |
# try: | |
try: | |
i.get("tag").get("BlockEntityTag").get("Items") # box has items | |
for j in i["tag"]["BlockEntityTag"]['Items']: | |
try: | |
_ender_shulker_item_name = "<em> {0} </em>".format(ast.literal_eval(j.get("tag").get( | |
"display").get("Name"))["text"]) | |
except: | |
_ender_shulker_item_name = j["id"].replace("_", " ").title()[j["id"].find(":") + 1:] | |
print(_ender_shulker_item_name) | |
if _ender_shulker_item_name not in _s_compact_dict: | |
_s_compact_dict[_ender_shulker_item_name] = j['Count'] | |
else: | |
_s_compact_dict[_ender_shulker_item_name] += j['Count'] | |
for k, v in _s_compact_dict.items(): | |
string_value = string_value + "    {0} {1} {2}".format( | |
k, v, "</br>") | |
except: | |
pass | |
shulker_string = packed_shulter_string.format(_ender_item_name, len(_s_compact_dict.items()), | |
string_value) | |
# print(shulker_string) | |
if _ender_item_dict.get(_ender_item_name): | |
_n = 1 | |
while _ender_item_dict.get(_ender_item_name + " " + str(_n)): | |
_n += 1 | |
_ender_item_name = _ender_item_name + " " + str(_n) | |
_ender_item_dict[_ender_item_name] = shulker_string # print("shulker string") # print(shulker_string) | |
elif _ender_item_name not in _ender_item_dict: | |
_ender_item_dict[_ender_item_name] = i['Count'] | |
else: | |
_ender_item_dict[_ender_item_name] += i['Count'] | |
""" | |
""" | |
print("hello") | |
if poi.get("Inventory"): | |
print("loading inventory") | |
for i in poi["Inventory"]: | |
print("Inventory Item...") | |
try: | |
_inv_item_name ="<em> {0} </em>".format( ast.literal_eval(i.get("tag").get("display").get( | |
"Name"))["text"]) | |
except: | |
_inv_item_name = i["id"].replace("_", " ").title()[i["id"].find(":") + 1:] | |
print(_inv_item_name) | |
if str(i["id"].lower()).find("shulker_box") != -1: | |
string_value = "" | |
# processShulkerBox(i) | |
print("Found shulker box in inventory") | |
# print(i["id"]) | |
_s_compact_dict = collections.OrderedDict() | |
# print(i) | |
# try: | |
try: | |
i.get("tag").get("BlockEntityTag").get("Items") # box has items | |
for j in i["tag"]["BlockEntityTag"]['Items']: | |
try: | |
_i_shulker_item_name = "<em> {0} </em>".format(ast.literal_eval(j.get("tag").get( | |
"display").get("Name"))["text"]) | |
except: | |
_i_shulker_item_name = j["id"].replace("_", " ").title()[j["id"].find(":") + 1:] | |
if _i_shulker_item_name not in _s_compact_dict: | |
_s_compact_dict[_i_shulker_item_name] = j['Count'] | |
else: | |
_s_compact_dict[_i_shulker_item_name] += j['Count'] | |
for k, v in _s_compact_dict.items(): | |
string_value = string_value + "    {0} {1} {2}".format( | |
k, v, "</br>") | |
except: | |
pass | |
shulker_string = packed_shulter_string.format(_inv_item_name, len(_s_compact_dict.items()), | |
string_value) | |
print(shulker_string) | |
if _inv_item_dict.get(_inv_item_name): | |
_n = 1 | |
while _inv_item_dict.get(_inv_item_name + " " + str(_n)): | |
_n += 1 | |
_inv_item_name = _inv_item_name + " " + str(_n) | |
_inv_item_dict[_inv_item_name] = shulker_string # print("shulker string") # print(shulker_string) | |
elif _inv_item_name not in _inv_item_dict: | |
_inv_item_dict[_inv_item_name] = i['Count'] | |
else: | |
_inv_item_dict[_inv_item_name] += i['Count'] | |
# pprint.pprint(_ender_item_dict) | |
for k, v in _ender_item_dict.items(): | |
ender_items_str = ender_items_str + " {0} {1} {2}".format(str(k)[str(k).find(":") + 1:], v, "</br>") | |
# print(ender_items_str) | |
for k, v in _inv_item_dict.items(): | |
inv_item_string = inv_item_string + " {0} {1} {2}".format(str(k)[str(k).find(":") + 1:], v, "</br>") | |
poi['icon'] = "https://overviewer.org/avatar/%s" % poi['EntityId'] | |
player_string = ( | |
"<h3>Last known location for {0}</h3><br/> <b> Inventory: </b></br> {2}</br> <b> Ender Items: </b> </br>{1} " | |
"".format( | |
poi['EntityId'], | |
ender_items_str,inv_item_string )) | |
# print(player_string) | |
return player_string |
def playerIcons(poi): | |
from pprint import pprint | |
import ast, collections | |
packed_shulter_string = " with {1} items </br> {2}" | |
# print(poi) | |
if poi['id'] == 'Player': | |
# print(poi) | |
# pprint(poi) | |
print("processing player") | |
ender_items_str = "" | |
inv_item_string = "" | |
_ender_item_dict = collections.OrderedDict() | |
_inv_item_dict = collections.OrderedDict() | |
""" | |
""" | |
if poi.get("EnderItems"): | |
print("precessing EnderItems") | |
for i in poi["EnderItems"]: | |
#pprint.pprint(i) | |
try: | |
# print(i.get("tag").get("display").get("Name")) | |
_ender_item_name ="<em> {0} </em>".format( ast.literal_eval(i.get("tag").get("display").get( | |
"Name"))["text"]) | |
except: | |
_ender_item_name = i["id"].replace("_", " ").title()[i["id"].find(":") + 1:] | |
# print(_ender_item_name) | |
if str(i["id"].lower()).find("shulker_box") != -1: | |
string_value = "" | |
# processShulkerBox(i) | |
print("Found shulker box in ender items") | |
# print(i["id"]) | |
_s_compact_dict = collections.OrderedDict() | |
# print(i) | |
# try: | |
try: | |
i.get("tag").get("BlockEntityTag").get("Items") # box has items | |
for j in i["tag"]["BlockEntityTag"]['Items']: | |
try: | |
_ender_shulker_item_name = "<em> {0} </em>".format(ast.literal_eval(j.get("tag").get( | |
"display").get("Name"))["text"]) | |
except: | |
_ender_shulker_item_name = j["id"].replace("_", " ").title()[j["id"].find(":") + 1:] | |
print(_ender_shulker_item_name) | |
if _ender_shulker_item_name not in _s_compact_dict: | |
_s_compact_dict[_ender_shulker_item_name] = j['Count'] | |
else: | |
_s_compact_dict[_ender_shulker_item_name] += j['Count'] | |
for k, v in _s_compact_dict.items(): | |
string_value = string_value + "    {0} {1} {2}".format( | |
k, v, "</br>") | |
except: | |
pass | |
shulker_string = packed_shulter_string.format(_ender_item_name, len(_s_compact_dict.items()), | |
string_value) | |
# print(shulker_string) | |
if _ender_item_dict.get(_ender_item_name): | |
_n = 1 | |
while _ender_item_dict.get(_ender_item_name + " " + str(_n)): | |
_n += 1 | |
_ender_item_name = _ender_item_name + " " + str(_n) | |
_ender_item_dict[_ender_item_name] = shulker_string # print("shulker string") # print(shulker_string) | |
elif _ender_item_name not in _ender_item_dict: | |
_ender_item_dict[_ender_item_name] = i['Count'] | |
else: | |
_ender_item_dict[_ender_item_name] += i['Count'] | |
""" | |
""" | |
print("hello") | |
if poi.get("Inventory"): | |
print("loading inventory") | |
for i in poi["Inventory"]: | |
print("Inventory Item...") | |
try: | |
_inv_item_name ="<em> {0} </em>".format( ast.literal_eval(i.get("tag").get("display").get( | |
"Name"))["text"]) | |
except: | |
_inv_item_name = i["id"].replace("_", " ").title()[i["id"].find(":") + 1:] | |
print(_inv_item_name) | |
if str(i["id"].lower()).find("shulker_box") != -1: | |
string_value = "" | |
# processShulkerBox(i) | |
print("Found shulker box in inventory") | |
# print(i["id"]) | |
_s_compact_dict = collections.OrderedDict() | |
# print(i) | |
# try: | |
try: | |
i.get("tag").get("BlockEntityTag").get("Items") # box has items | |
for j in i["tag"]["BlockEntityTag"]['Items']: | |
try: | |
_i_shulker_item_name = "<em> {0} </em>".format(ast.literal_eval(j.get("tag").get( | |
"display").get("Name"))["text"]) | |
except: | |
_i_shulker_item_name = j["id"].replace("_", " ").title()[j["id"].find(":") + 1:] | |
if _i_shulker_item_name not in _s_compact_dict: | |
_s_compact_dict[_i_shulker_item_name] = j['Count'] | |
else: | |
_s_compact_dict[_i_shulker_item_name] += j['Count'] | |
for k, v in _s_compact_dict.items(): | |
string_value = string_value + "    {0} {1} {2}".format( | |
k, v, "</br>") | |
except: | |
pass | |
shulker_string = packed_shulter_string.format(_inv_item_name, len(_s_compact_dict.items()), | |
string_value) | |
print(shulker_string) | |
if _inv_item_dict.get(_inv_item_name): | |
_n = 1 | |
while _inv_item_dict.get(_inv_item_name + " " + str(_n)): | |
_n += 1 | |
_inv_item_name = _inv_item_name + " " + str(_n) | |
_inv_item_dict[_inv_item_name] = shulker_string # print("shulker string") # print(shulker_string) | |
elif _inv_item_name not in _inv_item_dict: | |
_inv_item_dict[_inv_item_name] = i['Count'] | |
else: | |
_inv_item_dict[_inv_item_name] += i['Count'] | |
# pprint.pprint(_ender_item_dict) | |
for k, v in _ender_item_dict.items(): | |
ender_items_str = ender_items_str + " {0} {1} {2}".format(str(k)[str(k).find(":") + 1:], v, "</br>") | |
# print(ender_items_str) | |
for k, v in _inv_item_dict.items(): | |
inv_item_string = inv_item_string + " {0} {1} {2}".format(str(k)[str(k).find(":") + 1:], v, "</br>") | |
poi['icon'] = "https://overviewer.org/avatar/%s" % poi['EntityId'] | |
player_string = ( | |
"<h3>Last known location for {0}</h3><br/> <b> Inventory: </b></br> {2}</br> <b> Ender Items: </b> </br>{1} " | |
"".format( | |
poi['EntityId'], | |
ender_items_str,inv_item_string )) | |
# print(player_string) | |
return player_string | |
def bed(poi): | |
if poi["id"] == "PlayerSpawn": | |
poi['icon'] = "bed.png" | |
return "[%s] \n %s \n" % ("Bed", poi["EntityId"]) |
def shulkerFilter(poi: dict): | |
import ast, collections | |
shulker_string = "<em>{0} </em> with {1} items </br> {2}" # name or id, number of unique items, list of items | |
if poi['id'].lower().find("shulker_box") != -1: | |
_name = poi["id"].replace("_", " ").title()[poi["id"].find(":") + 1:] | |
if poi.get("CustomName"): | |
import ast | |
_name = ast.literal_eval(poi["CustomName"])["text"] | |
_items = 0 | |
_string_value = "Empty Shulker Box" | |
if poi.get('Items'): | |
_string_value = " " | |
compact_dict = collections.OrderedDict() | |
for i in poi['Items']: | |
try: | |
__name = "<em> {0} </em>".format(ast.literal_eval(i["tag"]["display"]["Name"])["text"]) | |
except: | |
__name = i["id"].replace("_", " ").title()[i["id"].find(":") + 1:] | |
if __name not in compact_dict: | |
compact_dict[__name] = i['Count'] | |
else: | |
compact_dict[__name] += i['Count'] | |
for k, v in compact_dict.items(): | |
_string_value = _string_value + ("{0} {1}{2}".format(v, k, "</br>\n")) | |
_items = len(compact_dict.items()) | |
return shulker_string.format(_name, _items, _string_value) | |
pass |
def signFilter(poi): | |
if poi['id'] == 'Sign' or poi['id'] == 'minecraft:sign': | |
return "\n".join([poi['Text1'], poi['Text2'], poi['Text3'], poi['Text4']]) |
Could you please share your biome overlay options too?
Not sure they are anything special:
renders['Survival_bioms'] = {
'world': 'Survival',
"dimension": "overworld",
'rendermode': [ClearBase(), BiomeOverlay()],
'title': "Biome Coloring Overlay",
'overlay': [],
'texturepath':"/var/www/html/snapshot_client.jar"
}
Ah thanks, could you share the code you used to show both inventory and enderchest of players, this one only shows enderchest data.
Ah thanks, could you share the code you used to show both inventory and enderchest of players, this one only shows enderchest data.
Its handled in playerIcons()
Its still very much experimental, use at own risk.
Also if you have improvements I would love to see them.
I'm gonna use it to render a giant survival server world,it will be a public web map, there should be a filter for barrels since I've seen tons of people use them for storage. Also there should be a filter for spawners, I tried to use one that searches for spawnPotentials but the coords and titles of the spawners weren't saved in markersDB.js when i generated pois, but the spawners were recognized in the spawners group since I found 3 but with no metadata, here overviewer/Minecraft-Overviewer#1289 (comment) is the spawner filter I used, also I recommend using minotar skin API, I used just the player faces for player markers, it is also much faster than overviewer API, I tested both, on world with 700 player markers the overviewer API is very slow and random loading of player avatars, minotar was immediate, minotar can also render front body if you wanna keep that format.
I also found a filter for playerbeds def bed(poi): if poi["id"] == "PlayerSpawn": poi['icon'] = "bed.png" return "[%s] \n %s \n" % ("Bed", poi["EntityId"])
I'm gonna use it to render a giant survival server world,it will be a public web map, there should be a filter for barrels since I've seen tons of people use them for storage. Also there should be a filter for spawners, I tried to use one that searches for spawnPotentials but the coords and titles of the spawners weren't saved in markersDB.js when i generated pois, but the spawners were recognized in the spawners group since I found 3 but with no metadata, here overviewer/Minecraft-Overviewer#1289 (comment) is the spawner filter I used, also I recommend using minotar skin API, I used just the player faces for player markers, it is also much faster than overviewer API, I tested both, on world with 700 player markers the overviewer API is very slow and random loading of player avatars, minotar was immediate, minotar can also render front body if you wanna keep that format.
The barrels should be easy as changing the chests one to check for barrel in the name.
I also found a filter for playerbeds
def bed(poi): if poi["id"] == "PlayerSpawn": poi['icon'] = "bed.png" return "[%s] \n %s \n" % ("Bed", poi["EntityId"])
I hadn't thought to do this although it looks good.
Mojang seems to have changed their API limits...I'm getting rate limited for doing UUID to player profile + cape requests on different accounts. This seems to have broken multiple skin APIs and I use sleep function for 2 secs which seems not to trigger the rate limit in playerIcons filter
Hey I saw in your most recent map it seems you made some changes to some of the filters. Would you mind updating them here?
Hey I saw in your most recent map it seems you made some changes to some of the filters. Would you mind updating them here?
I can try, my map is also currently broken due to the server running snapshots and changes to the latest MCA data format.
I think I have patched every section to the live version.
todo barrels
I think I have patched every section to the live version.
todo barrels
- fixed some errors encountered with specific shulker box configuration that caused endless loops.
- added barrel config too
Can you give me the Pictures (Chest , Enderchest, ...from your Website as a Download link,so I can make my own Overview-Map with trese pictures?
Thanks
Can you give me the Pictures (Chest , Enderchest, ...from your Website : https://mcmap.lselter.co.uk/sprites/) as a Download link,so I can make my own Overview-Map with trese pictures?
Thanks
As they are minecraft sprites I would not feel comfortable distributing them per se.
but there is nothing stopping you ripping them from the URL you posted.
Ok I will serch for something better.
Thank you
how is your global_markers
used?
it stores the markers that are applied to all maps (only relevant markers obvs) such as players, chests etc.
it is effectively a special variable name for overviewer
Could you please share your biome overlay options too?