mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-05 07:16:10 +00:00
fix BinaryColumn
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<ConfiguredFeature<?, ?>> 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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<DefaultFeatureConfig> {
|
||||
public PopulatorFeature(Codec<DefaultFeatureConfig> codec) {
|
||||
super(codec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(FeatureContext<DefaultFeatureConfig> 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;
|
||||
}
|
||||
}
|
||||
@@ -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<ConfiguredCarver<?>> configuredCarverSupplier : vanilla.getGenerationSettings().getCarversForStep(carver)) {
|
||||
|
||||
Reference in New Issue
Block a user