Mrbysco / StructureCompass

Adds a compass for each Minecraft structure
https://www.curseforge.com/minecraft/mc-mods/structure-compass
MIT License
2 stars 6 forks source link

[Bug]: Structure Compass does not respect the configured search range limit. #9

Open JustAnotherGhostName opened 1 year ago

JustAnotherGhostName commented 1 year ago

General Info

Forge version

43.1.55

Mod version

1.3.5

Java version

Java 17.0.5

Issue Description

The structure compass currently does not respect the configured range limit. This is tested in ATM8 version 1.0.7. This is mostly observed with the Ancient Pyramid structure from All The Modium, however, I am assuming it does the same for other structures. This issue just happens to be observed more often with looking for the ancient pyramid as that's what everyone is using the compass for.

Currently, it is configured to do 2500 blocks away from the compass, however, the compass tends to keep searching going as far as 30k blocks out to find a structure, past the world border. This causes a MASSIVE lag spike on a server which times everyone out. What makes matters worse is that when you do the /locate structure allthemodium:ancient_pyramid command, it will accurately find the nearest structure which may be only 2k blocks out.

Additional Information

No specific images or logs to show, just that when its used there is a high chance that most people on the server will time out because its searching for something 30k+ blocks away.

Mrbysco commented 1 year ago

It will try to locate a structure within 300 chunks by default, this can be changed in the config. (From the curse description)

JustAnotherGhostName commented 1 year ago

Ah, I did not notice that. I assumed it was in blocks since it was not indicated in the config if its in chunks or blocks. My apologies, I will adjust it then confirm.

Mrbysco commented 1 year ago

To be honest, I originally guessed it was blocks, but someone in my discord found out it's in chunks so I adjusted the description of the mod from blocks to chunks

Mrbysco commented 1 year ago

Just know it also counts the chunk you're in, so if you were to set it to 4 it limits it to <80 ish, etc etc

Mrbysco commented 1 year ago

I should probably add a max value for the config as to not allow searching too far away

JustAnotherGhostName commented 1 year ago

That is good to know, thank you for pointing that out. I think it might be an issue though that the locate command was locating the nearest structure better though? Not sure why locate could detect the structure 2k blocks out, but the compass found one 30k blocks out.

JustAnotherGhostName commented 1 year ago

Update: Tested on my server with it decreased to 180 chunks (so should be 2,880 blocks) and everyone timed out. Upon joining back, its pointing to a structure 35,278 blocks away. It seems that besides misunderstanding the config, it still is an issue.

JustAnotherGhostName commented 1 year ago

I also want to note that my server has a world border at 30k, so you cant go out more than 15k in any direction centered on 0 0, and I did this test centered on 0 0. It would occur regardless though of me being at 0 0 or not.

Mrbysco commented 1 year ago

Are you sure you restarted the server when changing the config?

Else there's not much I can do. All I do is call a vanilla function, the same one that's called when doing a /locate command but with a different distance value. If I want to completely fix all issues I'd have to write my own method for gathering structures, which would take me weeks to do

JustAnotherGhostName commented 1 year ago

I can confirm the server was restarted when updating the config, I waited for my servers scheduled 6 hour restarts to change the config, and confirmed that the file was in fact saved before the restart.

Mrbysco commented 1 year ago

A new jar has been uploaded (1.4.0) that changes the method of finding structures and changes it to directly use compassRange The config option has been changed to represent the distance in blocks

Mrbysco commented 1 year ago

Could you test 1.4.0?

JustAnotherGhostName commented 1 year ago

Yes, I will take a look at it tomorrow night.

JustAnotherGhostName commented 1 year ago

Apologies for the late update, this week has been unexpectedly busy for me. I updated to 1.4.0, and have the default configs. See here: image

So, it appears what causes the insane spikes is specifically when "locateUnexplored" is set to true. It is nearly instant when it is set to false as default.

I should be able to unban the item now with this update and have locateUnexplored off. My server has rtp's, and the main structure in question still spawns the main mob people are looking for after it was explored.