[Change] Migrated to new Feature API

This commit is contained in:
Frank 2022-07-01 13:23:36 +02:00
parent 0ec39fa2da
commit 031a14f278
16 changed files with 242 additions and 120 deletions

View file

@ -3,15 +3,17 @@ package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.DragonTreeFeature;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class DragonTreeSaplingBlock extends PottableFeatureSapling { public class DragonTreeSaplingBlock extends PottableFeatureSapling<DragonTreeFeature, NoneFeatureConfiguration> {
public DragonTreeSaplingBlock() { public DragonTreeSaplingBlock() {
super((state) -> EndFeatures.DRAGON_TREE); super((state) -> EndFeatures.DRAGON_TREE.configuredFeature);
} }
@Override @Override

View file

@ -3,15 +3,17 @@ package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.HelixTreeFeature;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class HelixTreeSaplingBlock extends PottableFeatureSapling { public class HelixTreeSaplingBlock extends PottableFeatureSapling<HelixTreeFeature, NoneFeatureConfiguration> {
public HelixTreeSaplingBlock() { public HelixTreeSaplingBlock() {
super((state) -> EndFeatures.HELIX_TREE); super((state) -> EndFeatures.HELIX_TREE.configuredFeature);
} }
@Override @Override

View file

@ -3,15 +3,17 @@ package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.LacugroveFeature;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class LacugroveSaplingBlock extends PottableFeatureSapling { public class LacugroveSaplingBlock extends PottableFeatureSapling<LacugroveFeature, NoneFeatureConfiguration> {
public LacugroveSaplingBlock() { public LacugroveSaplingBlock() {
super((state) -> EndFeatures.LACUGROVE); super((state) -> EndFeatures.LACUGROVE.configuredFeature);
} }
@Override @Override

View file

@ -3,15 +3,17 @@ package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.LucerniaFeature;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class LucerniaSaplingBlock extends PottableFeatureSapling { public class LucerniaSaplingBlock extends PottableFeatureSapling<LucerniaFeature, NoneFeatureConfiguration> {
public LucerniaSaplingBlock() { public LucerniaSaplingBlock() {
super((state) -> EndFeatures.LUCERNIA); super((state) -> EndFeatures.LUCERNIA.configuredFeature);
} }
@Override @Override

View file

@ -3,15 +3,17 @@ package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.MossyGlowshroomFeature;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class MossyGlowshroomSaplingBlock extends PottableFeatureSapling { public class MossyGlowshroomSaplingBlock extends PottableFeatureSapling<MossyGlowshroomFeature, NoneFeatureConfiguration> {
public MossyGlowshroomSaplingBlock() { public MossyGlowshroomSaplingBlock() {
super(7, (state) -> EndFeatures.MOSSY_GLOWSHROOM); super(7, (state) -> EndFeatures.MOSSY_GLOWSHROOM.configuredFeature);
} }
@Override @Override

View file

@ -3,15 +3,17 @@ package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.PythadendronTreeFeature;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class PythadendronSaplingBlock extends PottableFeatureSapling { public class PythadendronSaplingBlock extends PottableFeatureSapling<PythadendronTreeFeature, NoneFeatureConfiguration> {
public PythadendronSaplingBlock() { public PythadendronSaplingBlock() {
super((state) -> EndFeatures.PYTHADENDRON_TREE); super((state) -> EndFeatures.PYTHADENDRON_TREE.configuredFeature);
} }
@Override @Override

View file

@ -33,7 +33,7 @@ public class SmallAmaranitaBlock extends EndPlantBlock {
BlockPos bigPos = growBig(world, pos); BlockPos bigPos = growBig(world, pos);
if (bigPos != null) { if (bigPos != null) {
if (EndFeatures.GIGANTIC_AMARANITA.getFeature() if (EndFeatures.GIGANTIC_AMARANITA.getFeature()
.place(new FeaturePlaceContext<>( .place(new FeaturePlaceContext<net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration>(
Optional.empty(), Optional.empty(),
world, world,
null, null,
@ -48,7 +48,8 @@ public class SmallAmaranitaBlock extends EndPlantBlock {
} }
return; return;
} }
EndFeatures.LARGE_AMARANITA.getFeature().place(new FeaturePlaceContext<>( EndFeatures.LARGE_AMARANITA.getFeature()
.place(new FeaturePlaceContext<net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration>(
Optional.empty(), Optional.empty(),
world, world,
null, null,

View file

@ -105,7 +105,8 @@ public class SmallJellyshroomBlock extends BaseAttachedBlock implements RenderLa
@Override @Override
public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) { public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) {
BlocksHelper.setWithUpdate(world, pos, Blocks.AIR); BlocksHelper.setWithUpdate(world, pos, Blocks.AIR);
EndFeatures.JELLYSHROOM.getFeature().place(new FeaturePlaceContext<>( EndFeatures.JELLYSHROOM.getFeature()
.place(new FeaturePlaceContext<net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration>(
Optional.empty(), Optional.empty(),
world, world,
null, null,

View file

@ -3,15 +3,17 @@ package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.TenaneaFeature;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class TenaneaSaplingBlock extends PottableFeatureSapling { public class TenaneaSaplingBlock extends PottableFeatureSapling<TenaneaFeature, NoneFeatureConfiguration> {
public TenaneaSaplingBlock() { public TenaneaSaplingBlock() {
super((state) -> EndFeatures.TENANEA); super((state) -> EndFeatures.TENANEA.configuredFeature);
} }
@Override @Override

View file

@ -4,15 +4,17 @@ import org.betterx.bclib.client.render.BCLRenderLayer;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.UmbrellaTreeFeature;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class UmbrellaTreeSaplingBlock extends PottableFeatureSapling { public class UmbrellaTreeSaplingBlock extends PottableFeatureSapling<UmbrellaTreeFeature, NoneFeatureConfiguration> {
public UmbrellaTreeSaplingBlock() { public UmbrellaTreeSaplingBlock() {
super((state) -> EndFeatures.UMBRELLA_TREE); super((state) -> EndFeatures.UMBRELLA_TREE.configuredFeature);
} }
@Override @Override

View file

@ -1,19 +1,18 @@
package org.betterx.betterend.blocks.basis; package org.betterx.betterend.blocks.basis;
import org.betterx.bclib.api.v2.levelgen.features.BCLFeature;
import org.betterx.bclib.blocks.FeatureSaplingBlock; import org.betterx.bclib.blocks.FeatureSaplingBlock;
import org.betterx.betterend.interfaces.PottablePlant; import org.betterx.betterend.interfaces.PottablePlant;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
import java.util.function.Function; public abstract class PottableFeatureSapling<F extends Feature<FC>, FC extends FeatureConfiguration> extends FeatureSaplingBlock<F, FC> implements PottablePlant {
public abstract class PottableFeatureSapling extends FeatureSaplingBlock implements PottablePlant { public PottableFeatureSapling(FeatureSupplier<F, FC> featureSupplier) {
public PottableFeatureSapling(Function<BlockState, BCLFeature> featureSupplier) {
super(featureSupplier); super(featureSupplier);
} }
public PottableFeatureSapling(int light, Function<BlockState, BCLFeature> featureSupplier) { public PottableFeatureSapling(int light, FeatureSupplier<F, FC> featureSupplier) {
super(light, featureSupplier); super(light, featureSupplier);
} }
} }

View file

@ -1,7 +1,7 @@
package org.betterx.betterend.integration.byg.features; package org.betterx.betterend.integration.byg.features;
import org.betterx.bclib.api.v2.levelgen.features.BCLCommonFeatures; import org.betterx.bclib.api.v3.levelgen.features.BCLFeature;
import org.betterx.bclib.api.v2.levelgen.features.BCLFeature; import org.betterx.bclib.api.v3.levelgen.features.BCLFeatureBuilder;
import org.betterx.betterend.BetterEnd; import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.integration.Integrations; import org.betterx.betterend.integration.Integrations;
import org.betterx.betterend.integration.byg.BYGBlocks; import org.betterx.betterend.integration.byg.BYGBlocks;
@ -10,6 +10,7 @@ import org.betterx.betterend.world.features.VineFeature;
import org.betterx.betterend.world.features.WallPlantFeature; import org.betterx.betterend.world.features.WallPlantFeature;
import org.betterx.betterend.world.features.WallPlantOnLogFeature; import org.betterx.betterend.world.features.WallPlantOnLogFeature;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
@ -61,6 +62,15 @@ public class BYGFeatures {
} }
private static BCLFeature redisterVegetation(String name, Feature<NoneFeatureConfiguration> feature, int density) { private static BCLFeature redisterVegetation(String name, Feature<NoneFeatureConfiguration> feature, int density) {
return BCLCommonFeatures.makeVegetationFeature(BetterEnd.makeID(name), feature, density); ResourceLocation id = BetterEnd.makeID(name);
return BCLFeatureBuilder
.start(id, feature)
.buildAndRegister()
.place()
.countMax(density)
.squarePlacement()
.heightmap()
.onlyInBiome()
.buildAndRegister();
} }
} }

View file

@ -3,10 +3,9 @@ package org.betterx.betterend.registry;
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome; 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.BCLBiomeBuilder;
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI; import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
import org.betterx.bclib.api.v2.levelgen.features.BCLCommonFeatures;
import org.betterx.bclib.api.v2.levelgen.features.BCLFeature;
import org.betterx.bclib.api.v2.levelgen.features.BCLFeatureBuilder;
import org.betterx.bclib.api.v2.levelgen.features.features.DefaultFeature; import org.betterx.bclib.api.v2.levelgen.features.features.DefaultFeature;
import org.betterx.bclib.api.v3.levelgen.features.BCLFeature;
import org.betterx.bclib.api.v3.levelgen.features.BCLFeatureBuilder;
import org.betterx.bclib.util.JsonFactory; import org.betterx.bclib.util.JsonFactory;
import org.betterx.betterend.BetterEnd; import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.complexmaterials.StoneMaterial; import org.betterx.betterend.complexmaterials.StoneMaterial;
@ -29,11 +28,9 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.GenerationStep.Decoration; import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
import net.minecraft.world.level.levelgen.VerticalAnchor;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.levelgen.placement.CountPlacement; import net.minecraft.world.level.levelgen.placement.CountPlacement;
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement;
import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -50,26 +47,54 @@ public class EndFeatures {
new MossyGlowshroomFeature(), new MossyGlowshroomFeature(),
2 2
); );
public static final BCLFeature PYTHADENDRON_TREE = registerVegetation( public static final BCLFeature<PythadendronTreeFeature, NoneFeatureConfiguration> PYTHADENDRON_TREE = registerVegetation(
"pythadendron_tree", "pythadendron_tree",
new PythadendronTreeFeature(), new PythadendronTreeFeature(),
1 1
); );
public static final BCLFeature LACUGROVE = registerVegetation("lacugrove", new LacugroveFeature(), 4); public static final BCLFeature<LacugroveFeature, NoneFeatureConfiguration> LACUGROVE = registerVegetation(
public static final BCLFeature DRAGON_TREE = registerVegetation("dragon_tree", new DragonTreeFeature(), 2); "lacugrove",
public static final BCLFeature TENANEA = registerVegetation("tenanea", new TenaneaFeature(), 2); new LacugroveFeature(),
public static final BCLFeature HELIX_TREE = registerVegetation("helix_tree", new HelixTreeFeature(), 1); 4
public static final BCLFeature UMBRELLA_TREE = registerVegetation("umbrella_tree", new UmbrellaTreeFeature(), 2); );
public static final BCLFeature JELLYSHROOM = registerVegetation("jellyshroom", new JellyshroomFeature(), 2); public static final BCLFeature<DragonTreeFeature, NoneFeatureConfiguration> DRAGON_TREE = registerVegetation(
public static final BCLFeature GIGANTIC_AMARANITA = registerVegetation( "dragon_tree",
new DragonTreeFeature(),
2
);
public static final BCLFeature<TenaneaFeature, NoneFeatureConfiguration> TENANEA = registerVegetation(
"tenanea",
new TenaneaFeature(),
2
);
public static final BCLFeature<HelixTreeFeature, NoneFeatureConfiguration> HELIX_TREE = registerVegetation(
"helix_tree",
new HelixTreeFeature(),
1
);
public static final BCLFeature<UmbrellaTreeFeature, NoneFeatureConfiguration> UMBRELLA_TREE = registerVegetation(
"umbrella_tree",
new UmbrellaTreeFeature(),
2
);
public static final BCLFeature<JellyshroomFeature, NoneFeatureConfiguration> JELLYSHROOM = registerVegetation(
"jellyshroom",
new JellyshroomFeature(),
2
);
public static final BCLFeature<GiganticAmaranitaFeature, NoneFeatureConfiguration> GIGANTIC_AMARANITA = registerVegetation(
"gigantic_amaranita", "gigantic_amaranita",
new GiganticAmaranitaFeature(), new GiganticAmaranitaFeature(),
1 1
); );
public static final BCLFeature LUCERNIA = registerVegetation("lucernia", new LucerniaFeature(), 3); public static final BCLFeature<LucerniaFeature, NoneFeatureConfiguration> LUCERNIA = registerVegetation(
"lucernia",
new LucerniaFeature(),
3
);
// Bushes // // Bushes //
public static final BCLFeature PYTHADENDRON_BUSH = registerVegetation( public static final BCLFeature<BushFeature, NoneFeatureConfiguration> PYTHADENDRON_BUSH = registerVegetation(
"pythadendron_bush", "pythadendron_bush",
new BushFeature( new BushFeature(
EndBlocks.PYTHADENDRON_LEAVES, EndBlocks.PYTHADENDRON_LEAVES,
@ -77,7 +102,7 @@ public class EndFeatures {
), ),
3 3
); );
public static final BCLFeature DRAGON_TREE_BUSH = registerVegetation( public static final BCLFeature<BushFeature, NoneFeatureConfiguration> DRAGON_TREE_BUSH = registerVegetation(
"dragon_tree_bush", "dragon_tree_bush",
new BushFeature( new BushFeature(
EndBlocks.DRAGON_TREE_LEAVES, EndBlocks.DRAGON_TREE_LEAVES,
@ -85,14 +110,22 @@ public class EndFeatures {
), ),
5 5
); );
public static final BCLFeature TENANEA_BUSH = registerVegetation("tenanea_bush", new TenaneaBushFeature(), 6); public static final BCLFeature<TenaneaBushFeature, NoneFeatureConfiguration> TENANEA_BUSH = registerVegetation(
public static final BCLFeature LUMECORN = registerVegetation("lumecorn", new Lumecorn(), 5); "tenanea_bush",
public static final BCLFeature LARGE_AMARANITA = registerVegetation( new TenaneaBushFeature(),
6
);
public static final BCLFeature<Lumecorn, NoneFeatureConfiguration> LUMECORN = registerVegetation(
"lumecorn",
new Lumecorn(),
5
);
public static final BCLFeature<LargeAmaranitaFeature, NoneFeatureConfiguration> LARGE_AMARANITA = registerVegetation(
"large_amaranita", "large_amaranita",
new LargeAmaranitaFeature(), new LargeAmaranitaFeature(),
5 5
); );
public static final BCLFeature LUCERNIA_BUSH = registerVegetation( public static final BCLFeature<BushWithOuterFeature, NoneFeatureConfiguration> LUCERNIA_BUSH = registerVegetation(
"lucernia_bush", "lucernia_bush",
new BushWithOuterFeature( new BushWithOuterFeature(
EndBlocks.LUCERNIA_LEAVES, EndBlocks.LUCERNIA_LEAVES,
@ -101,7 +134,7 @@ public class EndFeatures {
), ),
10 10
); );
public static final BCLFeature LUCERNIA_BUSH_RARE = registerVegetation( public static final BCLFeature<BushWithOuterFeature, NoneFeatureConfiguration> LUCERNIA_BUSH_RARE = registerVegetation(
"lucernia_bush_rare", "lucernia_bush_rare",
new BushWithOuterFeature( new BushWithOuterFeature(
EndBlocks.LUCERNIA_LEAVES, EndBlocks.LUCERNIA_LEAVES,
@ -110,10 +143,14 @@ public class EndFeatures {
), ),
1 1
); );
public static final BCLFeature NEON_CACTUS = registerVegetation("neon_cactus", new NeonCactusFeature(), 2); public static final BCLFeature<NeonCactusFeature, NoneFeatureConfiguration> NEON_CACTUS = registerVegetation(
"neon_cactus",
new NeonCactusFeature(),
2
);
// Plants // // Plants //
public static final BCLFeature UMBRELLA_MOSS = registerVegetation( public static final BCLFeature<DoublePlantFeature, NoneFeatureConfiguration> UMBRELLA_MOSS = registerVegetation(
"umbrella_moss", "umbrella_moss",
new DoublePlantFeature( new DoublePlantFeature(
EndBlocks.UMBRELLA_MOSS, EndBlocks.UMBRELLA_MOSS,
@ -122,7 +159,7 @@ public class EndFeatures {
), ),
3 3
); );
public static final BCLFeature CREEPING_MOSS = registerVegetation( public static final BCLFeature<SinglePlantFeature, NoneFeatureConfiguration> CREEPING_MOSS = registerVegetation(
"creeping_moss", "creeping_moss",
new SinglePlantFeature( new SinglePlantFeature(
EndBlocks.CREEPING_MOSS, EndBlocks.CREEPING_MOSS,
@ -130,13 +167,17 @@ public class EndFeatures {
), ),
3 3
); );
public static final BCLFeature BLUE_VINE = registerVegetation("blue_vine", new BlueVineFeature(), 1); public static final BCLFeature<BlueVineFeature, NoneFeatureConfiguration> BLUE_VINE = registerVegetation(
public static final BCLFeature CHORUS_GRASS = registerVegetation( "blue_vine",
new BlueVineFeature(),
1
);
public static final BCLFeature<SinglePlantFeature, NoneFeatureConfiguration> CHORUS_GRASS = registerVegetation(
"chorus_grass", "chorus_grass",
new SinglePlantFeature(EndBlocks.CHORUS_GRASS, 4), new SinglePlantFeature(EndBlocks.CHORUS_GRASS, 4),
3 3
); );
public static final BCLFeature CRYSTAL_GRASS = registerVegetation( public static final BCLFeature<SinglePlantFeature, NoneFeatureConfiguration> CRYSTAL_GRASS = registerVegetation(
"crystal_grass", "crystal_grass",
new SinglePlantFeature( new SinglePlantFeature(
EndBlocks.CRYSTAL_GRASS, EndBlocks.CRYSTAL_GRASS,
@ -145,7 +186,7 @@ public class EndFeatures {
), ),
5 5
); );
public static final BCLFeature SHADOW_PLANT = registerVegetation( public static final BCLFeature<SinglePlantFeature, NoneFeatureConfiguration> SHADOW_PLANT = registerVegetation(
"shadow_plant", "shadow_plant",
new SinglePlantFeature(EndBlocks.SHADOW_PLANT, 6), new SinglePlantFeature(EndBlocks.SHADOW_PLANT, 6),
5 5
@ -567,6 +608,8 @@ public class EndFeatures {
BetterEnd.makeID("overworld_island"), BetterEnd.makeID("overworld_island"),
new BiomeIslandFeature() new BiomeIslandFeature()
) )
.buildAndRegister()
.place()
.decoration(Decoration.RAW_GENERATION) .decoration(Decoration.RAW_GENERATION)
.buildAndRegister(); .buildAndRegister();
public static final BCLFeature FLAMAEA = registerVegetation( public static final BCLFeature FLAMAEA = registerVegetation(
@ -585,12 +628,18 @@ public class EndFeatures {
public static final BCLFeature FLOATING_SPIRE = registerRawGen("floating_spire", new FloatingSpireFeature(), 8); public static final BCLFeature FLOATING_SPIRE = registerRawGen("floating_spire", new FloatingSpireFeature(), 8);
public static final BCLFeature GEYSER = registerRawGen("geyser", new GeyserFeature(), 8); public static final BCLFeature GEYSER = registerRawGen("geyser", new GeyserFeature(), 8);
public static final BCLFeature SULPHURIC_LAKE = registerLake("sulphuric_lake", new SulphuricLakeFeature(), 8); public static final BCLFeature SULPHURIC_LAKE = registerLake("sulphuric_lake", new SulphuricLakeFeature(), 8);
public static final BCLFeature SULPHURIC_CAVE = BCLCommonFeatures.makeCountFeature( public static final BCLFeature SULPHURIC_CAVE = BCLFeatureBuilder
.start(
BetterEnd.makeID("sulphuric_cave"), BetterEnd.makeID("sulphuric_cave"),
Decoration.RAW_GENERATION, new SulphuricCaveFeature()
new SulphuricCaveFeature(), )
2 .buildAndRegister()
); .place()
.decoration(Decoration.RAW_GENERATION)
.count(2)
.squarePlacement()
.onlyInBiome()
.buildAndRegister();
public static final BCLFeature ICE_STAR = registerRawGen("ice_star", new IceStarFeature(5, 15, 10, 25), 15); public static final BCLFeature ICE_STAR = registerRawGen("ice_star", new IceStarFeature(5, 15, 10, 25), 15);
public static final BCLFeature ICE_STAR_SMALL = registerRawGen( public static final BCLFeature ICE_STAR_SMALL = registerRawGen(
"ice_star_small", "ice_star_small",
@ -610,11 +659,16 @@ public class EndFeatures {
10 10
); );
public static final BCLFeature FALLEN_PILLAR = registerChanced("fallen_pillar", new FallenPillarFeature(), 20); public static final BCLFeature FALLEN_PILLAR = registerChanced("fallen_pillar", new FallenPillarFeature(), 20);
public static final BCLFeature TUNEL_CAVE = BCLCommonFeatures.makeChunkFeature( public static final BCLFeature TUNEL_CAVE = BCLFeatureBuilder
.start(
BetterEnd.makeID("tunel_cave"), BetterEnd.makeID("tunel_cave"),
Decoration.RAW_GENERATION,
new TunelCaveFeature() new TunelCaveFeature()
); ).buildAndRegister()
.place()
.decoration(Decoration.RAW_GENERATION)
.count(1)
.onlyInBiome()
.buildAndRegister();
public static final BCLFeature UMBRALITH_ARCH = registerChanced("umbralith_arch", new ArchFeature( public static final BCLFeature UMBRALITH_ARCH = registerChanced("umbralith_arch", new ArchFeature(
EndBlocks.UMBRALITH.stone, EndBlocks.UMBRALITH.stone,
pos -> UmbraValleyBiome.getSurface(pos.getX(), pos.getZ()).defaultBlockState() pos -> UmbraValleyBiome.getSurface(pos.getX(), pos.getZ()).defaultBlockState()
@ -695,46 +749,73 @@ public class EndFeatures {
int density int density
) { ) {
ResourceLocation id = BetterEnd.makeID(name); ResourceLocation id = BetterEnd.makeID(name);
return BCLFeatureBuilder.start(id, feature).countLayersMax(density).onlyInBiome().buildAndRegister(); return BCLFeatureBuilder.start(id, feature)
.buildAndRegister()
.place()
.countMax(density)
.onlyInBiome()
.buildAndRegister();
} }
private static BCLFeature registerRawGen(String name, Feature<NoneFeatureConfiguration> feature, int chance) { private static BCLFeature registerRawGen(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
return BCLCommonFeatures.makeChancedFeature(BetterEnd.makeID(name), Decoration.RAW_GENERATION, feature, chance); return BCLFeatureBuilder
.start(BetterEnd.makeID(name), feature)
.buildAndRegister()
.place()
.decoration(Decoration.RAW_GENERATION)
.onceEvery(chance)
.squarePlacement()
.onlyInBiome()
.buildAndRegister();
} }
private static BCLFeature registerLake(String name, Feature<NoneFeatureConfiguration> feature, int chance) { private static BCLFeature registerLake(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
return BCLCommonFeatures.makeChancedFeature(BetterEnd.makeID(name), Decoration.LAKES, feature, chance); return BCLFeatureBuilder
.start(BetterEnd.makeID(name), feature)
.buildAndRegister()
.place()
.decoration(Decoration.LAKES)
.onceEvery(chance)
.squarePlacement()
.onlyInBiome()
.buildAndRegister();
} }
private static BCLFeature registerChanced(String name, Feature<NoneFeatureConfiguration> feature, int chance) { private static BCLFeature registerChanced(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
return BCLCommonFeatures.makeChancedFeature( return
BetterEnd.makeID(name), BCLFeatureBuilder
Decoration.SURFACE_STRUCTURES, .start(BetterEnd.makeID(name), feature)
feature, .buildAndRegister()
chance .place()
); .decoration(Decoration.SURFACE_STRUCTURES)
.onceEvery(chance)
.squarePlacement()
.onlyInBiome()
.buildAndRegister();
} }
private static BCLFeature registerOre(String name, Block blockOre, int veins, int veinSize) { private static BCLFeature registerOre(String name, Block blockOre, int veins, int veinSize) {
return BCLCommonFeatures.makeOreFeature( return BCLFeatureBuilder
BetterEnd.makeID(name), .startOre(BetterEnd.makeID(name))
blockOre, .add(Blocks.END_STONE, blockOre)
Blocks.END_STONE, .veinSize(veinSize)
veins, .discardChanceOnAirExposure(0)
veinSize, .buildAndRegister()
0, .place()
HeightRangePlacement.uniform( .decoration(Decoration.UNDERGROUND_ORES)
VerticalAnchor.bottom(), .count(veins)
VerticalAnchor.absolute(128) .randomHeight8FromFloorCeil()
), .squarePlacement()
false .onlyInBiome()
); .buildAndRegister();
} }
private static BCLFeature registerLayer(String name, Block block, float radius, int minY, int maxY, int count) { private static BCLFeature registerLayer(String name, Block block, float radius, int minY, int maxY, int count) {
OreLayerFeature layer = new OreLayerFeature(block.defaultBlockState(), radius, minY, maxY); OreLayerFeature layer = new OreLayerFeature(block.defaultBlockState(), radius, minY, maxY);
return BCLFeatureBuilder return BCLFeatureBuilder
.start(BetterEnd.makeID(name), layer) .start(BetterEnd.makeID(name), layer)
.buildAndRegister()
.place()
.decoration(GenerationStep.Decoration.UNDERGROUND_ORES) .decoration(GenerationStep.Decoration.UNDERGROUND_ORES)
.modifier(CountPlacement.of(count)) .modifier(CountPlacement.of(count))
.buildAndRegister(); .buildAndRegister();
@ -784,12 +865,15 @@ public class EndFeatures {
if (BuiltinRegistries.PLACED_FEATURE.containsKey(id)) { if (BuiltinRegistries.PLACED_FEATURE.containsKey(id)) {
PlacedFeature placed = BuiltinRegistries.PLACED_FEATURE.get(id); PlacedFeature placed = BuiltinRegistries.PLACED_FEATURE.get(id);
Feature<?> feature = Registry.FEATURE.get(id); Feature<NoneFeatureConfiguration> feature = (Feature<NoneFeatureConfiguration>) Registry.FEATURE.get(id);
return BCLFeatureBuilder return BCLFeatureBuilder
.start(id, feature) .start(id, feature)
.configuration((NoneFeatureConfiguration) placed.feature().value().config())
.buildAndRegister()
.place()
.decoration(Decoration.SURFACE_STRUCTURES) .decoration(Decoration.SURFACE_STRUCTURES)
.modifier(placed.placement()) .modifier(placed.placement())
.buildAndRegister(placed.feature().value().config()); .buildAndRegister();
} }
String path = "/data/" + ns + "/structures/biome/" + nm + "/"; String path = "/data/" + ns + "/structures/biome/" + nm + "/";
@ -809,12 +893,17 @@ public class EndFeatures {
list.add(new ListFeature.StructureInfo(structure, offsetY, terrainMerge)); list.add(new ListFeature.StructureInfo(structure, offsetY, terrainMerge));
}); });
if (!list.isEmpty()) { if (!list.isEmpty()) {
return BCLCommonFeatures.makeChancedFeature( return BCLFeatureBuilder.start(
new ResourceLocation(ns, nm + "_structures"), new ResourceLocation(ns, nm + "_structures"),
Decoration.SURFACE_STRUCTURES, new BuildingListFeature(list, Blocks.END_STONE.defaultBlockState())
new BuildingListFeature(list, Blocks.END_STONE.defaultBlockState()), )
10 .buildAndRegister()
); .place()
.decoration(Decoration.SURFACE_STRUCTURES)
.onceEvery(10)
.squarePlacement()
.onlyInBiome()
.buildAndRegister();
} }
} }
} }

View file

@ -4,8 +4,8 @@ import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder.BiomeSupplier; import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder.BiomeSupplier;
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeSettings; import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeSettings;
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI; import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
import org.betterx.bclib.api.v2.levelgen.features.BCLCommonFeatures; import org.betterx.bclib.api.v3.levelgen.features.BCLFeature;
import org.betterx.bclib.api.v2.levelgen.features.BCLFeature; import org.betterx.bclib.api.v3.levelgen.features.BCLFeatureBuilder;
import org.betterx.bclib.util.WeightedList; import org.betterx.bclib.util.WeightedList;
import org.betterx.betterend.BetterEnd; import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.registry.EndSounds; import org.betterx.betterend.registry.EndSounds;
@ -28,11 +28,17 @@ public class EndCaveBiome extends EndBiome {
@Override @Override
protected void addCustomBuildData(BCLBiomeBuilder builder) { protected void addCustomBuildData(BCLBiomeBuilder builder) {
BCLFeature feature = BCLCommonFeatures.makeChunkFeature( BCLFeature feature = BCLFeatureBuilder
.start(
BetterEnd.makeID(ID.getPath() + "_cave_populator"), BetterEnd.makeID(ID.getPath() + "_cave_populator"),
GenerationStep.Decoration.RAW_GENERATION,
new CaveChunkPopulatorFeature(() -> (EndCaveBiome) BiomeAPI.getBiome(ID)) new CaveChunkPopulatorFeature(() -> (EndCaveBiome) BiomeAPI.getBiome(ID))
); )
.buildAndRegister()
.place()
.decoration(GenerationStep.Decoration.RAW_GENERATION)
.count(1)
.onlyInBiome()
.buildAndRegister();
builder.feature(feature) builder.feature(feature)
.music(EndSounds.MUSIC_CAVES) .music(EndSounds.MUSIC_CAVES)

View file

@ -88,7 +88,7 @@ public class FloatingSpireFeature extends SpireFeature {
support.forEach((bpos) -> { support.forEach((bpos) -> {
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) { if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
EndFeatures.TENANEA_BUSH.getFeature() EndFeatures.TENANEA_BUSH.getFeature()
.place(new FeaturePlaceContext<>( .place(new FeaturePlaceContext<NoneFeatureConfiguration>(
Optional.empty(), Optional.empty(),
world, world,
chunkGenerator, chunkGenerator,

View file

@ -88,7 +88,7 @@ public class SpireFeature extends DefaultFeature {
support.forEach((bpos) -> { support.forEach((bpos) -> {
if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) { if (BiomeAPI.getFromBiome(world.getBiome(bpos)) == EndBiomes.BLOSSOMING_SPIRES) {
EndFeatures.TENANEA_BUSH.getFeature() EndFeatures.TENANEA_BUSH.getFeature()
.place(new FeaturePlaceContext<>( .place(new FeaturePlaceContext<NoneFeatureConfiguration>(
Optional.empty(), Optional.empty(),
world, world,
chunkGenerator, chunkGenerator,