Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Include a Nametag key if the poi has been given a name #2062

Open
dfeneck opened this issue Aug 10, 2022 · 4 comments
Open

Request: Include a Nametag key if the poi has been given a name #2062

dfeneck opened this issue Aug 10, 2022 · 4 comments

Comments

@dfeneck
Copy link

dfeneck commented Aug 10, 2022

I have all signs in my world being rendered, it would be nice to be able to exclude some without using a line of text on the sign.

A simple poi['nametag'] if the poi entity has been given a name would suffice for this.
Then players could name a sign 'hidden' and it won't show up!

A humble suggestion anyway,
Cheers.

@jobe1986
Copy link

You can achieve this in your filter function easily enough.

If you simply want to exclude all entities the filter handles that have "any" name then you can simply use:

if 'CustomName' in poi:
  return

If you want to base it on the value of the name then you'll have to expand it to:

if 'CustomName' in poi:
  import json
  namejson = json.loads(poi['CustomName'])
  if 'text' in namejson and namejson['text'] == 'hidden':
    return

Unfortunately I have always found that adding import json to the top of overviewer.conf has been insufficient and I couldn't be bothered to figure out why however this method does work.

@IncredibleHolg
Copy link
Contributor

@jobe1986
You have to declare this as global
It is on line 74 of docs/signs.rst

Because of the way the config file is loaded, if you need to import a function or module
for use in your filter function, you need to explicitly load it into the global namespace::

    global escape
    from html import escape
    def signFilter(poi):
        if poi['id'] == 'Sign' or poi['id'] == 'minecraft:sign':
            return escape("\n".join([poi['Text1'], poi['Text2'], poi['Text3'], poi['Text4']]))

@jobe1986
Copy link

@IncredibleHolg Thanks for that

@ajh123
Copy link

ajh123 commented Jul 10, 2023

The main README states ..

PLEASE NOTE: Overviewer is currently unmaintained. PRs will not be merged and issues will not be addressed. The website and repository will remain online and accessible.

Instead please use the new working (“successor”) version of Overviewer supporting 1.20 worlds and textures.
https://github.com/GregoryAM-SP/The-Minecraft-Overviewer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants