oitsjustjose / Geolosys

A logical, geological system in Minecraft
GNU General Public License v3.0
43 stars 37 forks source link

Samples don't appear sometimes #305

Open tungstonminer opened 2 years ago

tungstonminer commented 2 years ago

Versions:

What happens:

Deposits in snowy climates should still generate samples on the surface, even if they have to disrupt the surface snow layer (e.g., removing a minecraft:snow block).

What should happen:

No samples are generated at all. I used a world-stripper mod to remove all "ordinary" blocks except samples and ore blocks. I was able to see the ore, but not the sample. Repeating the same operation in other climates shows both the ore and the samples.

tungstonminer commented 2 years ago

I have to correct the above. Sometimes sample simply don't appear at all. Doesn't look like snow (or not) has anything to do with it. For example, I've been scratching my head about why I can't find any coal. After turning on the debugging data in the lot, I teleported exactly to where it says it placed a pluton. I stripped out the world to find the coal exactly where it says it should be:

2022-04-29_10 17 38

However, if I stand on that deposit and look up:

2022-04-29_10 18 05

Not a single sample to be seen (except those related to a different pluton nearby).

I did override the config file, but everything looks correct:

{
    "config": {
        "blocks": {
            "default": [
                {
                    "block": "geolosys:bituminous_coal_ore",
                    "chance": 0.7
                },
                {
                    "block": null,
                    "chance": 0.3
                }
            ],
            "minecraft:deepslate": [
                {
                    "block": "geolosys:deepslate_bituminous_coal_ore",
                    "chance": 0.7
                },
                {
                    "block": null,
                    "chance": 0.3
                }
            ]
        },
        "dimensions": {
            "filter": [
                "overworld"
            ],
            "isBlacklist": false
        },
        "generationWeight": 9,
        "samples": [
            {
                "block": "geolosys:bituminous_coal_ore_sample",
                "chance": 1
            }
        ],
        "size": 48,
        "spread": 12,
        "yMax": 32,
        "yMin": -32
    },
    "type": "geolosys:deposit_sparse"
}

...and there are no errors reported in the log:

[09:55:48] [Render thread/INFO]: Preparing to load deposit datafile geolosys:ore/bituminous_coal
[09:55:48] [Render thread/INFO]: Sparse deposit with Blocks=[null, Block{geolosys:deepslate_bituminous_coal_ore}, Block{geolosys:bituminous_coal_ore}], Samples=[Block{geolosys:bituminous_coal_ore_sample}[waterlogged=false]], Y Range=[-32,32], Size of deposit =48, Spread=12
<snip>
[10:08:15] [Worker-Main-9/INFO]: Generated Sparse deposit with Blocks=[null, Block{geolosys:deepslate_bituminous_coal_ore}, Block{geolosys:bituminous_coal_ore}], Samples=[Block{geolosys:bituminous_coal_ore_sample}[waterlogged=false]], Y Range=[-32,32], Size of deposit =48, Spread=12 in Chunk [9, -24] (Pos [144 211 -384])
tungstonminer commented 2 years ago

I did a little digging around in the code, and I found where the samples are generated. I figured it would help to mention that my maxSamplesPerChunk = 8.

oitsjustjose commented 2 years ago

Might have to do with some of the changes to the logic for multiple deposits in a single chunk, this might be on my end. Have you tested in 1.18.2 with the latest build perhaps? Just want to check that I haven't already fixed it :)

tungstonminer commented 2 years ago

I'm afraid not. Several of the mods in my modpack (Create, in particular) weren't available for 1.18.2 when I set everything up.

oitsjustjose commented 2 years ago

I see - for now let's keep this open, and when you can test in 1.18.2 we'll reconvene :)

richardmv commented 2 years ago

I'm running into a similar issue in 1.16.5. I'm using the mod Blame, which gave me the following information.

These ConfiguredFeature were unabled to be turned into JSON which is... bad.
 This is all the info we can get about the ConfiguredFeature

 Error msg is: Unknown registry element com.oitsjustjose.geolosys.common.world.feature.DepositFeature@16ccdef7
 Registry Name: null
 Top level cf [feature:com.oitsjustjose.geolosys.common.world.feature.DepositFeature@16ccdef7 | config: net.minecraft.world.gen.feature.NoFeatureConfig@1a94621]
 bottomost level cf [feature:com.oitsjustjose.geolosys.common.world.feature.DepositFeature@16ccdef7 | config: net.minecraft.world.gen.feature.NoFeatureConfig@1a94621]
 Partial JSON Result: Optional.empty

I'm hoping that's helpful/relevant. For some additional info, I was using Geolosys 5.1.5 up until recently but ran into errors when creating custom JSON files. Ores that did not have custom data files would generate fine, but none of my custom entries would generate at all. So I updated to 6.0.2; I'm not getting any errors now for my JSON files, but I'm not seeing any samples. I haven't tried any ore detection to see if the ores are actually spawning. That's going to be my next step in testing.

richardmv commented 2 years ago

Either my luck is worse than I ever imagined or ores aren't spawning at all, so this seems like a different issue. I'm also running a ton of mods in addition to Geolosys, so my input might not help much at all (though I'll be happy if it did).

Update: Decided to poke into the config files (which did not appear to be changed at all by me at any point as far as I can tell). I noticed the following setting:

#The percentage chance that a given chunk will be devoid of any Geolosys plutons (higher means more space between plutons)
#Range: 0.0 ~ 1.0
chunkSkipChance = 1.0

That certainly explains some things... I changed it to 0.9 to see if that helps. When I loaded my new world, Notepad++ informed me that the file had been modified by another program. My debug settings had been turned off and the chunkSkipChance was set to 0.15. The entire underground is ore now. So I seem to have isolated my problem. It probably won't help the issue at hand, unfortunately, but I didn't want to just delete my messages and figured I'd share my folly.

kyragit commented 1 year ago

Wow, so I was experiencing this issue too so I decided to look at the source code to see if I could find anything. As it turns out, I found this line:

int maxSampleCnt = (Math.min(CommonConfig.MAX_SAMPLES_PER_CHUNK.get(), (this.size / CommonConfig.MAX_SAMPLES_PER_CHUNK.get()) + (this.size % CommonConfig.MAX_SAMPLES_PER_CHUNK.get()))) * (spread / 16);

maxSampleCnt here is the amount of samples that will be generated, and if you're familiar with how programming languages handle division between integers, you'll notice that if spread is less than 16, maxSampleCnt is multiplied by zero, thus causing none to generate. I know this mod is no longer maintained, but I figured I'd point it out here in case anyone else has this issue. The simple solution is just to never use spread values less than 16 in your datapacks.