Registered custom feature

Changes to be committed:
	modified:   src/main/java/org/dimdev/dimdoors/DimensionalDoorsInitializer.java
	new file:   src/main/java/org/dimdev/dimdoors/world/ModFeatures.java
	modified:   src/main/java/org/dimdev/dimdoors/world/feature/CustomOreFeatureConfig.java
This commit is contained in:
SD 2020-07-19 15:06:37 +05:30
parent 3b8f221e92
commit 17a0564425
No known key found for this signature in database
GPG key ID: E36B57EE08544BC5
3 changed files with 30 additions and 3 deletions

View file

@ -13,6 +13,7 @@ import org.dimdev.dimdoors.pockets.SchematicHandler;
import org.dimdev.dimdoors.rift.targets.*;
import org.dimdev.dimdoors.world.ModBiomes;
import org.dimdev.dimdoors.world.ModDimensions;
import org.dimdev.dimdoors.world.ModFeatures;
import net.minecraft.util.Identifier;
@ -27,6 +28,7 @@ public class DimensionalDoorsInitializer implements ModInitializer {
ModDimensions.init();
ModEntityTypes.init();
ModBiomes.init();
ModFeatures.init();
this.registerCommands();

View file

@ -0,0 +1,28 @@
package org.dimdev.dimdoors.world;
import org.dimdev.dimdoors.block.ModBlocks;
import org.dimdev.dimdoors.world.feature.CustomOreFeature;
import org.dimdev.dimdoors.world.feature.CustomOreFeatureConfig;
import net.minecraft.block.Blocks;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.decorator.Decorator;
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
public class ModFeatures {
public static final Feature<OreFeatureConfig> ORE = Registry.register(Registry.FEATURE, new Identifier("dimdoors", "custom_ore"), new CustomOreFeature(CustomOreFeatureConfig.CODEC));
public static void init() {
CustomOreFeatureConfig eternalFluidFabricConfig = new CustomOreFeatureConfig(blockState -> blockState == ModBlocks.UNRAVELLED_FABRIC.getDefaultState(), ModBlocks.ETERNAL_FLUID.getDefaultState(), 16);
RangeDecoratorConfig eternalFluidFabricRange = new RangeDecoratorConfig(2, 0, 5, 24);
ModBiomes.LIMBO.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, ORE.configure(eternalFluidFabricConfig).createDecoratedFeature(Decorator.COUNT_RANGE.configure(eternalFluidFabricRange)));
CustomOreFeatureConfig eternalFluidBedrockConfig = new CustomOreFeatureConfig(blockState -> blockState == Blocks.BEDROCK.getDefaultState(), ModBlocks.ETERNAL_FLUID.getDefaultState(), 16);
RangeDecoratorConfig eternalFluidBedrockRange = new RangeDecoratorConfig(1, 0, 0, 6);
ModBiomes.LIMBO.addFeature(GenerationStep.Feature.UNDERGROUND_ORES, ORE.configure(eternalFluidBedrockConfig).createDecoratedFeature(Decorator.COUNT_RANGE.configure(eternalFluidBedrockRange)));
}
}

View file

@ -6,13 +6,10 @@ import net.minecraft.block.BlockState;
import net.minecraft.world.gen.feature.OreFeatureConfig;
public class CustomOreFeatureConfig extends OreFeatureConfig {
Predicate<BlockState> blockPredicate;
public CustomOreFeatureConfig(Predicate<BlockState> blockPredicate, BlockState blockState, int size) {
super(null, blockState, size);
this.blockPredicate = blockPredicate;
}
}