Work around crash while loading flatworld with modded structures. (#7764)

* Work around crash while loading flatworld with modded structures.

* Maybe fix issue with gradle daemon leaking memory and slowing down CI builds.
This commit is contained in:
David Quintana authored and GitHub committed 2021-05-14 00:11:46 +02:00
1 parent 474b47ea51
commit 6f3da80b5a
3 files changed
+22 -2

No files matched your search

-2
View File
@@ -39,8 +39,6 @@ changelog.txt
*.7z
/logs/
gradle.properties
!/mdk/gradle.properties
/projects/forge/rejects/
# Srg2Source causes import bugs on these patches. If you intentionnally change these, remove the ignore.
+4
View File
@@ -0,0 +1,4 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
@@ -1,5 +1,23 @@
--- a/net/minecraft/world/gen/FlatGenerationSettings.java
+++ b/net/minecraft/world/gen/FlatGenerationSettings.java
@@ -147,8 +_,16 @@
biomegenerationsettings$builder.func_242513_a(GenerationStage.Decoration.LAKES, Features.field_243790_P);
}
+ Map<Structure<?>, StructureFeature<?, ?>> map = new java.util.HashMap<>(field_202247_j);
+ net.minecraft.util.registry.WorldGenRegistries.field_243654_f.func_201756_e().filter(f -> !map.containsKey(f.field_236268_b_)).forEach(f -> map.put(f.field_236268_b_, f));
for(Entry<Structure<?>, StructureSeparationSettings> entry : this.field_236933_f_.func_236195_a_().entrySet()) {
- biomegenerationsettings$builder.func_242516_a(biomegenerationsettings.func_242491_a(field_202247_j.get(entry.getKey())));
+ if (!map.containsKey(entry.getKey())) {
+ field_211404_q.error("FORGE: There's no known StructureFeature for {} when preparing the {} flatworld biome." +
+ " The structure will be skipped and may not spawn." +
+ " Please register your StructureFeatures in the WorldGenRegistries!", entry.getKey().func_143025_a(), biome.getRegistryName());
+ continue;
+ }
+ biomegenerationsettings$builder.func_242516_a(biomegenerationsettings.func_242491_a(map.get(entry.getKey())));
}
boolean flag = (!this.field_202245_D || this.field_242867_d.func_230519_c_(biome).equals(Optional.of(Biomes.field_185440_P))) && this.field_236934_k_;
@@ -174,7 +_,7 @@
}
}