mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-10 17:56:03 +00:00
vanilla structures
This commit is contained in:
@@ -168,7 +168,7 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
|
||||
@Override
|
||||
public boolean isDebug() {
|
||||
return true;
|
||||
return config.isDebug();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -90,23 +90,24 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements Gener
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockPos locateStructure(ServerWorld world, StructureFeature<?> feature, BlockPos center, int radius, boolean skipExistingChunks) {
|
||||
String name = Objects.requireNonNull(Registry.STRUCTURE_FEATURE.getId(feature)).toString();
|
||||
TerraWorld terraWorld = TerraFabricPlugin.getInstance().getWorld((World) world);
|
||||
TerraStructure located = pack.getStructure(pack.getTemplate().getLocatable().get(name));
|
||||
if(located != null) {
|
||||
CompletableFuture<BlockPos> result = new CompletableFuture<>();
|
||||
AsyncStructureFinder finder = new AsyncStructureFinder(terraWorld.getBiomeProvider(), located, FabricAdapter.adapt(center).toLocation((World) world), 0, 500, location -> {
|
||||
result.complete(FabricAdapter.adapt(location));
|
||||
}, TerraFabricPlugin.getInstance());
|
||||
finder.run(); // Do this synchronously.
|
||||
try {
|
||||
return result.get();
|
||||
} catch(InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
if(!pack.getTemplate().disableStructures()) {
|
||||
String name = Objects.requireNonNull(Registry.STRUCTURE_FEATURE.getId(feature)).toString();
|
||||
TerraWorld terraWorld = TerraFabricPlugin.getInstance().getWorld((World) world);
|
||||
TerraStructure located = pack.getStructure(pack.getTemplate().getLocatable().get(name));
|
||||
if(located != null) {
|
||||
CompletableFuture<BlockPos> result = new CompletableFuture<>();
|
||||
AsyncStructureFinder finder = new AsyncStructureFinder(terraWorld.getBiomeProvider(), located, FabricAdapter.adapt(center).toLocation((World) world), 0, 500, location -> {
|
||||
result.complete(FabricAdapter.adapt(location));
|
||||
}, TerraFabricPlugin.getInstance());
|
||||
finder.run(); // Do this synchronously.
|
||||
try {
|
||||
return result.get();
|
||||
} catch(InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
TerraFabricPlugin.getInstance().logger().warning("No overrides are defined for \"" + name + "\"");
|
||||
return null;
|
||||
return super.locateStructure(world, feature, center, radius, skipExistingChunks);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,6 +128,7 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements Gener
|
||||
|
||||
@Override
|
||||
public boolean isStrongholdStartingChunk(ChunkPos chunkPos) {
|
||||
if(pack.getTemplate().vanillaStructures()) return super.isStrongholdStartingChunk(chunkPos);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,11 +59,13 @@ public final class FabricUtil {
|
||||
PackFeatureOptionsTemplate optionsTemplate = fabricAddon.getTemplates().get(pack);
|
||||
|
||||
if(optionsTemplate.doBiomeInjection()) {
|
||||
TerraFabricPlugin.getInstance().getDebugLogger().info("Injecting features into " + biome.getTemplate().getID());
|
||||
for(int step = 0; step < vanilla.getGenerationSettings().getFeatures().size(); step++) {
|
||||
for(Supplier<ConfiguredFeature<?, ?>> featureSupplier : vanilla.getGenerationSettings().getFeatures().get(step)) {
|
||||
Identifier key = BuiltinRegistries.CONFIGURED_FEATURE.getId(featureSupplier.get());
|
||||
if(!optionsTemplate.getExcludedBiomeFeatures().contains(key)) {
|
||||
generationSettings.feature(step, featureSupplier);
|
||||
TerraFabricPlugin.getInstance().getDebugLogger().info("Injected " + key + " at stage " + step);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user