Advanced XRay (Neoforge Edition)

Advanced XRay (Neoforge Edition)

5M Downloads

Configured blocks set to ON get changed on game reload.

calloatti opened this issue ยท 8 comments

commented

I have been noticing that for example I set everything to OFF in the display option, except for 2 blocks that I set to ON, then when I exit the game and them reload the game and the map, the blocks set to ON change to other blocks that were OFF.

I checked the xray.cfg file and see that you use numeric IDs for the blocks. Now I don't know anything about MC mods, and this may be wrong, but aren't numeric block IDs not meant to be used anymore in recent MC versions since they can dynamically change?

It is my understanding that block names should be used, like any other mod config does, like for example:

minecraft:gold_ore
immersiveengineering:metal:18
magneticraft:ores:4

This may be totally wrong of course, if that is the case please ignore.

commented

That bug is actually the reason I forked XRay in the first place, hoping I can help :)
Here's what I gathered so far:

  • problem with default ores on/off, not loaded from config
  • XRay uses block ids which is an excellent idea for fast block scanning, but a bad idea for the config
  • moving the config file to another Minecraft instance, computer, or adding/removing mods will fail as block ids will change
  • a wrong config file can literally prevent Minecraft to start (putting a string in config where it expects an int)
  • default ores use int for ids and colours, and boolean for state (on/off) in the config file, while added ores use strings for everything
  • no ore dictionary support yet

I'll let you know as soon as I have a fix for those.

commented

I just noticed that some ores from other mods are supposed to be added as default ores, which never happened to me. That's probably because the config is loaded/created on preinit() when mods haven't added their ores yet (this is actually where they are adding items and blocks). So it's a race condition in mod loading order.
I think the config should be loaded in init().

commented

You are totally right but at the moment they are still supported in the way I am using them. The plan is to change them to the name based one when I get round to changing them.

As for you issue, could you let me know what version of the mod you are using and what game version you are using.

commented

Minecraft 1.12.2
xray-1.12.2-1.4.2

I will do more testing to see if it keeps happening.

commented

Okay, I'll do some searching myself to see if happens for me.

commented

Upon further checking it seems the selected options are not being saved to the config file. So what seemed like "changed" settings it was actually just always loading the default settings for the "enabled" option for each block, since it never gets changed in the file no matter what you set it to in MC.

commented

default ores use int for ids and colours, and boolean for state (on/off) in the config file, while added ores use strings for everything

This seems to be one of the problems. I guess this area needs an overhaul.

commented

A config overhaul is in the works