From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Mon, 13 Jan 2020 01:00:49 +0100
Subject: [PATCH] Don't load chunk with seed based feature search


diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java
index fe7330fabe386966c2d203a190a00a785ea21be0..a1a585f5b4b2c10c41b184636149c8dde2a3ae51 100644
--- a/src/main/java/de/minebench/origami/OrigamiConfig.java
+++ b/src/main/java/de/minebench/origami/OrigamiConfig.java
@@ -112,6 +112,14 @@ public final class OrigamiConfig {
             config.addDefault("worlds.default." + path, Double.valueOf(dfl));
             return config.getDouble("worlds." + worldName + "." + path, config.getDouble("worlds.default." + path, dfl));
         }
+
+        public boolean fastFeatureSearchDontLoad = false;
+        private void fastFeatureSearch() {
+            fastFeatureSearchDontLoad = getBoolean("fast-feature-search-dont-load-chunk", fastFeatureSearchDontLoad);
+            if (fastFeatureSearchDontLoad) {
+                Bukkit.getLogger().info("Returning matching chunk rom fast search directly instead of loading it.");
+            }
+        }
     }
 
 }
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
index 8fc283f014783b76afda83097201bb7938a1f9fa..250aeaba3c29ed35a9318768dc6d95ebc092ac00 100644
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -151,6 +151,11 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration>
                                 }
                             }
                             // Paper end
+                            // Origami start - seed based feature search doesn't load
+                            if (iworldreader instanceof World && ((World) iworldreader).origamiConfig.fastFeatureSearchDontLoad) {
+                                return chunkcoordintpair.l();
+                            }
+                            // Origami end
                             IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS);
                             StructureStart<?> structurestart = structuremanager.a(SectionPosition.a(ichunkaccess.getPos(), 0), this, ichunkaccess);
 
