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

Custom server inventory menus #50

Open
Rafii2198 opened this issue Jun 3, 2023 · 8 comments
Open

Custom server inventory menus #50

Rafii2198 opened this issue Jun 3, 2023 · 8 comments

Comments

@Rafii2198
Copy link

Continuation of discussion from #49
I tried the snipped, but it didn't work, but I tried to put Entity ID in the group and it worked.
Now there are some issues, I don't know if they are caused by OptiGUI specifically or server specific stuff but for example I can't at all select a specific name, the custom texture will just never appear. Interestingly selecting name.wildcard selects everything for some reason.

Curretnly my .ini file looks like this:

[minecraft:villager]
name.wildcraft = *smith*
interaction.texture = minecraft:textures/gui/container/generic_54.png
replacement = generic_54.png

I tried to select the name that has smith anywhere in it, yet it appears everywhere. When I set name to Blacksmith it never appeared, but I suspect that maybe there are some special characters or something for color codes for example but there is no way for me to check.

As an example here is Item Identifier npc, it has no where in its name smith yet the texture changed
image

@Rafii2198
Copy link
Author

Actually, I made a typo in wildcard, my bad, apologies. Fixing the typo made it behave as just a name, where it just doesn't apply at all.

@opekope2
Copy link
Owner

opekope2 commented Jun 3, 2023

Name applies to the custom name of the entity (the name you put on it with a name tag). The screen title is used internally to guess the name if the server doesn't send the NBT (by default) as a workaround, but this shouldn't be relied on. If the villager has a profession, you can use the villager.professions selector. The selector you're looking for (screen title) currently doesn't exist, it's planned to be added in the next version with a bunch of others.

@Rafii2198
Copy link
Author

Sadly, setting a specific profession didn't help. I tried armorer and cleric but in both cases the texture appeared for all villager npcs. I think I will have to wait for that new selector.

Another thing is villagers are not only npcs, some of them (mainly shops) are made via Player entities, and I tried this method, but it didn't work at all for them.

@opekope2
Copy link
Owner

opekope2 commented Jun 3, 2023

Player entities don't support villager properties, that's how OptiGUI works (every entity type has no or only one preprocessor).
It's possible that those villagers don't have an actual Minecraft profession. This gives me an idea to make a "dump tool" to dump the processed information about an entity.
I can't promise that the new selectors will fix it, I may need to add another mixin to the code.

@Rafii2198
Copy link
Author

I think I know what might be happening, I should realize it earlier. The server is running on some kind of hybrid of 1.12 and 1.13 allowing players to join from any versions after 1.12 and as professions were redone in 1.14 which the server is not running on, it won't work. It basically has some old data maybe, but villager appears with new textures and stuff.

Also by trying this method I mean putting player entity ID as group and using interaction.texture but the texture didn't change at all, I will do some more testing later, maybe it is opening a normal chest or something, so nothing special is needed other than specifying a chest in group, but I will test it later.

@opekope2
Copy link
Owner

opekope2 commented Jun 3, 2023

The server can send a "handled screen" to the client without a container behind it.
And if it's an issue with Minecraft before the lowest supported (1.18), then it won't be fixed

@opekope2
Copy link
Owner

opekope2 commented Sep 6, 2023

The next release of OptiGUI will ship an inspector, which lets you export selectors for an entity or block entity to the clipboard with a key press (#72).
However, a right click is still required before the game opens a screen. If a toast doesn't appear on the key press, this can be a reason.

@Rafii2198
Copy link
Author

Apologies for late response. I tried it on 1.20.1, and it kinda worked, only a few npcs managed to get it working while the rest still used the default texture. I think it is mainly dependent on how server handles it. For example, all npcs have their role above them and also a short description below (screenshot with an example) and more generic ones have just NPC as description and the inspector detected that description as their name.
image

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

2 participants