Locks

Locks

8M Downloads

[1.12.2] Not all new, randomly generated chests are generated with locks

Dimentive opened this issue · 9 comments

commented

With B:generate_locks set to true, I explored a new, randomly generated dungeon, and while most of the chests had locks, about 1-in-4 chests did not have a lock on it.

Versions

  • Minecraft: 1.12.2
  • Forge: 14.23.5.2847 (latest for 1.12.2)
  • Locks: 2.2.1 (latest for 1.12.2)
commented

The issue still there on 1.12.2 backport, any update when it will be finished?

trying to do a modpack, and zero chests has locks on them even with 100% probability of them spawning

been waiting since mid of last year for it to be fixed.

commented

I fixed this in the latest update, but the 1.12.2 backport is as of yet unfinished

What is the "Update" for it to be finished, its has been 4months for this, and just still curious how much longer it will take for this issue to be fixed for 1.12.2

commented

What other mods do you have installed?

commented
commented

Does this happen with only one mod in particular or with every generation mod? Have you noticed if locks don't spawn on all chests generated by a particular mod or only on some chests generated by that mod?

commented

Most naturally generated chests I find are still unlocked. Only a few I managed to find are locked. These are chests generated by the Roguelike Dungeons mod.

I had ”generation chance” in Locks’ config set to 0.7 as it was by default but changed it to 1.0, although I didn’t restart my game, so I’m not sure if it didn’t take effect.

commented

Seems to happen randomly with chests spawned by several different mods, like Roguelike Dungeons and Actually Additions. I don’t think I tested vanilla-generated chests, but I would guess the same remains. Some chests are locked whilst some aren’t.

commented

I noticed a similar issue in a massive modpack I'm working on
MC 1.12.2, Locks 2.5.1, over 200 other mods
Set generation chance to 1 (100%)

After finding many unlocked chests, I decided to dig into the code.

I added some printouts to the lock generation section of the code and noticed it wasn't even finding the TEs for the chests. Said TEs exist when I find the chests ofc, so I figured it was a timing issue (some mods are adding chests after the lock generation runs).

First I tried just setting the @SubscribeEvent priority to LOWEST, but that unfortunately did not solve the issue. I don't know if some mods are doing their chest generation in the same event at LOWEST and are alphabetically later, or if they're using the callback that happens after the particular event being used, or something else, but in any case...

...I then tried caching the PopulateChunkEvent.Post events and then executing lockgen code on them later in the same tick, and this fixed the issue. I now find locks on all generated chests (chance set to 1).

On a somewhat related note, I also noticed the code was only rolling per-chunk and not per-chest, so all chests in a chunk would either have locks or not (assuming they weren't being passed by due to the issue this thread is about), so I changed that as well. I assume it was not intentional.

I'll PR for both after I grab something to eat.

commented

I fixed this in the latest update, but the 1.12.2 backport is as of yet unfinished