Fixed #269 by creating a new ore-remover implementation #604

Merged
import_user_oitsjustjose_95mQ merged 1 commit from github/fork/EwyBoy/fix-too-many-features into 1.16 2021-06-07 12:40:48 +00:00
import_user_oitsjustjose_95mQ commented 2021-06-07 11:06:03 +00:00 (Migrated from git.oitsjustjose.com)

I saw your tweet and was intrigued by the issue and I figured out where the issue was in 2 minutes from looking at you're source code. I also have a ore mod named Ore-Tweaker (Source) that also allows users to remove ores.

By the looks of it, Geolosys ends up adding way to many features back into the BiomeGenerationSettingsBuilder that results in essentially creating something I would call an "amplified biome feature world". It is not only the lakes that are plentiful. Pretty much all world gen features picked up by Geolosys is amplified by a lot. It is just that lakes are easy to spot. The world will also contain much more Lava lakes etc.

I implemented something close to the system I am using for Ore-Tweaker to remove ores. It subtracts from the BiomeGenerationSettingsBuilder rather then adds inn and I can assure you that it is not removing to many features 😉

I kept your original code so that if you want to implement it in you're own way. The debugging has changed and moved a bit into featureRemover() and I tried to stay true to how the mod originally worked.

Also added World-Stripper (Source) using CurseMaven to easy debug that I did not mess anything up.

Before:
2021-06-07_11 40 03

After:
2021-06-07_12 18 37

All ores are still gone with my ore removing implementation:
2021-06-07_12 34 17

Also in nether (although you might wanna add Magma Block & Blackstone to remove list):
2021-06-07_12 36 06

