WIP: Ender Ore generation
This commit is contained in:
parent
d272597e87
commit
ad0834b25f
10 changed files with 90 additions and 18 deletions
|
@ -12,6 +12,7 @@ public class BiomeFoggyMushroomland extends EndBiome {
|
|||
.setWaterFogColor(119, 227, 250)
|
||||
.setSurface(BlockRegistry.END_MOSS, BlockRegistry.END_MYCELIUM)
|
||||
.addFeature(FeatureRegistry.END_LAKE)
|
||||
.addFeature(FeatureRegistry.MOSSY_GLOWSHROOM));
|
||||
.addFeature(FeatureRegistry.MOSSY_GLOWSHROOM)
|
||||
.addFeature(FeatureRegistry.ENDER_ORE));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,56 +1,79 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.structure.rule.BlockMatchRuleTest;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.decorator.ChanceDecoratorConfig;
|
||||
import net.minecraft.world.gen.decorator.Decorator;
|
||||
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeatures;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.FeatureConfig;
|
||||
import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||
import ru.betterend.BetterEnd;
|
||||
|
||||
public class EndFeature {
|
||||
private final Feature<DefaultFeatureConfig> feature;
|
||||
private final ConfiguredFeature<?, ?> featureConfigured;
|
||||
private final GenerationStep.Feature featureStep;
|
||||
private Feature<?> feature;
|
||||
private ConfiguredFeature<?, ?> featureConfigured;
|
||||
private GenerationStep.Feature featureStep;
|
||||
|
||||
private EndFeature() {}
|
||||
|
||||
public EndFeature(String name, Feature<DefaultFeatureConfig> feature, GenerationStep.Feature featureStep, ConfiguredFeature<?, ?> configuredFeature) {
|
||||
Identifier id = new Identifier(BetterEnd.MOD_ID, name);
|
||||
Identifier id = BetterEnd.getResId(name);
|
||||
this.featureStep = featureStep;
|
||||
this.feature = Registry.register(Registry.FEATURE, id, feature);
|
||||
this.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, configuredFeature);
|
||||
}
|
||||
|
||||
public EndFeature(String name, Feature<DefaultFeatureConfig> feature) {
|
||||
Identifier id = new Identifier(BetterEnd.MOD_ID, name);
|
||||
Identifier id = BetterEnd.getResId(name);
|
||||
this.featureStep = GenerationStep.Feature.VEGETAL_DECORATION;
|
||||
this.feature = Registry.register(Registry.FEATURE, id, feature);
|
||||
this.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, feature.configure(FeatureConfig.DEFAULT).decorate(Decorator.CHANCE.configure(new ChanceDecoratorConfig(100))));
|
||||
}
|
||||
|
||||
public EndFeature(String name, Feature<DefaultFeatureConfig> feature, int density) {
|
||||
Identifier id = new Identifier(BetterEnd.MOD_ID, name);
|
||||
Identifier id = BetterEnd.getResId(name);
|
||||
this.featureStep = GenerationStep.Feature.VEGETAL_DECORATION;
|
||||
this.feature = Registry.register(Registry.FEATURE, id, feature);
|
||||
this.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, feature.configure(FeatureConfig.DEFAULT).decorate(ConfiguredFeatures.Decorators.SQUARE_HEIGHTMAP).repeatRandomly(density));
|
||||
//return new EndFeature(name, feature, GenerationStep.Feature.VEGETAL_DECORATION, feature.configure(FeatureConfig.DEFAULT).decorate(ConfiguredFeatures.Decorators.SQUARE_HEIGHTMAP).repeatRandomly(4));
|
||||
}
|
||||
|
||||
public static EndFeature MakeRawGenFeature(String name, Feature<DefaultFeatureConfig> feature, int chance) {
|
||||
public static EndFeature makeRawGenFeature(String name, Feature<DefaultFeatureConfig> feature, int chance) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configure(FeatureConfig.DEFAULT).decorate(Decorator.CHANCE.configure(new ChanceDecoratorConfig(100)));
|
||||
return new EndFeature(name, feature, GenerationStep.Feature.RAW_GENERATION, configured);
|
||||
}
|
||||
|
||||
public static EndFeature MakeLakeFeature(String name, Feature<DefaultFeatureConfig> feature, int chance) {
|
||||
public static EndFeature makeLakeFeature(String name, Feature<DefaultFeatureConfig> feature, int chance) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configure(FeatureConfig.DEFAULT).decorate(Decorator.CHANCE.configure(new ChanceDecoratorConfig(100)));
|
||||
return new EndFeature(name, feature, GenerationStep.Feature.LAKES, configured);
|
||||
}
|
||||
|
||||
public Feature<DefaultFeatureConfig> getFeature() {
|
||||
|
||||
public static EndFeature makeOreFeature(String name, Block blockOre, int veins, int veinSize, int offset, int minY, int maxY) {
|
||||
EndFeature newFeature = new EndFeature();
|
||||
OreFeatureConfig featureConfig = new OreFeatureConfig(new BlockMatchRuleTest(Blocks.END_STONE), blockOre.getDefaultState(), veinSize);
|
||||
RangeDecoratorConfig rangeDecorator = new RangeDecoratorConfig(offset, minY, maxY);
|
||||
ConfiguredFeature<?, ?> oreFeature = Feature.ORE.configure(featureConfig)
|
||||
.decorate(Decorator.RANGE.configure(rangeDecorator))
|
||||
.spreadHorizontally()
|
||||
.repeat(veins);
|
||||
newFeature.feature = Feature.ORE;
|
||||
newFeature.featureStep = GenerationStep.Feature.UNDERGROUND_ORES;
|
||||
newFeature.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, BetterEnd.getResId(name), oreFeature);
|
||||
|
||||
return newFeature;
|
||||
}
|
||||
|
||||
public Feature<?> getFeature() {
|
||||
return feature;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue