PersonTheCat / OreStoneVariants

A powerful utility for generating new blocks when given a foreground and background.
GNU General Public License v3.0
7 stars 8 forks source link

Ores dropping wrong/not at all (IE compatibility) #40

Closed IdrisQe closed 5 years ago

IdrisQe commented 5 years ago

This started after I updated to 4.X. Currently have 4.1 and it's happening. I deleted and remade my config, generated new chunks, and it still is messed up. Ores generate fine, but some don't drop anything. Immersive Engineering copper ore, silver ore, and a few others don't drop anything even when mined with Mining Level 2/3/4. Dense Coal ore only drops 2 coal. Iron, Normal Coal, and Thaumcraft Cinnibar variants all work fine, so it seems to be an IE related issue, but likely on OSV's end since I've not updated IE in quite a while. This COULD potentially be a Unidict issue, but I've also not updated that in quite a while so it really shouldn't be. There's no errors logged or anything so I can't figure out the culprit. They still mine at normal speeds and everything, they just don't drop anything.

PersonTheCat commented 5 years ago

Hey, thanks for reporting this. I went back and tested the vanilla ores, glasshearts ores, base and modern metals ores, and a few others, and can confirm that this problem seems unique to Immersive Engineering. None of the values I previously used were changed in 4.x, so this most likely has to do with how drops are all retrieved when the game loads now, instead of being looked up every time they drop, like they were before. If that's true, this most likely implies that these ores aren't registered by the time when I need them, which means a fix probably won't be easy to achieve.

I can look at this later on today, though. I'll start by making it crash right away whenever a drop can't be found. This will make the problem more obvious and annoying, but also clarify that it's OSV's fault and needs to be fixed. Then I'll set up some debugs to verify that the items not being registered yet is actually the problem, and whether it is or isn't will help me figure out what to do from there. I'll get back to you once I get it working.

IdrisQe commented 5 years ago

I'm not sure how hard it would be, but could you possibly code it so the mod is shunted to the very end of mod loading, to be sure that every other mod is loaded before it? I'm certain I've seen mods do this before, although I can't recall which ones, and I have no idea how it was done.

On the other hand, is the Dense Ores only dropping 2 coal intended? Or is that some bug on my end? I could have sworn they normally drop 3, though that may have been a different Dense Ore mod.

PersonTheCat commented 5 years ago

Forge doesn't allow this, actually. Everything is synchronized around an event bus. OSV is the last mod in the load order, but what that means is that, for each event it subscribes to, it fires last. On the other hand, some mods like quark register their blocks at unusual times because they have special systems in place for doing that, which makes it really difficult for me to predict and work around.

The dense ore drop rate actually isn't static. It randomly multiplies the quantity by a number from 1-3, and that happens before fortune is calculated. I tested this again and was able to verify that anywhere from 1-3 lumps of coal would drop for each ore mined, ~30 blocks. So, in that case, I'm not sure what's happening. :/

IdrisQe commented 5 years ago

The coal thing was probably just poor luck on my part then.

But ah... IE has fully-visible source code https://github.com/BluSunrize/ImmersiveEngineering So maybe you can figure out what they're doing oddly that's messing with this? I'd offer to look but I don't know nearly enough about modding yet and absolutely nothing about worldgen so I wouldn't be able to tell if anything was unusual.

PersonTheCat commented 5 years ago

Hey, I appreciate it. It's cool, though. I just haven't had much time to look at it yet. I'm not really sure what the problem is, but I'll definitely be able to fix it.

PersonTheCat commented 5 years ago

A quick update. Last night, I figured out that this is related to Item#getItemFromBlock. And in fact, there's no need to add an assertion to crash the game because the block already couldn't be created with air as one of its background states, which means this is definitely related to retrieving the item from the block and not retrieving the block itself. What's especially strange is that this is the same method I used before to drop items and it was definitely working then. So, timing is definitely at play here in some way or another and I can definitely fix the problem by splitting the item loading event into two phases. I just need to figure out exactly how far apart is good enough. I'm letting you know this now because I won't be home to fix it today. The next time I'll be able to work on it is around Wednesday or so. I'll keep you posted.

IdrisQe commented 5 years ago

Thank you for the status update! I'm glad it won't be too hard to fix. And that's fine, there's no need to rush or anything. I'm patient.

PersonTheCat commented 5 years ago

Here's an early release that contains the fix. Let me know if you try this and it does or doesn't work. Thanks again for your help! ore_stone_variants-4.1.1.zip

IdrisQe commented 5 years ago

I tested it out and it appears to fix the problem! Thank you for working to fix it. I tested with multiple tool types, multiple mining levels, using hammers, using picks. It all works as expected! I'll leave this issue open until the full release, though, just so it isn't reported again.

ahangsleben commented 5 years ago

The new version seems to have fixed all of the previously broken ores for me as well, but now redstone is broken in the same way the other ores were broken. Coal seems unaffected so it probably isn't a generic entity-dropping-ore problem.

PersonTheCat commented 5 years ago

Huh. I was very surprised to see this problem in action. I don't have much time at the moment to figure this out, but I should finally have a little bit of free time to sit down and figure this out tomorrow afternoon or so. Once I get that done, I'll let you know and then go ahead and do a release. Thanks for the report!

PersonTheCat commented 5 years ago

Turns out, this was related to lit redstone no longer getting registered in the vanilla property group. Not really sure how, but I've definitely fix it now. I'll be uploading that to CurseForge in just a few minutes.