I saw your tweet and was intrigued by the issue and I figured out where the issue was in 2 minutes from looking at you're source code. I also have a ore mod named [Ore-Tweaker](https://www.curseforge.com/minecraft/mc-mods/ore-tweaker) ([Source](https://github.com/EwyBoy/OreTweaker)) that also allows users to remove ores. By the looks of it, **Geolosys** ends up adding way to many features back into the `BiomeGenerationSettingsBuilder` that results in essentially creating something I would call an _"amplified biome feature world"_. It is not only the lakes that are plentiful. Pretty much all world gen features picked up by **Geolosys** is amplified by a lot. It is just that lakes are easy to spot. The world will also contain much more Lava lakes etc. I implemented something close to the system I am using for [Ore-Tweaker](https://github.com/EwyBoy/OreTweaker/blob/master/src/main/java/com/ewyboy/oretweaker/tweaking/construction/OreDeconstruction.java) to remove ores. It subtracts from the `BiomeGenerationSettingsBuilder` rather then adds inn and I can assure you that it is not removing to many features 😉 I kept your original code so that if you want to implement it in you're own way. The debugging has changed and moved a bit into `featureRemover()` and I tried to stay true to how the mod originally worked. Also added [World-Stripper](https://www.curseforge.com/minecraft/mc-mods/world-stripper) ([Source](https://github.com/EwyBoy/World-Stripper)) using [CurseMaven](https://www.cursemaven.com/) to easy debug that I did not mess anything up. Before: ![2021-06-07_11 40 03](/uploads/07d69711b85762ed9032e9c1c1c474cc/121006041-bcb30900-c790-11eb-92aa-cb643ddb879c.png) After: ![2021-06-07_12 18 37](/uploads/f8cdc34e8fadefe7caacdfaaff31bbcd/121006090-c9cff800-c790-11eb-9eaf-dce3e74487ce.png) All ores are still gone with my ore removing implementation: ![2021-06-07_12 34 17](/uploads/b66065a0f24a7072970cd487840910a4/121006196-e835f380-c790-11eb-9745-76a2910abe31.png) Also in nether (although you might wanna add `Magma Block` & `Blackstone` to remove list): ![2021-06-07_12 36 06](/uploads/84411b98e6a80e124ce314f0cb1426d4/121006234-f08e2e80-c790-11eb-87eb-903f742a51ca.png)
import_user_oitsjustjose_95mQ commented 2021-06-07 11:10:06 +00:00 (Migrated from git.oitsjustjose.com)

changed title from Fixed #269 {-and C-}reat{-ed-} a new ore-remover implementation to Fixed #269 {+by c+}reat{+ing+} a new ore-remover implementation

changed title from **Fixed #269 {-and C-}reat{-ed-} a new ore-remover implementation** to **Fixed #269 {+by c+}reat{+ing+} a new ore-remover implementation**
import_user_oitsjustjose_95mQ commented 2021-06-07 11:10:54 +00:00 (Migrated from git.oitsjustjose.com)

mentioned in issue #269

mentioned in issue #269
import_user_oitsjustjose_95mQ commented 2021-06-07 12:40:40 +00:00 (Migrated from git.oitsjustjose.com)

That makes perfect sense. I had disabled the ore removing code for debug almost immediately but didn't see any affect. I guess it was just by chance I was seeing an extra lake or two and thought "nope that didn't do it".

Thank you so much for taking the time to make this fix, I was up late last night doing so much needed refactoring which was helpful, but didn't solve the problem so I was pulling my hair out.

You are incredible ❤️

That makes perfect sense. I had disabled the ore removing code for debug almost immediately but didn't see any affect. I guess it was just by chance I was seeing an extra lake or two and thought "nope that didn't do it". Thank you so much for taking the time to make this fix, I was up late last night doing so much needed refactoring which was helpful, but didn't solve the problem so I was pulling my hair out. You are incredible :heart:
import_user_oitsjustjose_95mQ (Migrated from git.oitsjustjose.com) closed this pull request 2021-06-07 12:40:48 +00:00
import_user_oitsjustjose_95mQ (Migrated from git.oitsjustjose.com) merged commit into 1.16 2021-06-07 12:40:48 +00:00
import_user_oitsjustjose_95mQ commented 2021-06-07 12:49:30 +00:00 (Migrated from git.oitsjustjose.com)

No problem!
I hope everything works out perfectly in the end now. Bugs like this can truly be hard to figure out.

No problem! I hope everything works out perfectly in the end now. Bugs like this can truly be hard to figure out.
ghost commented 2021-06-07 18:27:09 +00:00 (Migrated from git.oitsjustjose.com)

Just reading through this, it's a very interesting bug with an interesting fix. Good job!

Just reading through this, it's a very interesting bug with an interesting fix. Good job!
import_user_oitsjustjose_95mQ commented 2021-06-07 18:43:19 +00:00 (Migrated from git.oitsjustjose.com)

Yes, I think the problem was due to the amount of loops in the original code:

A while loop inside a foreach loop inside a for loop causing the features to be added way to many times.
So I think each feature where being added back in as many times as there are features left in the parent loop.

for (Decoration stage : Decoration.values()) {
            int start = settings.getFeatures(stage).size();
            total += start;

            settings.getFeatures(stage).forEach((supp) -> {
                ConfiguredFeature<?, ?> configuredFeature = supp.get();
                IFeatureConfig config = configuredFeature.config;

                while (config instanceof DecoratedFeatureConfig) {
                    DecoratedFeatureConfig dconfig = (DecoratedFeatureConfig) config;
                    config = dconfig.feature.get().config;
                }

                if (config instanceof OreFeatureConfig) {
                    OreFeatureConfig conf = (OreFeatureConfig) config;
                    if (!toRm.contains(conf.state.getBlock())) {
                        toKeep.add(supp);
                    }
                } else if (config instanceof ReplaceBlockConfig) {
                    ReplaceBlockConfig conf = (ReplaceBlockConfig) config;
                    if (!toRm.contains(conf.state.getBlock())) {
                        toKeep.add(supp);
                    }
                } else {
                    toKeep.add(supp);
                }
            });

            settings.getFeatures(stage).clear();
            settings.getFeatures(stage).addAll(toKeep);

            newTotal += settings.getFeatures(stage).size();
        }
Yes, I think the problem was due to the amount of loops in the original code: A while loop inside a foreach loop inside a for loop causing the features to be added way to many times. So I think each feature where being added back in as many times as there are features left in the parent loop. ```java for (Decoration stage : Decoration.values()) { int start = settings.getFeatures(stage).size(); total += start; settings.getFeatures(stage).forEach((supp) -> { ConfiguredFeature<?, ?> configuredFeature = supp.get(); IFeatureConfig config = configuredFeature.config; while (config instanceof DecoratedFeatureConfig) { DecoratedFeatureConfig dconfig = (DecoratedFeatureConfig) config; config = dconfig.feature.get().config; } if (config instanceof OreFeatureConfig) { OreFeatureConfig conf = (OreFeatureConfig) config; if (!toRm.contains(conf.state.getBlock())) { toKeep.add(supp); } } else if (config instanceof ReplaceBlockConfig) { ReplaceBlockConfig conf = (ReplaceBlockConfig) config; if (!toRm.contains(conf.state.getBlock())) { toKeep.add(supp); } } else { toKeep.add(supp); } }); settings.getFeatures(stage).clear(); settings.getFeatures(stage).addAll(toKeep); newTotal += settings.getFeatures(stage).size(); } ```
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
oitsjustjose/Geolosys!604
No description provided.