Imprex-Development / orebfuscator

Orebfuscator - High-Performance Anti X-Ray plugin
https://modrinth.com/plugin/orebfuscator
GNU General Public License v3.0
126 stars 25 forks source link

Visible fake ores at chunk borders #255

Open Bobcat00 opened 1 year ago

Bobcat00 commented 1 year ago

Description

Using WorldEdit on a Paper 1.19.3 server to set blocks to air leaves fake ores showing:

2022-12-11_08 21 01

Logging out and back in updates blocks except those on a chunk boundary. I don't know why some on the boundary were updated. The four columns on the left are in a different chunk than the three columns on the right:

2022-12-11_08 21 30

Reproduction Steps

Clear the Orebfuscator cache, go to a spot in the world and use WorldEdit to create a hole. Put one edge on a chunk boundary.

Expected Behaviour

Blocks should be updated after the WorldEdit operation completes.

Server Details

git-Paper-319 (MC: 1.19.3)

Orebfuscator Version

5.3.2

ProtocolLib Version

5.0.0-SNAPSHOT-b606

Logs and Configs

No response

Extra Details

WorldEdit version 7.2.13+6283-46576cc

//perf ---------------- Side Effects ---------------- Entity AI Off Lighting On Mod/Plugin Events Off [setting this to On has no effect on the problem.] Neighbors On Update On Validation Off

Ingrim4 commented 1 year ago

First of all the reason this happens is pretty simple because WorldEdit (as well as any other plugin that modifies blocks) doesn't use our API. If a plugin changed a block it would need to tell Orebfuscator about so Orebfuscator can deobfuscate it and invalid cache. So this will likely not get fixed (this would also probably freeze/kill the server cause the deobfuscation isn't designed for large block updates).

What will need some fixing is the chunks hash. The way we calculate it is just based on the current chunk and not the neighbors which is causing this behavior after a rejoin (since changes in chunk are only detected if they happen in the current chunk not the neighboring). This will slightly tank performance since I need to also hash all four neighboring chunks. For the moment you could simply not use the cache or at the very least disable the persistent disk cache in the config since the in memory cache should evict old chunks after some configured amount of time and should therefore not suffer from this problem if left alone for long enough.

Ingrim4 commented 1 year ago

First preliminary fix which is slightly slower than the current version as mentioned before: https://github.com/Imprex-Development/Orebfuscator/suites/10133768419/artifacts/494732678