More Feature Changes

This commit is contained in:
Frank 2022-07-01 18:23:04 +02:00
parent 5c3a9986bc
commit 6dd711930e
19 changed files with 417 additions and 213 deletions

View file

@ -3,7 +3,6 @@ package org.betterx.betterend.registry;
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
import org.betterx.bclib.api.v2.levelgen.features.features.DefaultFeature;
import org.betterx.bclib.api.v3.levelgen.features.BCLConfigureFeature;
import org.betterx.bclib.api.v3.levelgen.features.BCLFeature;
import org.betterx.bclib.api.v3.levelgen.features.BCLFeatureBuilder;
@ -35,6 +34,8 @@ import net.minecraft.world.level.levelgen.feature.OreFeature;
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
import net.minecraft.world.level.levelgen.feature.configurations.SimpleBlockConfiguration;
import net.minecraft.world.level.levelgen.feature.stateproviders.SimpleStateProvider;
import net.minecraft.world.level.levelgen.placement.CountPlacement;
import com.google.common.collect.Lists;
@ -45,6 +46,10 @@ import java.io.InputStream;
import java.util.List;
public class EndFeatures {
public static final StalactiteFeature STALACTITE_FEATURE = inlineBuild(
"stalactite_feature",
new StalactiteFeature()
);
public static final BuildingListFeature BUILDING_LIST_FEATURE = inlineBuild(
"building_list_feature",
new BuildingListFeature()
@ -144,69 +149,86 @@ public class EndFeatures {
"end_lotus_feature",
new EndLotusFeature()
);
public static final BushFeature BUSH_FEATURE = inlineBuild(
"bush_feature",
new BushFeature()
);
public static final SingleBlockFeature SINGLE_BLOCK_FEATURE = inlineBuild(
"single_block_feature",
new SingleBlockFeature()
);
public static final BushWithOuterFeature BUSH_WITH_OUTER_FEATURE = inlineBuild(
"bush_with_outer_feature",
new BushWithOuterFeature()
);
public static final BCLFeature<MossyGlowshroomFeature, NoneFeatureConfiguration> MOSSY_GLOWSHROOM = registerVegetation(
"mossy_glowshroom",
new MossyGlowshroomFeature(),
inlineBuild("mossy_glowshroom", new MossyGlowshroomFeature()),
2
);
public static final BCLFeature<PythadendronTreeFeature, NoneFeatureConfiguration> PYTHADENDRON_TREE = registerVegetation(
"pythadendron_tree",
new PythadendronTreeFeature(),
inlineBuild("pythadendron_tree", new PythadendronTreeFeature()),
1
);
public static final BCLFeature<LacugroveFeature, NoneFeatureConfiguration> LACUGROVE = registerVegetation(
"lacugrove",
new LacugroveFeature(),
inlineBuild("lacugrove", new LacugroveFeature()),
4
);
public static final BCLFeature<DragonTreeFeature, NoneFeatureConfiguration> DRAGON_TREE = registerVegetation(
"dragon_tree",
new DragonTreeFeature(),
inlineBuild("dragon_tree", new DragonTreeFeature()),
2
);
public static final BCLFeature<TenaneaFeature, NoneFeatureConfiguration> TENANEA = registerVegetation(
"tenanea",
new TenaneaFeature(),
inlineBuild("tenanea", new TenaneaFeature()),
2
);
public static final BCLFeature<HelixTreeFeature, NoneFeatureConfiguration> HELIX_TREE = registerVegetation(
"helix_tree",
new HelixTreeFeature(),
inlineBuild("helix_tree", new HelixTreeFeature()),
1
);
public static final BCLFeature<UmbrellaTreeFeature, NoneFeatureConfiguration> UMBRELLA_TREE = registerVegetation(
"umbrella_tree",
new UmbrellaTreeFeature(),
inlineBuild("umbrella_tree", new UmbrellaTreeFeature()),
2
);
public static final BCLFeature<JellyshroomFeature, NoneFeatureConfiguration> JELLYSHROOM = registerVegetation(
"jellyshroom",
new JellyshroomFeature(),
inlineBuild("jellyshroom", new JellyshroomFeature()),
2
);
public static final BCLFeature<GiganticAmaranitaFeature, NoneFeatureConfiguration> GIGANTIC_AMARANITA = registerVegetation(
"gigantic_amaranita",
new GiganticAmaranitaFeature(),
inlineBuild("gigantic_amaranita", new GiganticAmaranitaFeature()),
1
);
public static final BCLFeature<LucerniaFeature, NoneFeatureConfiguration> LUCERNIA = registerVegetation(
"lucernia",
new LucerniaFeature(),
inlineBuild("lucernia", new LucerniaFeature()),
3
);
// Bushes //
public static final BCLFeature<BushFeature, NoneFeatureConfiguration> PYTHADENDRON_BUSH = registerVegetation(
public static final BCLFeature<BushFeature, BushFeatureConfig> PYTHADENDRON_BUSH = registerVegetation(
"pythadendron_bush",
new BushFeature(
BUSH_FEATURE,
new BushFeatureConfig(
EndBlocks.PYTHADENDRON_LEAVES,
EndBlocks.PYTHADENDRON.getBark()
),
3
);
public static final BCLFeature<BushFeature, NoneFeatureConfiguration> DRAGON_TREE_BUSH = registerVegetation(
public static final BCLFeature<BushFeature, BushFeatureConfig> DRAGON_TREE_BUSH = registerVegetation(
"dragon_tree_bush",
new BushFeature(
BUSH_FEATURE,
new BushFeatureConfig(
EndBlocks.DRAGON_TREE_LEAVES,
EndBlocks.DRAGON_TREE.getBark()
),
@ -214,31 +236,33 @@ public class EndFeatures {
);
public static final BCLFeature<TenaneaBushFeature, NoneFeatureConfiguration> TENANEA_BUSH = registerVegetation(
"tenanea_bush",
new TenaneaBushFeature(),
inlineBuild("tenanea_bush", new TenaneaBushFeature()),
6
);
public static final BCLFeature<Lumecorn, NoneFeatureConfiguration> LUMECORN = registerVegetation(
"lumecorn",
new Lumecorn(),
inlineBuild("lumecorn", new Lumecorn()),
5
);
public static final BCLFeature<LargeAmaranitaFeature, NoneFeatureConfiguration> LARGE_AMARANITA = registerVegetation(
"large_amaranita",
new LargeAmaranitaFeature(),
inlineBuild("large_amaranita", new LargeAmaranitaFeature()),
5
);
public static final BCLFeature<BushWithOuterFeature, NoneFeatureConfiguration> LUCERNIA_BUSH = registerVegetation(
public static final BCLFeature<BushWithOuterFeature, BushWithOuterFeatureConfig> LUCERNIA_BUSH = registerVegetation(
"lucernia_bush",
new BushWithOuterFeature(
BUSH_WITH_OUTER_FEATURE,
new BushWithOuterFeatureConfig(
EndBlocks.LUCERNIA_LEAVES,
EndBlocks.LUCERNIA_OUTER_LEAVES,
EndBlocks.LUCERNIA.getBark()
),
10
);
public static final BCLFeature<BushWithOuterFeature, NoneFeatureConfiguration> LUCERNIA_BUSH_RARE = registerVegetation(
public static final BCLFeature<BushWithOuterFeature, BushWithOuterFeatureConfig> LUCERNIA_BUSH_RARE = registerVegetation(
"lucernia_bush_rare",
new BushWithOuterFeature(
BUSH_WITH_OUTER_FEATURE,
new BushWithOuterFeatureConfig(
EndBlocks.LUCERNIA_LEAVES,
EndBlocks.LUCERNIA_OUTER_LEAVES,
EndBlocks.LUCERNIA.getBark()
@ -247,7 +271,7 @@ public class EndFeatures {
);
public static final BCLFeature<NeonCactusFeature, NoneFeatureConfiguration> NEON_CACTUS = registerVegetation(
"neon_cactus",
new NeonCactusFeature(),
inlineBuild("neon_cactus", new NeonCactusFeature()),
2
);
@ -766,50 +790,51 @@ public class EndFeatures {
20
);
public static final EndLakeFeature END_LAKE_FEATURE = inlineBuild("end_lake", new EndLakeFeature());
// Terrain //
public static final BCLFeature<EndLakeFeature, NoneFeatureConfiguration> END_LAKE = registerLake(
"end_lake",
new EndLakeFeature(),
END_LAKE_FEATURE,
4
);
public static final BCLFeature<EndLakeFeature, NoneFeatureConfiguration> END_LAKE_NORMAL = registerLake(
"end_lake_normal",
new EndLakeFeature(),
END_LAKE_FEATURE,
20
);
public static final BCLFeature<EndLakeFeature, NoneFeatureConfiguration> END_LAKE_RARE = registerLake(
"end_lake_rare",
new EndLakeFeature(),
END_LAKE_FEATURE,
40
);
public static final BCLFeature<DesertLakeFeature, NoneFeatureConfiguration> DESERT_LAKE = registerLake(
"desert_lake",
new DesertLakeFeature(),
inlineBuild("desert_lake", new DesertLakeFeature()),
8
);
public static final BCLFeature<RoundCaveFeature, NoneFeatureConfiguration> ROUND_CAVE = registerRawGen(
"round_cave",
new RoundCaveFeature(),
inlineBuild("round_cave", new RoundCaveFeature()),
2
);
public static final BCLFeature<SpireFeature, NoneFeatureConfiguration> SPIRE = registerRawGen(
"spire",
new SpireFeature(),
inlineBuild("spire", new SpireFeature()),
4
);
public static final BCLFeature<FloatingSpireFeature, NoneFeatureConfiguration> FLOATING_SPIRE = registerRawGen(
"floating_spire",
new FloatingSpireFeature(),
inlineBuild("floating_spire", new FloatingSpireFeature()),
8
);
public static final BCLFeature<GeyserFeature, NoneFeatureConfiguration> GEYSER = registerRawGen(
"geyser",
new GeyserFeature(),
inlineBuild("geyser", new GeyserFeature()),
8
);
public static final BCLFeature<SulphuricLakeFeature, NoneFeatureConfiguration> SULPHURIC_LAKE = registerLake(
"sulphuric_lake",
new SulphuricLakeFeature(),
inlineBuild("sulphuric_lake", new SulphuricLakeFeature()),
8
);
public static final BCLFeature<SulphuricCaveFeature, NoneFeatureConfiguration> SULPHURIC_CAVE = BCLFeatureBuilder
@ -824,39 +849,43 @@ public class EndFeatures {
.squarePlacement()
.onlyInBiome()
.buildAndRegister();
public static final BCLFeature<IceStarFeature, NoneFeatureConfiguration> ICE_STAR = registerRawGen(
public static final IceStarFeature ICE_STAR_FEATURE = inlineBuild("ice_star", new IceStarFeature());
public static final BCLFeature<IceStarFeature, IceStarFeatureConfig> ICE_STAR = registerRawGen(
"ice_star",
new IceStarFeature(5, 15, 10, 25),
ICE_STAR_FEATURE,
new IceStarFeatureConfig(5, 15, 10, 25),
15
);
public static final BCLFeature<IceStarFeature, NoneFeatureConfiguration> ICE_STAR_SMALL = registerRawGen(
public static final BCLFeature<IceStarFeature, IceStarFeatureConfig> ICE_STAR_SMALL = registerRawGen(
"ice_star_small",
new IceStarFeature(3, 5, 7, 12),
ICE_STAR_FEATURE,
new IceStarFeatureConfig(3, 5, 7, 12),
8
);
public static final BCLFeature<SurfaceVentFeature, NoneFeatureConfiguration> SURFACE_VENT = registerChanced(
"surface_vent",
new SurfaceVentFeature(),
inlineBuild("surface_vent", new SurfaceVentFeature()),
4
);
public static final BCLFeature<SulphurHillFeature, NoneFeatureConfiguration> SULPHUR_HILL = registerChanced(
"sulphur_hill",
new SulphurHillFeature(),
inlineBuild("sulphur_hill", new SulphurHillFeature()),
8
);
public static final BCLFeature<ObsidianPillarBasementFeature, NoneFeatureConfiguration> OBSIDIAN_PILLAR_BASEMENT = registerChanced(
"obsidian_pillar_basement",
new ObsidianPillarBasementFeature(),
inlineBuild("obsidian_pillar_basement", new ObsidianPillarBasementFeature()),
8
);
public static final BCLFeature<ObsidianBoulderFeature, NoneFeatureConfiguration> OBSIDIAN_BOULDER = registerChanced(
"obsidian_boulder",
new ObsidianBoulderFeature(),
inlineBuild("obsidian_boulder", new ObsidianBoulderFeature()),
10
);
public static final BCLFeature<FallenPillarFeature, NoneFeatureConfiguration> FALLEN_PILLAR = registerChanced(
"fallen_pillar",
new FallenPillarFeature(),
inlineBuild("fallen_pillar", new FallenPillarFeature()),
20
);
public static final BCLFeature<TunelCaveFeature, NoneFeatureConfiguration> TUNEL_CAVE = BCLFeatureBuilder
@ -930,7 +959,7 @@ public class EndFeatures {
// Buildings
public static final BCLFeature<CrashedShipFeature, NBTFeatureConfig> CRASHED_SHIP = registerChanced(
"crashed_ship",
new CrashedShipFeature(),
inlineBuild("crashed_ship", new CrashedShipFeature()),
new NBTFeatureConfig(EndBiome.Config.DEFAULT_MATERIAL.getTopMaterial()),
500
);
@ -938,16 +967,36 @@ public class EndFeatures {
// Mobs
public static final BCLFeature<SilkMothNestFeature, NoneFeatureConfiguration> SILK_MOTH_NEST = registerChanced(
"silk_moth_nest",
new SilkMothNestFeature(),
inlineBuild("silk_moth_nest", new SilkMothNestFeature()),
2
);
// Caves
public static final DefaultFeature SMARAGDANT_CRYSTAL = new SmaragdantCrystalFeature();
public static final DefaultFeature SMARAGDANT_CRYSTAL_SHARD = new SingleBlockFeature(EndBlocks.SMARAGDANT_CRYSTAL_SHARD);
public static final DefaultFeature BIG_AURORA_CRYSTAL = new BigAuroraCrystalFeature();
public static final DefaultFeature CAVE_BUSH = new BushFeature(EndBlocks.CAVE_BUSH, EndBlocks.CAVE_BUSH);
public static final DefaultFeature CAVE_GRASS = new SingleBlockFeature(EndBlocks.CAVE_GRASS);
public static final BCLConfigureFeature<SmaragdantCrystalFeature, NoneFeatureConfiguration> SMARAGDANT_CRYSTAL = BCLFeatureBuilder
.start(
BetterEnd.makeID("smaragdant_crystal"),
inlineBuild("smaragdant_crystal", new SmaragdantCrystalFeature())
)
.buildAndRegister();
public static final BCLConfigureFeature<SingleBlockFeature, SimpleBlockConfiguration> SMARAGDANT_CRYSTAL_SHARD = BCLFeatureBuilder
.start(BetterEnd.makeID("smaragdant_crystal_shard"), SINGLE_BLOCK_FEATURE)
.configuration(new SimpleBlockConfiguration(SimpleStateProvider.simple(EndBlocks.SMARAGDANT_CRYSTAL_SHARD)))
.buildAndRegister();
public static final BCLConfigureFeature<BigAuroraCrystalFeature, NoneFeatureConfiguration> BIG_AURORA_CRYSTAL = BCLFeatureBuilder
.start(
BetterEnd.makeID("big_aurora_crystal"),
inlineBuild("big_aurora_crystal", new BigAuroraCrystalFeature())
)
.buildAndRegister();
public static final BCLConfigureFeature<BushFeature, BushFeatureConfig> CAVE_BUSH = BCLFeatureBuilder
.start(BetterEnd.makeID("cave_bush"), BUSH_FEATURE)
.configuration(new BushFeatureConfig(EndBlocks.CAVE_BUSH, EndBlocks.CAVE_BUSH))
.buildAndRegister();
public static final BCLConfigureFeature<SingleBlockFeature, SimpleBlockConfiguration> CAVE_GRASS = BCLFeatureBuilder
.start(BetterEnd.makeID("cave_grass"), SINGLE_BLOCK_FEATURE)
.configuration(new SimpleBlockConfiguration(SimpleStateProvider.simple(EndBlocks.CAVE_GRASS)))
.buildAndRegister();
public static final BCLConfigureFeature<VineFeature, VineFeatureConfig> RUBINEA = BCLFeatureBuilder
.start(BetterEnd.makeID("rubinea"), VINE_FEATURE)
.configuration(new VineFeatureConfig(EndBlocks.RUBINEA, 8))
@ -958,28 +1007,40 @@ public class EndFeatures {
.configuration(new VineFeatureConfig(EndBlocks.MAGNULA, 8))
.buildAndRegister();
public static final DefaultFeature END_STONE_STALACTITE = new StalactiteFeature(
true,
EndBlocks.END_STONE_STALACTITE,
Blocks.END_STONE
);
public static final DefaultFeature END_STONE_STALAGMITE = new StalactiteFeature(
false,
EndBlocks.END_STONE_STALACTITE,
Blocks.END_STONE
);
public static final DefaultFeature END_STONE_STALACTITE_CAVEMOSS = new StalactiteFeature(
true,
EndBlocks.END_STONE_STALACTITE_CAVEMOSS,
Blocks.END_STONE,
EndBlocks.CAVE_MOSS
);
public static final DefaultFeature END_STONE_STALAGMITE_CAVEMOSS = new StalactiteFeature(
false,
EndBlocks.END_STONE_STALACTITE_CAVEMOSS,
EndBlocks.CAVE_MOSS
);
public static final DefaultFeature CAVE_PUMPKIN = new CavePumpkinFeature();
public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALACTITE = BCLFeatureBuilder
.start(BetterEnd.makeID("end_stone_stalactite"), STALACTITE_FEATURE)
.configuration(new StalactiteFeatureConfig(true, EndBlocks.END_STONE_STALACTITE, Blocks.END_STONE))
.buildAndRegister();
public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALAGMITE = BCLFeatureBuilder
.start(BetterEnd.makeID("end_stone_stalagmite"), STALACTITE_FEATURE)
.configuration(new StalactiteFeatureConfig(false, EndBlocks.END_STONE_STALACTITE, Blocks.END_STONE))
.buildAndRegister();
public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALACTITE_CAVEMOSS = BCLFeatureBuilder
.start(BetterEnd.makeID("end_stone_stalactite_cavemoss"), STALACTITE_FEATURE)
.configuration(new StalactiteFeatureConfig(
true,
EndBlocks.END_STONE_STALACTITE_CAVEMOSS,
Blocks.END_STONE,
EndBlocks.CAVE_MOSS
))
.buildAndRegister();
public static final BCLConfigureFeature<StalactiteFeature, StalactiteFeatureConfig> END_STONE_STALAGMITE_CAVEMOSS = BCLFeatureBuilder
.start(BetterEnd.makeID("end_stone_stalagmite_cavemoss"), STALACTITE_FEATURE)
.configuration(new StalactiteFeatureConfig(
false,
EndBlocks.END_STONE_STALACTITE_CAVEMOSS,
EndBlocks.CAVE_MOSS
))
.buildAndRegister();
public static final BCLConfigureFeature<CavePumpkinFeature, NoneFeatureConfiguration> CAVE_PUMPKIN = BCLFeatureBuilder
.start(
BetterEnd.makeID("cave_pumpkin"),
inlineBuild("cave_pumpkin", new CavePumpkinFeature())
)
.buildAndRegister();
public static <F extends Feature<FC>, FC extends FeatureConfiguration> F inlineBuild(String name, F feature) {
ResourceLocation l = BetterEnd.makeID(name);
@ -1019,7 +1080,6 @@ public class EndFeatures {
FC config,
int density
) {
feature = inlineBuild("feature_" + name, feature);
ResourceLocation id = BetterEnd.makeID(name);
return BCLFeatureBuilder.start(id, feature)
.configuration(config)
@ -1035,9 +1095,18 @@ public class EndFeatures {
F feature,
int chance
) {
feature = inlineBuild("feature_" + name, feature);
return registerRawGen(name, feature, FeatureConfiguration.NONE, chance);
}
private static <F extends Feature<FC>, FC extends FeatureConfiguration> BCLFeature<F, FC> registerRawGen(
String name,
F feature,
FC config,
int chance
) {
return BCLFeatureBuilder
.start(BetterEnd.makeID(name), feature)
.configuration(config)
.buildAndRegister()
.place()
.decoration(Decoration.RAW_GENERATION)
@ -1052,7 +1121,6 @@ public class EndFeatures {
F feature,
int chance
) {
feature = inlineBuild("feature_" + name, feature);
return BCLFeatureBuilder
.start(BetterEnd.makeID(name), feature)
.buildAndRegister()
@ -1078,7 +1146,6 @@ public class EndFeatures {
FC config,
int chance
) {
feature = inlineBuild("feature_" + name, feature);
return
BCLFeatureBuilder
.start(BetterEnd.makeID(name), feature)

View file

@ -14,9 +14,9 @@ public class EmptyAuroraCaveBiome extends EndCaveBiome.Config {
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
super(biomeID, biome, settings);
this.addFloorFeature(EndFeatures.BIG_AURORA_CRYSTAL, 1);
this.addFloorFeature(EndFeatures.BIG_AURORA_CRYSTAL.configuredFeature, 1);
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE, 1);
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE.configuredFeature, 1);
}
@Override

View file

@ -13,8 +13,8 @@ public class EmptyEndCaveBiome extends EndCaveBiome.Config {
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
super(biomeID, biome, settings);
this.addFloorFeature(EndFeatures.END_STONE_STALAGMITE, 1);
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE, 1);
this.addFloorFeature(EndFeatures.END_STONE_STALAGMITE.configuredFeature, 1);
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE.configuredFeature, 1);
}
@Override

View file

@ -14,10 +14,10 @@ public class EmptySmaragdantCaveBiome extends EndCaveBiome.Config {
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
super(biomeID, biome, settings);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL, 1);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL_SHARD, 20);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL.configuredFeature, 1);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL_SHARD.configuredFeature, 20);
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE, 1);
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE.configuredFeature, 1);
}
@Override

View file

@ -14,12 +14,13 @@ import org.betterx.betterend.world.features.terrain.caves.CaveChunkPopulatorFeat
import org.betterx.betterend.world.features.terrain.caves.CaveChunkPopulatorFeatureConfig;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
public class EndCaveBiome extends EndBiome {
public static abstract class Config extends EndBiome.Config {
@ -59,26 +60,26 @@ public class EndCaveBiome extends EndBiome {
}
}
private final WeightedList<Feature<?>> floorFeatures = new WeightedList<Feature<?>>();
private final WeightedList<Feature<?>> ceilFeatures = new WeightedList<Feature<?>>();
private final WeightedList<Holder<? extends ConfiguredFeature<?, ?>>> floorFeatures = new WeightedList<>();
private final WeightedList<Holder<? extends ConfiguredFeature<?, ?>>> ceilFeatures = new WeightedList<>();
public EndCaveBiome(ResourceLocation biomeID, Biome biome, BCLBiomeSettings settings) {
super(biomeID, biome, settings);
}
public void addFloorFeature(Feature<?> feature, float weight) {
public void addFloorFeature(Holder<? extends ConfiguredFeature<?, ?>> feature, float weight) {
floorFeatures.add(feature, weight);
}
public void addCeilFeature(Feature<?> feature, float weight) {
public void addCeilFeature(Holder<? extends ConfiguredFeature<?, ?>> feature, float weight) {
ceilFeatures.add(feature, weight);
}
public Feature<?> getFloorFeature(RandomSource random) {
public Holder<? extends ConfiguredFeature<?, ?>> getFloorFeature(RandomSource random) {
return floorFeatures.isEmpty() ? null : floorFeatures.get(random);
}
public Feature<?> getCeilFeature(RandomSource random) {
public Holder<? extends ConfiguredFeature<?, ?>> getCeilFeature(RandomSource random) {
return ceilFeatures.isEmpty() ? null : ceilFeatures.get(random);
}

View file

@ -19,16 +19,16 @@ public class LushAuroraCaveBiome extends EndCaveBiome.Config {
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
super(biomeID, biome, settings);
this.addFloorFeature(EndFeatures.BIG_AURORA_CRYSTAL, 1);
this.addFloorFeature(EndFeatures.CAVE_BUSH, 5);
this.addFloorFeature(EndFeatures.CAVE_GRASS, 40);
this.addFloorFeature(EndFeatures.END_STONE_STALAGMITE_CAVEMOSS, 5);
this.addFloorFeature(EndFeatures.BIG_AURORA_CRYSTAL.configuredFeature, 1);
this.addFloorFeature(EndFeatures.CAVE_BUSH.configuredFeature, 5);
this.addFloorFeature(EndFeatures.CAVE_GRASS.configuredFeature, 40);
this.addFloorFeature(EndFeatures.END_STONE_STALAGMITE_CAVEMOSS.configuredFeature, 5);
this.addCeilFeature(EndFeatures.CAVE_BUSH, 1);
this.addCeilFeature(EndFeatures.CAVE_PUMPKIN, 1);
this.addCeilFeature(EndFeatures.RUBINEA.getFeature(), 3);
this.addCeilFeature(EndFeatures.MAGNULA.getFeature(), 1);
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE_CAVEMOSS, 10);
this.addCeilFeature(EndFeatures.CAVE_BUSH.configuredFeature, 1);
this.addCeilFeature(EndFeatures.CAVE_PUMPKIN.configuredFeature, 1);
this.addCeilFeature(EndFeatures.RUBINEA.configuredFeature, 3);
this.addCeilFeature(EndFeatures.MAGNULA.configuredFeature, 1);
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE_CAVEMOSS.configuredFeature, 10);
}
@Override

View file

@ -17,10 +17,10 @@ public class LushSmaragdantCaveBiome extends EndCaveBiome.Config {
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
super(biomeID, biome, settings);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL, 1);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL_SHARD, 20);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL.configuredFeature, 1);
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL_SHARD.configuredFeature, 20);
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE, 1);
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE.configuredFeature, 1);
}
@Override

View file

@ -19,24 +19,21 @@ import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import java.util.function.Function;
public class BushFeature extends DefaultFeature {
public class BushFeature extends Feature<BushFeatureConfig> {
private static final Function<BlockState, Boolean> REPLACE;
private final Block leaves;
private final Block stem;
public BushFeature(Block leaves, Block stem) {
this.leaves = leaves;
this.stem = stem;
public BushFeature() {
super(BushFeatureConfig.CODEC);
}
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
public boolean place(FeaturePlaceContext<BushFeatureConfig> featureConfig) {
final RandomSource random = featureConfig.random();
final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level();
@ -44,16 +41,19 @@ public class BushFeature extends DefaultFeature {
.is(CommonBlockTags.END_STONES))
return false;
BushFeatureConfig cfg = featureConfig.config();
Block leaves = cfg.leaves.getState(random, pos).getBlock();
BlockState stem = cfg.stem.getState(random, pos);
float radius = MHelper.randRange(1.8F, 3.5F, random);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt());
SDF sphere = new SDFSphere().setRadius(radius).setBlock(this.leaves);
SDF sphere = new SDFSphere().setRadius(radius).setBlock(leaves);
sphere = new SDFScale3D().setScale(1, 0.5F, 1).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> {
return (float) noise.eval(vec.x() * 0.2, vec.y() * 0.2, vec.z() * 0.2) * 3;
}).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> {
return MHelper.randRange(-2F, 2F, random);
}).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> (float) noise.eval(
vec.x() * 0.2,
vec.y() * 0.2,
vec.z() * 0.2
) * 3).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> MHelper.randRange(-2F, 2F, random)).setSource(sphere);
sphere = new SDFSubtraction().setSourceA(sphere)
.setSourceB(new SDFTranslate().setTranslate(0, -radius, 0).setSource(sphere));
sphere.setReplaceFunction(REPLACE);
@ -63,7 +63,7 @@ public class BushFeature extends DefaultFeature {
if (distance < 7) {
return info.getState().setValue(LeavesBlock.DISTANCE, distance);
} else {
return AIR;
return DefaultFeature.AIR;
}
}
return info.getState();

View file

@ -0,0 +1,36 @@
package org.betterx.betterend.world.features.bushes;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
import net.minecraft.world.level.levelgen.feature.stateproviders.SimpleStateProvider;
public class BushFeatureConfig implements FeatureConfiguration {
public static final Codec<BushFeatureConfig> CODEC = RecordCodecBuilder.create(instance -> instance
.group(
BlockStateProvider.CODEC.fieldOf("leaves").forGetter(o -> o.leaves),
BlockStateProvider.CODEC.fieldOf("stem").forGetter(o -> o.stem)
)
.apply(instance, BushFeatureConfig::new));
public final BlockStateProvider leaves;
public final BlockStateProvider stem;
public BushFeatureConfig(Block leaves, Block stem) {
this(
SimpleStateProvider.simple(leaves),
SimpleStateProvider.simple(stem)
);
}
public BushFeatureConfig(
BlockStateProvider leaves,
BlockStateProvider stem
) {
this.leaves = leaves;
this.stem = stem;
}
}

View file

@ -20,29 +20,30 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import java.util.function.Function;
public class BushWithOuterFeature extends DefaultFeature {
public class BushWithOuterFeature extends Feature<BushWithOuterFeatureConfig> {
private static final Direction[] DIRECTIONS = Direction.values();
private static final Function<BlockState, Boolean> REPLACE;
private final Block outer_leaves;
private final Block leaves;
private final Block stem;
public BushWithOuterFeature(Block leaves, Block outer_leaves, Block stem) {
this.outer_leaves = outer_leaves;
this.leaves = leaves;
this.stem = stem;
public BushWithOuterFeature() {
super(BushWithOuterFeatureConfig.CODEC);
}
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
public boolean place(FeaturePlaceContext<BushWithOuterFeatureConfig> featureConfig) {
final RandomSource random = featureConfig.random();
final BlockPos pos = featureConfig.origin();
BushWithOuterFeatureConfig cfg = featureConfig.config();
BlockState outer_leaves = cfg.outer_leaves.getState(random, pos);
Block leaves = cfg.leaves.getState(random, pos).getBlock();
BlockState stem = cfg.stem.getState(random, pos);
final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(CommonBlockTags.END_STONES) && !world.getBlockState(pos.above())
.is(CommonBlockTags.END_STONES))
@ -50,14 +51,14 @@ public class BushWithOuterFeature extends DefaultFeature {
float radius = MHelper.randRange(1.8F, 3.5F, random);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt());
SDF sphere = new SDFSphere().setRadius(radius).setBlock(this.leaves);
SDF sphere = new SDFSphere().setRadius(radius).setBlock(leaves);
sphere = new SDFScale3D().setScale(1, 0.5F, 1).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> {
return (float) noise.eval(vec.x() * 0.2, vec.y() * 0.2, vec.z() * 0.2) * 3;
}).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> {
return MHelper.randRange(-2F, 2F, random);
}).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> (float) noise.eval(
vec.x() * 0.2,
vec.y() * 0.2,
vec.z() * 0.2
) * 3).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> MHelper.randRange(-2F, 2F, random)).setSource(sphere);
sphere = new SDFSubtraction().setSourceA(sphere)
.setSourceB(new SDFTranslate().setTranslate(0, -radius, 0).setSource(sphere));
sphere.setReplaceFunction(REPLACE);
@ -67,7 +68,7 @@ public class BushWithOuterFeature extends DefaultFeature {
if (distance < 7) {
return info.getState().setValue(LeavesBlock.DISTANCE, distance);
} else {
return AIR;
return DefaultFeature.AIR;
}
}
return info.getState();
@ -78,7 +79,7 @@ public class BushWithOuterFeature extends DefaultFeature {
if (info.getState(dir).isAir()) {
info.setBlockPos(
info.getPos().relative(dir),
outer_leaves.defaultBlockState().setValue(BlockStateProperties.FACING, dir)
outer_leaves.setValue(BlockStateProperties.FACING, dir)
);
}
}

View file

@ -0,0 +1,37 @@
package org.betterx.betterend.world.features.bushes;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
import net.minecraft.world.level.levelgen.feature.stateproviders.SimpleStateProvider;
public class BushWithOuterFeatureConfig extends BushFeatureConfig {
public static final Codec<BushWithOuterFeatureConfig> CODEC = RecordCodecBuilder.create(instance -> instance
.group(
BlockStateProvider.CODEC.fieldOf("leaves").forGetter(o -> o.leaves),
BlockStateProvider.CODEC.fieldOf("outer_leaves").forGetter(o -> o.outer_leaves),
BlockStateProvider.CODEC.fieldOf("stem").forGetter(o -> o.stem)
)
.apply(instance, BushWithOuterFeatureConfig::new));
public final BlockStateProvider outer_leaves;
public BushWithOuterFeatureConfig(Block leaves, Block outer_leaves, Block stem) {
this(
SimpleStateProvider.simple(leaves),
SimpleStateProvider.simple(outer_leaves),
SimpleStateProvider.simple(stem)
);
}
public BushWithOuterFeatureConfig(
BlockStateProvider leaves,
BlockStateProvider outer_leaves,
BlockStateProvider stem
) {
super(leaves, stem);
this.outer_leaves = outer_leaves;
}
}

View file

@ -1,6 +1,5 @@
package org.betterx.betterend.world.features.terrain;
import org.betterx.bclib.api.v2.levelgen.features.features.DefaultFeature;
import org.betterx.bclib.sdf.SDF;
import org.betterx.bclib.sdf.operator.SDFRotation;
import org.betterx.bclib.sdf.operator.SDFTranslate;
@ -14,32 +13,27 @@ import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import java.util.ArrayList;
import java.util.List;
public class IceStarFeature extends DefaultFeature {
private final float minSize;
private final float maxSize;
private final int minCount;
private final int maxCount;
public class IceStarFeature extends Feature<IceStarFeatureConfig> {
public IceStarFeature(float minSize, float maxSize, int minCount, int maxCount) {
this.minSize = minSize;
this.maxSize = maxSize;
this.minCount = minCount;
this.maxCount = maxCount;
public IceStarFeature() {
super(IceStarFeatureConfig.CODEC);
}
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
public boolean place(FeaturePlaceContext<IceStarFeatureConfig> featureConfig) {
final RandomSource random = featureConfig.random();
BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level();
float size = MHelper.randRange(minSize, maxSize, random);
int count = MHelper.randRange(minCount, maxCount, random);
IceStarFeatureConfig cfg = featureConfig.config();
float size = MHelper.randRange(cfg.minSize, cfg.maxSize, random);
int count = MHelper.randRange(cfg.minCount, cfg.maxCount, random);
List<Vector3f> points = getFibonacciPoints(count);
SDF sdf = null;
SDF spike = new SDFCappedCone().setRadius1(3 + (size - 5) * 0.2F)

View file

@ -0,0 +1,30 @@
package org.betterx.betterend.world.features.terrain;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
public class IceStarFeatureConfig implements FeatureConfiguration {
public static final Codec<IceStarFeatureConfig> CODEC = RecordCodecBuilder.create(instance -> instance
.group(
Codec.FLOAT.fieldOf("min_size").forGetter(o -> o.minSize),
Codec.FLOAT.fieldOf("max_size").forGetter(o -> o.maxSize),
Codec.INT.fieldOf("min_count").forGetter(o -> o.minCount),
Codec.INT.fieldOf("max_count").forGetter(o -> o.maxCount)
)
.apply(instance, IceStarFeatureConfig::new));
public final float minSize;
public final float maxSize;
public final int minCount;
public final int maxCount;
public IceStarFeatureConfig(float minSize, float maxSize, int minCount, int maxCount) {
this.minSize = minSize;
this.maxSize = maxSize;
this.minCount = minCount;
this.maxCount = maxCount;
}
}

View file

@ -1,36 +1,34 @@
package org.betterx.betterend.world.features.terrain;
import org.betterx.bclib.api.v2.levelgen.features.features.DefaultFeature;
import org.betterx.bclib.util.BlocksHelper;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.levelgen.feature.configurations.SimpleBlockConfiguration;
public class SingleBlockFeature extends DefaultFeature {
private final Block block;
public SingleBlockFeature(Block block) {
this.block = block;
public class SingleBlockFeature extends Feature<SimpleBlockConfiguration> {
public SingleBlockFeature() {
super(SimpleBlockConfiguration.CODEC);
}
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
public boolean place(FeaturePlaceContext<SimpleBlockConfiguration> featureConfig) {
final RandomSource random = featureConfig.random();
final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level();
final SimpleBlockConfiguration cfg = featureConfig.config();
if (!world.getBlockState(pos.below()).is(CommonBlockTags.GEN_END_STONES)) {
return false;
}
BlockState state = block.defaultBlockState();
if (block.getStateDefinition().getProperty("waterlogged") != null) {
BlockState state = cfg.toPlace().getState(random, pos);
if (state.getBlock().getStateDefinition().getProperty("waterlogged") != null) {
boolean waterlogged = !world.getFluidState(pos).isEmpty();
state = state.setValue(BlockStateProperties.WATERLOGGED, waterlogged);
}

View file

@ -1,6 +1,5 @@
package org.betterx.betterend.world.features.terrain;
import org.betterx.bclib.api.v2.levelgen.features.features.DefaultFeature;
import org.betterx.bclib.blocks.StalactiteBlock;
import org.betterx.bclib.util.BlocksHelper;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
@ -10,35 +9,30 @@ import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class StalactiteFeature extends DefaultFeature {
private final boolean ceiling;
private final Block[] ground;
private final Block block;
public class StalactiteFeature extends Feature<StalactiteFeatureConfig> {
public StalactiteFeature(boolean ceiling, Block block, Block... ground) {
this.ceiling = ceiling;
this.ground = ground;
this.block = block;
public StalactiteFeature() {
super(StalactiteFeatureConfig.CODEC);
}
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
public boolean place(FeaturePlaceContext<StalactiteFeatureConfig> featureConfig) {
final RandomSource random = featureConfig.random();
final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level();
if (!isGround(world.getBlockState(ceiling ? pos.above() : pos.below()).getBlock())) {
final StalactiteFeatureConfig cfg = featureConfig.config();
if (!cfg.allowedGround.test(world, cfg.ceiling ? pos.above() : pos.below())) {
return false;
}
MutableBlockPos mut = new MutableBlockPos().set(pos);
int height = random.nextInt(16);
int dir = ceiling ? -1 : 1;
int dir = cfg.ceiling ? -1 : 1;
boolean stalagnate = false;
for (int i = 1; i <= height; i++) {
@ -60,9 +54,9 @@ public class StalactiteFeature extends DefaultFeature {
mut.setY(pos.getY() + i * dir);
int size = stalagnate ? Mth.clamp((int) (Mth.abs(i - center) + 1), 1, 7) : height - i - 1;
boolean waterlogged = !world.getFluidState(mut).isEmpty();
BlockState base = block.defaultBlockState()
.setValue(StalactiteBlock.SIZE, size)
.setValue(BlockStateProperties.WATERLOGGED, waterlogged);
BlockState base = cfg.block.getState(random, mut)
.setValue(StalactiteBlock.SIZE, size)
.setValue(BlockStateProperties.WATERLOGGED, waterlogged);
BlockState state = stalagnate ? base.setValue(
StalactiteBlock.IS_FLOOR,
dir > 0 ? i < center : i > center
@ -72,13 +66,4 @@ public class StalactiteFeature extends DefaultFeature {
return true;
}
private boolean isGround(Block block) {
for (Block b : ground) {
if (b == block) {
return true;
}
}
return false;
}
}

View file

@ -0,0 +1,39 @@
package org.betterx.betterend.world.features.terrain;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
import net.minecraft.world.level.levelgen.feature.stateproviders.SimpleStateProvider;
public class StalactiteFeatureConfig implements FeatureConfiguration {
public static final Codec<StalactiteFeatureConfig> CODEC = RecordCodecBuilder.create(instance -> instance
.group(
Codec.BOOL.fieldOf("ceiling").forGetter(o -> o.ceiling),
BlockStateProvider.CODEC.fieldOf("states").forGetter(o -> o.block),
BlockPredicate.CODEC.fieldOf("allowed_ground").forGetter(o -> o.allowedGround)
)
.apply(instance, StalactiteFeatureConfig::new));
public final boolean ceiling;
public final BlockStateProvider block;
public final BlockPredicate allowedGround;
public StalactiteFeatureConfig(boolean ceiling, Block block, Block... ground) {
this(
ceiling,
SimpleStateProvider.simple(block),
net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate.matchesBlocks(ground)
);
}
public StalactiteFeatureConfig(boolean ceiling, BlockStateProvider block, BlockPredicate allowedGround) {
this.ceiling = ceiling;
this.block = block;
this.allowedGround = allowedGround;
}
}

View file

@ -12,12 +12,13 @@ import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import com.google.common.collect.Sets;
import java.util.Optional;
import java.util.Set;
public class CaveChunkPopulatorFeature extends Feature<CaveChunkPopulatorFeatureConfig> {
@ -32,6 +33,7 @@ public class CaveChunkPopulatorFeature extends Feature<CaveChunkPopulatorFeature
final RandomSource random = featureConfig.random();
final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level();
final ChunkGenerator chunkGenerator = featureConfig.chunkGenerator();
Set<BlockPos> floorPositions = Sets.newHashSet();
Set<BlockPos> ceilPositions = Sets.newHashSet();
int sx = (pos.getX() >> 4) << 4;
@ -41,8 +43,8 @@ public class CaveChunkPopulatorFeature extends Feature<CaveChunkPopulatorFeature
fillSets(sx, sz, world.getChunk(pos), floorPositions, ceilPositions, min, max);
EndCaveBiome biome = cfg.getCaveBiome();
BlockState surfaceBlock = Blocks.END_STONE.defaultBlockState(); //biome.getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
placeFloor(world, biome, floorPositions, random, surfaceBlock);
placeCeil(world, biome, ceilPositions, random);
placeFloor(world, chunkGenerator, biome, floorPositions, random, surfaceBlock);
placeCeil(world, chunkGenerator, biome, ceilPositions, random);
BlockFixer.fixBlocks(world, min, max);
return true;
}
@ -113,6 +115,7 @@ public class CaveChunkPopulatorFeature extends Feature<CaveChunkPopulatorFeature
protected void placeFloor(
WorldGenLevel world,
ChunkGenerator generator,
EndCaveBiome biome,
Set<BlockPos> floorPositions,
RandomSource random,
@ -122,9 +125,9 @@ public class CaveChunkPopulatorFeature extends Feature<CaveChunkPopulatorFeature
floorPositions.forEach((pos) -> {
BlocksHelper.setWithoutUpdate(world, pos, surfaceBlock);
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getFloorFeature(random);
ConfiguredFeature<?, ?> feature = biome.getFloorFeature(random).value();
if (feature != null) {
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.above(), null));
feature.place(world, generator, random, pos.above());
}
}
});
@ -132,6 +135,7 @@ public class CaveChunkPopulatorFeature extends Feature<CaveChunkPopulatorFeature
protected void placeCeil(
WorldGenLevel world,
ChunkGenerator generator,
EndCaveBiome biome,
Set<BlockPos> ceilPositions,
RandomSource random
@ -143,9 +147,9 @@ public class CaveChunkPopulatorFeature extends Feature<CaveChunkPopulatorFeature
BlocksHelper.setWithoutUpdate(world, pos, ceilBlock);
}
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getCeilFeature(random);
ConfiguredFeature<?, ?> feature = biome.getCeilFeature(random).value();
if (feature != null) {
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.below(), null));
feature.place(world, generator, random, pos.below());
}
}
});

View file

@ -22,8 +22,9 @@ import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
@ -31,7 +32,6 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import java.util.List;
import java.util.Optional;
import java.util.Set;
public abstract class EndCaveFeature extends DefaultFeature {
@ -64,6 +64,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
Set<BlockPos> caveBlocks = generate(world, center, radius, random);
if (!caveBlocks.isEmpty()) {
if (biome != null) {
ChunkGenerator generator = featureConfig.chunkGenerator();
setBiomes(world, biome, caveBlocks);
Set<BlockPos> floorPositions = Sets.newConcurrentHashSet();
Set<BlockPos> ceilPositions = Sets.newConcurrentHashSet();
@ -81,9 +82,9 @@ public abstract class EndCaveFeature extends DefaultFeature {
});
BlockState surfaceBlock = EndBiome.findTopMaterial(biome.bclBiome);
placeFloor(world, (EndCaveBiome) biome.bclBiome, floorPositions, random, surfaceBlock);
placeCeil(world, (EndCaveBiome) biome.bclBiome, ceilPositions, random);
placeWalls(world, (EndCaveBiome) biome.bclBiome, caveBlocks, random);
placeFloor(world, generator, (EndCaveBiome) biome.bclBiome, floorPositions, random, surfaceBlock);
placeCeil(world, generator, (EndCaveBiome) biome.bclBiome, ceilPositions, random);
placeWalls(world, generator, (EndCaveBiome) biome.bclBiome, caveBlocks, random);
}
fixBlocks(world, caveBlocks);
}
@ -95,6 +96,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
protected void placeFloor(
WorldGenLevel world,
ChunkGenerator generator,
EndCaveBiome biome,
Set<BlockPos> floorPositions,
RandomSource random,
@ -106,9 +108,9 @@ public abstract class EndCaveFeature extends DefaultFeature {
BlocksHelper.setWithoutUpdate(world, pos, surfaceBlock);
}
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getFloorFeature(random);
ConfiguredFeature<?, ?> feature = biome.getFloorFeature(random).value();
if (feature != null) {
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.above(), null));
feature.place(world, generator, random, pos.above());
}
}
});
@ -116,6 +118,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
protected void placeCeil(
WorldGenLevel world,
ChunkGenerator generator,
EndCaveBiome biome,
Set<BlockPos> ceilPositions,
RandomSource random
@ -127,15 +130,21 @@ public abstract class EndCaveFeature extends DefaultFeature {
BlocksHelper.setWithoutUpdate(world, pos, ceilBlock);
}
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getCeilFeature(random);
ConfiguredFeature<?, ?> feature = biome.getCeilFeature(random).value();
if (feature != null) {
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.below(), null));
feature.place(world, generator, random, pos.below());
}
}
});
}
protected void placeWalls(WorldGenLevel world, EndCaveBiome biome, Set<BlockPos> positions, RandomSource random) {
protected void placeWalls(
WorldGenLevel world,
ChunkGenerator generator,
EndCaveBiome biome,
Set<BlockPos> positions,
RandomSource random
) {
Set<BlockPos> placed = Sets.newHashSet();
positions.forEach(pos -> {
if (random.nextInt(4) == 0 && hasOpenSide(pos, positions)) {

View file

@ -21,9 +21,10 @@ import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.Heightmap.Types;
import net.minecraft.world.level.levelgen.LegacyRandomSource;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
@ -31,7 +32,6 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.IntStream;
@ -136,6 +136,7 @@ public class TunelCaveFeature extends EndCaveFeature {
return false;
}
final ChunkGenerator generator = featureConfig.chunkGenerator();
Map<BiomePicker.ActualBiome, Set<BlockPos>> floorSets = Maps.newHashMap();
Map<BiomePicker.ActualBiome, Set<BlockPos>> ceilSets = Maps.newHashMap();
MutableBlockPos mut = new MutableBlockPos();
@ -176,13 +177,13 @@ public class TunelCaveFeature extends EndCaveFeature {
floorSets.forEach((biome, floorPositions) -> {
BlockState surfaceBlock = EndBiome.findTopMaterial(biome.bclBiome);
placeFloor(world, (EndCaveBiome) biome.bclBiome, floorPositions, random, surfaceBlock);
placeFloor(world, generator, (EndCaveBiome) biome.bclBiome, floorPositions, random, surfaceBlock);
});
ceilSets.forEach((biome, ceilPositions) -> {
placeCeil(world, (EndCaveBiome) biome.bclBiome, ceilPositions, random);
placeCeil(world, generator, (EndCaveBiome) biome.bclBiome, ceilPositions, random);
});
BiomePicker.ActualBiome biome = EndBiomes.getCaveBiome(pos.getX(), pos.getZ());
placeWalls(world, (EndCaveBiome) biome.bclBiome, caveBlocks, random);
placeWalls(world, generator, (EndCaveBiome) biome.bclBiome, caveBlocks, random);
fixBlocks(world, caveBlocks);
return true;
@ -196,6 +197,7 @@ public class TunelCaveFeature extends EndCaveFeature {
@Override
protected void placeFloor(
WorldGenLevel world,
ChunkGenerator generator,
EndCaveBiome biome,
Set<BlockPos> floorPositions,
RandomSource random,
@ -207,9 +209,9 @@ public class TunelCaveFeature extends EndCaveFeature {
BlocksHelper.setWithoutUpdate(world, pos, surfaceBlock);
}
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getFloorFeature(random);
ConfiguredFeature<?, ?> feature = biome.getFloorFeature(random).value();
if (feature != null) {
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.above(), null));
feature.place(world, generator, random, pos.above());
}
}
});
@ -218,6 +220,7 @@ public class TunelCaveFeature extends EndCaveFeature {
@Override
protected void placeCeil(
WorldGenLevel world,
ChunkGenerator generator,
EndCaveBiome biome,
Set<BlockPos> ceilPositions,
RandomSource random
@ -229,9 +232,9 @@ public class TunelCaveFeature extends EndCaveFeature {
BlocksHelper.setWithoutUpdate(world, pos, ceilBlock);
}
if (density > 0 && random.nextFloat() <= density) {
Feature<?> feature = biome.getCeilFeature(random);
ConfiguredFeature<?, ?> feature = biome.getCeilFeature(random).value();
if (feature != null) {
feature.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos.below(), null));
feature.place(world, generator, random, pos.below());
}
}
});