diff --git a/common/api/core/src/main/java/com/dfsek/terra/api/structure/feature/BinaryColumn.java b/common/api/core/src/main/java/com/dfsek/terra/api/structure/feature/BinaryColumn.java index d5ca60afb..56a8776e8 100644 --- a/common/api/core/src/main/java/com/dfsek/terra/api/structure/feature/BinaryColumn.java +++ b/common/api/core/src/main/java/com/dfsek/terra/api/structure/feature/BinaryColumn.java @@ -31,7 +31,7 @@ public class BinaryColumn { public void forEach(IntConsumer consumer) { for(int y = 0; y < data.length; y++) { if(data[y]) { - consumer.accept(y - minY); + consumer.accept(y + minY); } } } diff --git a/platforms/fabric/src/main/java/com/dfsek/terra/fabric/FabricEntryPoint.java b/platforms/fabric/src/main/java/com/dfsek/terra/fabric/FabricEntryPoint.java index 918c181aa..de2e95db2 100644 --- a/platforms/fabric/src/main/java/com/dfsek/terra/fabric/FabricEntryPoint.java +++ b/platforms/fabric/src/main/java/com/dfsek/terra/fabric/FabricEntryPoint.java @@ -19,21 +19,13 @@ package com.dfsek.terra.fabric; import net.fabricmc.api.ModInitializer; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryKey; -import net.minecraft.world.gen.feature.ConfiguredFeature; -import net.minecraft.world.gen.feature.DefaultFeatureConfig; -import net.minecraft.world.gen.feature.FeatureConfig; import com.dfsek.terra.fabric.generation.FabricChunkGeneratorWrapper; -import com.dfsek.terra.fabric.generation.PopulatorFeature; import com.dfsek.terra.fabric.generation.TerraBiomeSource; public class FabricEntryPoint implements ModInitializer { - public static final PopulatorFeature POPULATOR_FEATURE = new PopulatorFeature(DefaultFeatureConfig.CODEC); - public static final ConfiguredFeature POPULATOR_CONFIGURED_FEATURE = POPULATOR_FEATURE.configure(FeatureConfig.DEFAULT); private static final PlatformImpl TERRA_PLUGIN = new PlatformImpl(); public static PlatformImpl getPlatform() { @@ -43,11 +35,6 @@ public class FabricEntryPoint implements ModInitializer { @Override public void onInitialize() { // register the things - Registry.register(Registry.FEATURE, new Identifier("terra", "populator"), POPULATOR_FEATURE); - RegistryKey> floraKey = RegistryKey.of(Registry.CONFIGURED_FEATURE_KEY, - new Identifier("terra", "populator")); - Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, floraKey.getValue(), POPULATOR_CONFIGURED_FEATURE); - Registry.register(Registry.CHUNK_GENERATOR, new Identifier("terra:terra"), FabricChunkGeneratorWrapper.CODEC); Registry.register(Registry.BIOME_SOURCE, new Identifier("terra:terra"), TerraBiomeSource.CODEC); } diff --git a/platforms/fabric/src/main/java/com/dfsek/terra/fabric/generation/FabricChunkGeneratorWrapper.java b/platforms/fabric/src/main/java/com/dfsek/terra/fabric/generation/FabricChunkGeneratorWrapper.java index 71681ccba..d5738270b 100644 --- a/platforms/fabric/src/main/java/com/dfsek/terra/fabric/generation/FabricChunkGeneratorWrapper.java +++ b/platforms/fabric/src/main/java/com/dfsek/terra/fabric/generation/FabricChunkGeneratorWrapper.java @@ -43,6 +43,7 @@ import net.minecraft.world.ChunkRegion; import net.minecraft.world.HeightLimitView; import net.minecraft.world.Heightmap; import net.minecraft.world.SpawnHelper; +import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.SpawnSettings; import net.minecraft.world.biome.source.BiomeAccess; @@ -222,14 +223,26 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C }, executor); } + @Override + public void generateFeatures(StructureWorldAccess world, Chunk chunk, StructureAccessor structureAccessor) { + delegate.getGenerationStages().forEach(populator -> { + if(!(populator instanceof Chunkified)) { + populator.populate((World) world, (com.dfsek.terra.api.world.Chunk) world); + } + }); + if(pack.vanillaFlora()) { + super.generateFeatures(world, chunk, structureAccessor); + } + } + @Override public int getSeaLevel() { - return 0; //fixme + return 64; //fixme } @Override public int getMinimumY() { - return 0; //fixmw + return -64; //fixmw } @Override diff --git a/platforms/fabric/src/main/java/com/dfsek/terra/fabric/generation/PopulatorFeature.java b/platforms/fabric/src/main/java/com/dfsek/terra/fabric/generation/PopulatorFeature.java deleted file mode 100644 index 9596f7dfa..000000000 --- a/platforms/fabric/src/main/java/com/dfsek/terra/fabric/generation/PopulatorFeature.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is part of Terra. - * - * Terra is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Terra is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Terra. If not, see . - */ - -package com.dfsek.terra.fabric.generation; - -import com.mojang.serialization.Codec; -import net.minecraft.world.StructureWorldAccess; -import net.minecraft.world.gen.chunk.ChunkGenerator; -import net.minecraft.world.gen.feature.DefaultFeatureConfig; -import net.minecraft.world.gen.feature.Feature; -import net.minecraft.world.gen.feature.util.FeatureContext; - -import com.dfsek.terra.api.world.Chunk; -import com.dfsek.terra.api.world.World; -import com.dfsek.terra.api.world.generator.Chunkified; - - -/** - * Feature wrapper for Terra populator - */ -public class PopulatorFeature extends Feature { - public PopulatorFeature(Codec codec) { - super(codec); - } - - @Override - public boolean generate(FeatureContext context) { - ChunkGenerator chunkGenerator = context.getGenerator(); - if(!(chunkGenerator instanceof FabricChunkGeneratorWrapper)) return true; - StructureWorldAccess world = context.getWorld(); - FabricChunkGeneratorWrapper gen = (FabricChunkGeneratorWrapper) chunkGenerator; - gen.getHandle().getGenerationStages().forEach(populator -> { - if(!(populator instanceof Chunkified)) { - populator.populate((World) world, (Chunk) world); - } - }); - return true; - } -} diff --git a/platforms/fabric/src/main/java/com/dfsek/terra/fabric/util/FabricUtil.java b/platforms/fabric/src/main/java/com/dfsek/terra/fabric/util/FabricUtil.java index f6ad93928..9cc44a022 100644 --- a/platforms/fabric/src/main/java/com/dfsek/terra/fabric/util/FabricUtil.java +++ b/platforms/fabric/src/main/java/com/dfsek/terra/fabric/util/FabricUtil.java @@ -74,9 +74,6 @@ public final class FabricUtil { GenerationSettings.Builder generationSettings = new GenerationSettings.Builder(); - - generationSettings.feature(GenerationStep.Feature.VEGETAL_DECORATION, FabricEntryPoint.POPULATOR_CONFIGURED_FEATURE.method_39595()); - if(pack.vanillaCaves()) { for(GenerationStep.Carver carver : GenerationStep.Carver.values()) { for(Supplier> configuredCarverSupplier : vanilla.getGenerationSettings().getCarversForStep(carver)) {