New Feature Types for builder
This commit is contained in:
parent
8a41656182
commit
d63d773bb8
3 changed files with 131 additions and 53 deletions
|
@ -147,7 +147,9 @@ public class BCLibNetherBiomeSource extends BCLBiomeSource {
|
||||||
|
|
||||||
|
|
||||||
private static boolean isValidNetherBiome(Holder<Biome> biome, ResourceLocation location) {
|
private static boolean isValidNetherBiome(Holder<Biome> biome, ResourceLocation location) {
|
||||||
return biome.unwrapKey().get().location().toString().contains("magma_land");
|
return biome.unwrapKey().get().location().toString().equals("betternether:crimson_glowing_woods")
|
||||||
|
|| biome.unwrapKey().get().location().toString().equals("minecraft:crimson_forest")
|
||||||
|
|| biome.unwrapKey().get().location().toString().equals("betternether:crimson_pinewood");
|
||||||
|
|
||||||
// return NetherBiomes.canGenerateInNether(biome.unwrapKey().get()) ||
|
// return NetherBiomes.canGenerateInNether(biome.unwrapKey().get()) ||
|
||||||
// biome.is(BiomeTags.IS_NETHER) ||
|
// biome.is(BiomeTags.IS_NETHER) ||
|
||||||
|
|
|
@ -2,9 +2,12 @@ package org.betterx.bclib.api.v3.levelgen.features;
|
||||||
|
|
||||||
import org.betterx.bclib.api.v2.levelgen.features.BCLFeature;
|
import org.betterx.bclib.api.v2.levelgen.features.BCLFeature;
|
||||||
import org.betterx.bclib.api.v2.levelgen.features.config.PillarFeatureConfig;
|
import org.betterx.bclib.api.v2.levelgen.features.config.PillarFeatureConfig;
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.features.config.PlaceFacingBlockConfig;
|
||||||
import org.betterx.bclib.api.v2.levelgen.features.config.SequenceFeatureConfig;
|
import org.betterx.bclib.api.v2.levelgen.features.config.SequenceFeatureConfig;
|
||||||
import org.betterx.bclib.api.v2.levelgen.features.config.TemplateFeatureConfig;
|
import org.betterx.bclib.api.v2.levelgen.features.config.TemplateFeatureConfig;
|
||||||
import org.betterx.bclib.api.v2.levelgen.features.features.PillarFeature;
|
import org.betterx.bclib.api.v2.levelgen.features.features.PillarFeature;
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.features.features.PlaceBlockFeature;
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.features.features.SequenceFeature;
|
||||||
import org.betterx.bclib.api.v2.levelgen.features.features.TemplateFeature;
|
import org.betterx.bclib.api.v2.levelgen.features.features.TemplateFeature;
|
||||||
import org.betterx.bclib.api.v2.levelgen.structures.StructurePlacementType;
|
import org.betterx.bclib.api.v2.levelgen.structures.StructurePlacementType;
|
||||||
import org.betterx.bclib.api.v2.levelgen.structures.StructureWorldNBT;
|
import org.betterx.bclib.api.v2.levelgen.structures.StructureWorldNBT;
|
||||||
|
@ -25,6 +28,7 @@ import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
|
||||||
import net.minecraft.world.level.levelgen.feature.*;
|
import net.minecraft.world.level.levelgen.feature.*;
|
||||||
import net.minecraft.world.level.levelgen.feature.configurations.*;
|
import net.minecraft.world.level.levelgen.feature.configurations.*;
|
||||||
import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
|
import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.stateproviders.SimpleStateProvider;
|
||||||
import net.minecraft.world.level.levelgen.feature.stateproviders.WeightedStateProvider;
|
import net.minecraft.world.level.levelgen.feature.stateproviders.WeightedStateProvider;
|
||||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||||
import net.minecraft.world.level.levelgen.structure.templatesystem.BlockMatchTest;
|
import net.minecraft.world.level.levelgen.structure.templatesystem.BlockMatchTest;
|
||||||
|
@ -57,118 +61,118 @@ public abstract class BCLFeatureBuilder<F extends Feature<FC>, FC extends Featur
|
||||||
ResourceLocation featureID,
|
ResourceLocation featureID,
|
||||||
F feature
|
F feature
|
||||||
) {
|
) {
|
||||||
return new WithConfiguration(featureID, feature);
|
return new WithConfiguration<>(featureID, feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ForSimpleBlock<SimpleBlockFeature> start(
|
public static ForSimpleBlock start(
|
||||||
ResourceLocation featureID,
|
ResourceLocation featureID,
|
||||||
Block block
|
Block block
|
||||||
) {
|
) {
|
||||||
return start(featureID, BlockStateProvider.simple(block));
|
return start(featureID, BlockStateProvider.simple(block));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ForSimpleBlock<SimpleBlockFeature> start(
|
public static ForSimpleBlock start(
|
||||||
ResourceLocation featureID,
|
ResourceLocation featureID,
|
||||||
BlockState state
|
BlockState state
|
||||||
) {
|
) {
|
||||||
return start(featureID, BlockStateProvider.simple(state));
|
return start(featureID, BlockStateProvider.simple(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ForSimpleBlock<SimpleBlockFeature> start(
|
public static ForSimpleBlock start(
|
||||||
ResourceLocation featureID,
|
ResourceLocation featureID,
|
||||||
BlockStateProvider provider
|
BlockStateProvider provider
|
||||||
) {
|
) {
|
||||||
ForSimpleBlock<SimpleBlockFeature> builder = new ForSimpleBlock(
|
return new ForSimpleBlock(
|
||||||
featureID,
|
featureID,
|
||||||
Feature.SIMPLE_BLOCK,
|
(SimpleBlockFeature) Feature.SIMPLE_BLOCK,
|
||||||
provider
|
provider
|
||||||
);
|
);
|
||||||
return builder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WeightedBlock startWeighted(
|
public static WeightedBlock startWeighted(
|
||||||
ResourceLocation featureID
|
ResourceLocation featureID
|
||||||
) {
|
) {
|
||||||
WeightedBlock builder = new WeightedBlock(
|
return new WeightedBlock(
|
||||||
featureID,
|
featureID,
|
||||||
(SimpleBlockFeature) Feature.SIMPLE_BLOCK
|
(SimpleBlockFeature) Feature.SIMPLE_BLOCK
|
||||||
);
|
);
|
||||||
return builder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RandomPatch startRandomPatch(
|
public static RandomPatch startRandomPatch(
|
||||||
ResourceLocation featureID,
|
ResourceLocation featureID,
|
||||||
Holder<PlacedFeature> featureToPlace
|
Holder<PlacedFeature> featureToPlace
|
||||||
) {
|
) {
|
||||||
RandomPatch builder = new RandomPatch(
|
return new RandomPatch(
|
||||||
featureID,
|
featureID,
|
||||||
Feature.RANDOM_PATCH,
|
(RandomPatchFeature) Feature.RANDOM_PATCH,
|
||||||
featureToPlace
|
featureToPlace
|
||||||
);
|
);
|
||||||
return builder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NetherForrestVegetation startNetherVegetation(
|
public static NetherForrestVegetation startNetherVegetation(
|
||||||
ResourceLocation featureID
|
ResourceLocation featureID
|
||||||
) {
|
) {
|
||||||
NetherForrestVegetation builder = new NetherForrestVegetation(
|
return new NetherForrestVegetation(
|
||||||
featureID,
|
featureID,
|
||||||
Feature.NETHER_FOREST_VEGETATION
|
(NetherForestVegetationFeature) Feature.NETHER_FOREST_VEGETATION
|
||||||
);
|
);
|
||||||
return builder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static WithTemplates<Feature<TemplateFeatureConfig>> startWithTemplates(
|
public static WithTemplates startWithTemplates(
|
||||||
ResourceLocation featureID
|
ResourceLocation featureID
|
||||||
) {
|
) {
|
||||||
WithTemplates<Feature<TemplateFeatureConfig>> builder = new WithTemplates<>(
|
return new WithTemplates(
|
||||||
featureID,
|
featureID,
|
||||||
(TemplateFeature) org.betterx.bclib.api.v3.levelgen.features.BCLFeature.TEMPLATE
|
(TemplateFeature<TemplateFeatureConfig>) BCLFeature.TEMPLATE
|
||||||
);
|
);
|
||||||
return builder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AsBlockColumn<BlockColumnFeature> startColumn(
|
public static AsBlockColumn<BlockColumnFeature> startColumn(
|
||||||
ResourceLocation featureID
|
ResourceLocation featureID
|
||||||
) {
|
) {
|
||||||
AsBlockColumn<BlockColumnFeature> builder = new AsBlockColumn<>(
|
return new AsBlockColumn<>(
|
||||||
featureID,
|
featureID,
|
||||||
(BlockColumnFeature) Feature.BLOCK_COLUMN
|
(BlockColumnFeature) Feature.BLOCK_COLUMN
|
||||||
);
|
);
|
||||||
return builder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AsPillar startPillar(
|
public static AsPillar startPillar(
|
||||||
ResourceLocation featureID,
|
ResourceLocation featureID,
|
||||||
PillarFeatureConfig.KnownTransformers transformer
|
PillarFeatureConfig.KnownTransformers transformer
|
||||||
) {
|
) {
|
||||||
AsPillar builder = new AsPillar(
|
return new AsPillar(
|
||||||
featureID,
|
featureID,
|
||||||
(PillarFeature) BCLFeature.PILLAR,
|
(PillarFeature) BCLFeature.PILLAR,
|
||||||
transformer
|
transformer
|
||||||
);
|
);
|
||||||
return builder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AsSequence<Feature<SequenceFeatureConfig>> startSequence(
|
public static AsSequence startSequence(
|
||||||
ResourceLocation featureID
|
ResourceLocation featureID
|
||||||
) {
|
) {
|
||||||
AsSequence<Feature<SequenceFeatureConfig>> builder = new AsSequence<>(
|
return new AsSequence(
|
||||||
featureID,
|
featureID,
|
||||||
org.betterx.bclib.api.v3.levelgen.features.BCLFeature.SEQUENCE
|
(SequenceFeature) BCLFeature.SEQUENCE
|
||||||
);
|
);
|
||||||
return builder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AsOre startOre(
|
public static AsOre startOre(
|
||||||
ResourceLocation featureID
|
ResourceLocation featureID
|
||||||
) {
|
) {
|
||||||
AsOre builder = new AsOre(
|
return new AsOre(
|
||||||
featureID,
|
featureID,
|
||||||
(OreFeature) Feature.ORE
|
(OreFeature) Feature.ORE
|
||||||
);
|
);
|
||||||
return builder;
|
}
|
||||||
|
|
||||||
|
public static FacingBlock startFacing(
|
||||||
|
ResourceLocation featureID
|
||||||
|
) {
|
||||||
|
return new FacingBlock(
|
||||||
|
featureID,
|
||||||
|
(PlaceBlockFeature<PlaceFacingBlockConfig>) BCLFeature.PLACE_BLOCK
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -199,7 +203,7 @@ public abstract class BCLFeatureBuilder<F extends Feature<FC>, FC extends Featur
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
throw new IllegalStateException("Feature configuration for " + featureID + " can not be null!");
|
throw new IllegalStateException("Feature configuration for " + featureID + " can not be null!");
|
||||||
}
|
}
|
||||||
ConfiguredFeature<FC, F> cFeature = new ConfiguredFeature<FC, F>(feature, config);
|
ConfiguredFeature<FC, F> cFeature = new ConfiguredFeature<>(feature, config);
|
||||||
Holder<ConfiguredFeature<FC, F>> holder = holderBuilder.apply(featureID, cFeature);
|
Holder<ConfiguredFeature<FC, F>> holder = holderBuilder.apply(featureID, cFeature);
|
||||||
return new BCLConfigureFeature<>(featureID, holder, true);
|
return new BCLConfigureFeature<>(featureID, holder, true);
|
||||||
}
|
}
|
||||||
|
@ -268,8 +272,6 @@ public abstract class BCLFeatureBuilder<F extends Feature<FC>, FC extends Featur
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AsPillar extends BCLFeatureBuilder<PillarFeature, PillarFeatureConfig> {
|
public static class AsPillar extends BCLFeatureBuilder<PillarFeature, PillarFeatureConfig> {
|
||||||
private final List<Holder<PlacedFeature>> features = new LinkedList<>();
|
|
||||||
|
|
||||||
private IntProvider height;
|
private IntProvider height;
|
||||||
private BlockStateProvider stateProvider;
|
private BlockStateProvider stateProvider;
|
||||||
|
|
||||||
|
@ -332,10 +334,10 @@ public abstract class BCLFeatureBuilder<F extends Feature<FC>, FC extends Featur
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AsSequence<FF extends Feature<SequenceFeatureConfig>> extends BCLFeatureBuilder<FF, SequenceFeatureConfig> {
|
public static class AsSequence extends BCLFeatureBuilder<SequenceFeature, SequenceFeatureConfig> {
|
||||||
private final List<Holder<PlacedFeature>> features = new LinkedList<>();
|
private final List<Holder<PlacedFeature>> features = new LinkedList<>();
|
||||||
|
|
||||||
private AsSequence(ResourceLocation featureID, FF feature) {
|
private AsSequence(ResourceLocation featureID, SequenceFeature feature) {
|
||||||
super(featureID, feature);
|
super(featureID, feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,14 +443,14 @@ public abstract class BCLFeatureBuilder<F extends Feature<FC>, FC extends Featur
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class WithTemplates<FF extends Feature<TemplateFeatureConfig>> extends BCLFeatureBuilder<FF, TemplateFeatureConfig> {
|
public static class WithTemplates extends BCLFeatureBuilder<TemplateFeature<TemplateFeatureConfig>, TemplateFeatureConfig> {
|
||||||
private final List<StructureWorldNBT> templates = new LinkedList<>();
|
private final List<StructureWorldNBT> templates = new LinkedList<>();
|
||||||
|
|
||||||
private WithTemplates(ResourceLocation featureID, FF feature) {
|
private WithTemplates(ResourceLocation featureID, TemplateFeature<TemplateFeatureConfig> feature) {
|
||||||
super(featureID, feature);
|
super(featureID, feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WithTemplates<FF> add(
|
public WithTemplates add(
|
||||||
ResourceLocation location,
|
ResourceLocation location,
|
||||||
int offsetY,
|
int offsetY,
|
||||||
StructurePlacementType type,
|
StructurePlacementType type,
|
||||||
|
@ -464,13 +466,13 @@ public abstract class BCLFeatureBuilder<F extends Feature<FC>, FC extends Featur
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class NetherForrestVegetation<FF extends Feature<NetherForestVegetationConfig>> extends BCLFeatureBuilder<FF, NetherForestVegetationConfig> {
|
public static class NetherForrestVegetation extends BCLFeatureBuilder<NetherForestVegetationFeature, NetherForestVegetationConfig> {
|
||||||
private SimpleWeightedRandomList.Builder<BlockState> blocks;
|
private SimpleWeightedRandomList.Builder<BlockState> blocks;
|
||||||
private WeightedStateProvider stateProvider;
|
private WeightedStateProvider stateProvider;
|
||||||
private int spreadWidth = 8;
|
private int spreadWidth = 8;
|
||||||
private int spreadHeight = 4;
|
private int spreadHeight = 4;
|
||||||
|
|
||||||
private NetherForrestVegetation(ResourceLocation featureID, FF feature) {
|
private NetherForrestVegetation(ResourceLocation featureID, NetherForestVegetationFeature feature) {
|
||||||
super(featureID, feature);
|
super(featureID, feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,7 +532,7 @@ public abstract class BCLFeatureBuilder<F extends Feature<FC>, FC extends Featur
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class RandomPatch<FF extends Feature<RandomPatchConfiguration>> extends BCLFeatureBuilder<FF, RandomPatchConfiguration> {
|
public static class RandomPatch extends BCLFeatureBuilder<RandomPatchFeature, RandomPatchConfiguration> {
|
||||||
private final Holder<PlacedFeature> featureToPlace;
|
private final Holder<PlacedFeature> featureToPlace;
|
||||||
private int tries = 96;
|
private int tries = 96;
|
||||||
private int xzSpread = 7;
|
private int xzSpread = 7;
|
||||||
|
@ -538,7 +540,7 @@ public abstract class BCLFeatureBuilder<F extends Feature<FC>, FC extends Featur
|
||||||
|
|
||||||
private RandomPatch(
|
private RandomPatch(
|
||||||
@NotNull ResourceLocation featureID,
|
@NotNull ResourceLocation featureID,
|
||||||
@NotNull FF feature,
|
@NotNull RandomPatchFeature feature,
|
||||||
@NotNull Holder<PlacedFeature> featureToPlace
|
@NotNull Holder<PlacedFeature> featureToPlace
|
||||||
) {
|
) {
|
||||||
super(featureID, feature);
|
super(featureID, feature);
|
||||||
|
@ -598,12 +600,89 @@ public abstract class BCLFeatureBuilder<F extends Feature<FC>, FC extends Featur
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ForSimpleBlock<FF extends Feature<SimpleBlockConfiguration>> extends BCLFeatureBuilder<FF, SimpleBlockConfiguration> {
|
public static class FacingBlock extends BCLFeatureBuilder<PlaceBlockFeature<PlaceFacingBlockConfig>, PlaceFacingBlockConfig> {
|
||||||
|
private SimpleWeightedRandomList.Builder<BlockState> stateBuilder = SimpleWeightedRandomList.builder();
|
||||||
|
BlockState firstState;
|
||||||
|
private int count = 0;
|
||||||
|
private List<Direction> directions = PlaceFacingBlockConfig.HORIZONTAL;
|
||||||
|
|
||||||
|
private FacingBlock(ResourceLocation featureID, PlaceBlockFeature<PlaceFacingBlockConfig> feature) {
|
||||||
|
super(featureID, feature);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public FacingBlock allHorizontal() {
|
||||||
|
directions = PlaceFacingBlockConfig.HORIZONTAL;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FacingBlock allVertical() {
|
||||||
|
directions = PlaceFacingBlockConfig.VERTICAL;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FacingBlock allDirections() {
|
||||||
|
directions = PlaceFacingBlockConfig.ALL;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FacingBlock add(Block block) {
|
||||||
|
return add(block, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FacingBlock add(BlockState state) {
|
||||||
|
return this.add(state, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FacingBlock add(Block block, int weight) {
|
||||||
|
return add(block.defaultBlockState(), weight);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FacingBlock add(BlockState state, int weight) {
|
||||||
|
if (firstState == null) firstState = state;
|
||||||
|
count++;
|
||||||
|
stateBuilder.add(state, weight);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FacingBlock addAllStates(Block block, int weight) {
|
||||||
|
Set<BlockState> states = BCLPoiType.getBlockStates(block);
|
||||||
|
states.forEach(s -> add(block.defaultBlockState(), Math.max(1, weight / states.size())));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FacingBlock addAllStatesFor(IntegerProperty prop, Block block, int weight) {
|
||||||
|
Collection<Integer> values = prop.getPossibleValues();
|
||||||
|
values.forEach(s -> add(block.defaultBlockState().setValue(prop, s), Math.max(1, weight / values.size())));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PlaceFacingBlockConfig createConfiguration() {
|
||||||
|
BlockStateProvider provider = null;
|
||||||
|
if (count == 1) {
|
||||||
|
provider = SimpleStateProvider.simple(firstState);
|
||||||
|
} else {
|
||||||
|
SimpleWeightedRandomList<BlockState> list = stateBuilder.build();
|
||||||
|
if (!list.isEmpty()) {
|
||||||
|
provider = new WeightedStateProvider(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (provider == null) {
|
||||||
|
throw new IllegalStateException("Facing Blocks need a State Provider.");
|
||||||
|
}
|
||||||
|
return new PlaceFacingBlockConfig(provider, directions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ForSimpleBlock extends BCLFeatureBuilder<SimpleBlockFeature, SimpleBlockConfiguration> {
|
||||||
private final BlockStateProvider provider;
|
private final BlockStateProvider provider;
|
||||||
|
|
||||||
private ForSimpleBlock(
|
private ForSimpleBlock(
|
||||||
@NotNull ResourceLocation featureID,
|
@NotNull ResourceLocation featureID,
|
||||||
@NotNull FF feature,
|
@NotNull SimpleBlockFeature feature,
|
||||||
@NotNull BlockStateProvider provider
|
@NotNull BlockStateProvider provider
|
||||||
) {
|
) {
|
||||||
super(featureID, feature);
|
super(featureID, feature);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.betterx.bclib.api.v3.levelgen.features;
|
package org.betterx.bclib.api.v3.levelgen.features;
|
||||||
|
|
||||||
import org.betterx.bclib.api.v2.levelgen.features.config.PlaceFacingBlockConfig;
|
import org.betterx.bclib.api.v2.levelgen.features.config.PlaceFacingBlockConfig;
|
||||||
import org.betterx.bclib.api.v2.levelgen.features.features.SequenceFeature;
|
|
||||||
import org.betterx.bclib.api.v2.levelgen.features.placement.*;
|
import org.betterx.bclib.api.v2.levelgen.features.placement.*;
|
||||||
import org.betterx.bclib.api.v2.tag.CommonBlockTags;
|
import org.betterx.bclib.api.v2.tag.CommonBlockTags;
|
||||||
|
|
||||||
|
@ -16,8 +15,6 @@ 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.blockpredicates.BlockPredicate;
|
import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
|
||||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||||
import net.minecraft.world.level.levelgen.feature.RandomPatchFeature;
|
|
||||||
import net.minecraft.world.level.levelgen.feature.SimpleBlockFeature;
|
|
||||||
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
|
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.BlockStateProvider;
|
||||||
import net.minecraft.world.level.levelgen.placement.*;
|
import net.minecraft.world.level.levelgen.placement.*;
|
||||||
|
@ -27,7 +24,7 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
abstract class CommonPlacedFeatureBuilder<F extends Feature<FC>, FC extends FeatureConfiguration, T extends CommonPlacedFeatureBuilder<F, FC, ?>> {
|
abstract class CommonPlacedFeatureBuilder<F extends Feature<FC>, FC extends FeatureConfiguration, T extends CommonPlacedFeatureBuilder<F, FC, T>> {
|
||||||
protected final List<PlacementModifier> modifications = new LinkedList<>();
|
protected final List<PlacementModifier> modifications = new LinkedList<>();
|
||||||
|
|
||||||
|
|
||||||
|
@ -443,23 +440,23 @@ abstract class CommonPlacedFeatureBuilder<F extends Feature<FC>, FC extends Feat
|
||||||
*/
|
*/
|
||||||
abstract Holder<PlacedFeature> build();
|
abstract Holder<PlacedFeature> build();
|
||||||
|
|
||||||
public BCLFeatureBuilder.RandomPatch<RandomPatchFeature> inRandomPatch(ResourceLocation id) {
|
public BCLFeatureBuilder.RandomPatch inRandomPatch(ResourceLocation id) {
|
||||||
return BCLFeatureBuilder.startRandomPatch(id, build());
|
return BCLFeatureBuilder.startRandomPatch(id, build());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BCLFeatureBuilder.AsSequence<SequenceFeature> then(ResourceLocation id) {
|
public BCLFeatureBuilder.AsSequence then(ResourceLocation id) {
|
||||||
return BCLFeatureBuilder.startSequence(id).add(build());
|
return BCLFeatureBuilder.startSequence(id).add(build());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BCLFeatureBuilder.ForSimpleBlock<SimpleBlockFeature> putBlock(ResourceLocation id, Block block) {
|
public BCLFeatureBuilder.ForSimpleBlock putBlock(ResourceLocation id, Block block) {
|
||||||
return BCLFeatureBuilder.start(id, block);
|
return BCLFeatureBuilder.start(id, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BCLFeatureBuilder.ForSimpleBlock<SimpleBlockFeature> putBlock(ResourceLocation id, BlockState state) {
|
public BCLFeatureBuilder.ForSimpleBlock putBlock(ResourceLocation id, BlockState state) {
|
||||||
return BCLFeatureBuilder.start(id, state);
|
return BCLFeatureBuilder.start(id, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BCLFeatureBuilder.ForSimpleBlock<SimpleBlockFeature> putBlock(
|
public BCLFeatureBuilder.ForSimpleBlock putBlock(
|
||||||
ResourceLocation id,
|
ResourceLocation id,
|
||||||
BlockStateProvider provider
|
BlockStateProvider provider
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue