Moved all common features
This commit is contained in:
parent
2d8b7fe70a
commit
8bddd64216
3 changed files with 237 additions and 180 deletions
|
@ -73,7 +73,6 @@ import ru.bclib.world.structures.BCLStructureFeature;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
package ru.bclib.api.features;
|
||||
|
||||
import net.minecraft.data.worldgen.placement.PlacementUtils;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.valueproviders.UniformInt;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
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.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.placement.BiomeFilter;
|
||||
import net.minecraft.world.level.levelgen.placement.CountOnEveryLayerPlacement;
|
||||
import net.minecraft.world.level.levelgen.placement.CountPlacement;
|
||||
import net.minecraft.world.level.levelgen.placement.InSquarePlacement;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
|
||||
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.BlockMatchTest;
|
||||
import ru.bclib.world.features.BCLFeature;
|
||||
|
||||
public class BCLCommonFeatures {
|
||||
|
@ -22,7 +21,7 @@ public class BCLCommonFeatures {
|
|||
* @return new BCLFeature instance.
|
||||
*/
|
||||
public static BCLFeature makeVegetationFeature(ResourceLocation id, Feature<NoneFeatureConfiguration> feature, int density) {
|
||||
return BCLFeatureBuilder.start(id, feature).build();
|
||||
return makeVegetationFeature(id, feature, density, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,4 +46,196 @@ public class BCLCommonFeatures {
|
|||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create feature which will be generated once in each chunk.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param decoration {@link Decoration} feature step.
|
||||
* @param feature {@link Feature} with {@link NoneFeatureConfiguration} config.
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
public static BCLFeature makeChunkFeature(ResourceLocation id, Decoration decoration, Feature<NoneFeatureConfiguration> feature) {
|
||||
return BCLFeatureBuilder.start(id, feature).decoration(decoration).count(1).onlyInBiome().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create feature with chanced decoration, chance for feature to generate per chunk is 1 / chance.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param decoration {@link Decoration} feature step.
|
||||
* @param feature {@link Feature} with {@link NoneFeatureConfiguration} config.
|
||||
* @param chance chance for feature to be generated in.
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
public static BCLFeature makeChancedFeature(ResourceLocation id, Decoration decoration, Feature<NoneFeatureConfiguration> feature, int chance) {
|
||||
return BCLFeatureBuilder.start(id, feature).decoration(decoration).countAverage(chance).onlyInBiome().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create feature with specified generation iterations per chunk.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param decoration {@link Decoration} feature step.
|
||||
* @param feature {@link Feature} with {@link NoneFeatureConfiguration} config.
|
||||
* @param count iterations steps.
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
public static BCLFeature makeCountFeature(ResourceLocation id, Decoration decoration, Feature<NoneFeatureConfiguration> feature, int count) {
|
||||
return BCLFeatureBuilder.start(id, feature).decoration(decoration).count(count).onlyInBiome().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
*
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param airDiscardChance chance that this orge gets discarded when it is exposed to air
|
||||
* @param placement {@link net.minecraft.world.level.levelgen.placement.PlacementModifier} for the ore distribution,
|
||||
* for example {@code PlacementUtils.FULL_RANGE}, {@code PlacementUtils.RANGE_10_10}
|
||||
* @param rare when true, this is placed as a rare resource
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, float airDiscardChance, PlacementModifier placement, boolean rare) {
|
||||
BCLFeatureBuilder builder = BCLFeatureBuilder
|
||||
.start(id, Feature.ORE)
|
||||
.decoration(Decoration.UNDERGROUND_ORES)
|
||||
.modifier(placement)
|
||||
.squarePlacement()
|
||||
.onlyInBiome();
|
||||
|
||||
if (rare) {
|
||||
builder.oncePerChunks(veins);
|
||||
}
|
||||
else {
|
||||
builder.countAverage(veins);
|
||||
}
|
||||
|
||||
return builder.build(new OreConfiguration(
|
||||
new BlockMatchTest(hostBlock),
|
||||
blockOre.defaultBlockState(),
|
||||
veinSize,
|
||||
airDiscardChance
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
*
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param minY A {@link VerticalAnchor} for the minimum height, for example
|
||||
* {@code VerticalAnchor.bottom()}, {@code VerticalAnchor.absolute(10)}, {@code VerticalAnchor.aboveBottom(10)}
|
||||
* @param maxY A {@link VerticalAnchor} for the maximum height.
|
||||
* @param rare when true, this is placed as a rare resource
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, VerticalAnchor minY, VerticalAnchor maxY, boolean rare) {
|
||||
return makeOreFeature(id, blockOre, hostBlock, veins, veinSize, 0.0f, HeightRangePlacement.uniform(minY, maxY), rare);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
*
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param airDiscardChance chance that this orge gets discarded when it is exposed to air
|
||||
* @param minY A {@link VerticalAnchor} for the minimum height, for example
|
||||
* {@code VerticalAnchor.bottom()}, {@code VerticalAnchor.absolute(10)}, {@code VerticalAnchor.aboveBottom(10)}
|
||||
* @param maxY A {@link VerticalAnchor} for the maximum height.
|
||||
* @param rare when true, this is placed as a rare resource
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, float airDiscardChance, VerticalAnchor minY, VerticalAnchor maxY, boolean rare) {
|
||||
return makeOreFeature(id, blockOre, hostBlock, veins, veinSize, airDiscardChance, HeightRangePlacement.uniform(minY, maxY), rare);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
*
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param placement {@link net.minecraft.world.level.levelgen.placement.PlacementModifier} for the ore distribution,
|
||||
* for example {@code PlacementUtils.FULL_RANGE}, {@code PlacementUtils.RANGE_10_10}
|
||||
* @param rare when true, this is placed as a rare resource
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, PlacementModifier placement, boolean rare) {
|
||||
return makeOreFeature(id, blockOre, hostBlock, veins, veinSize, 0.0f, placement, rare);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param minY A {@link VerticalAnchor} for the minimum height, for example
|
||||
* {@code VerticalAnchor.bottom()}, {@code VerticalAnchor.absolute(10)}, {@code VerticalAnchor.aboveBottom(10)}
|
||||
* @param maxY A {@link VerticalAnchor} for the maximum height.
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, VerticalAnchor minY, VerticalAnchor maxY) {
|
||||
return makeOreFeature(id, blockOre, hostBlock, veins, veinSize, 0.0f, minY, maxY, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param airDiscardChance chance that this orge gets discarded when it is exposed to air
|
||||
* @param minY A {@link VerticalAnchor} for the minimum height, for example
|
||||
* {@code VerticalAnchor.bottom()}, {@code VerticalAnchor.absolute(10)}, {@code VerticalAnchor.aboveBottom(10)}
|
||||
* @param maxY A {@link VerticalAnchor} for the maximum height.
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, float airDiscardChance, VerticalAnchor minY, VerticalAnchor maxY) {
|
||||
return makeOreFeature(id, blockOre, hostBlock, veins, veinSize, airDiscardChance, minY, maxY, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param airDiscardChance chance that this orge gets discarded when it is exposed to air
|
||||
* @param minY minimum height
|
||||
* @param maxY maximum height.
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, float airDiscardChance, int minY, int maxY) {
|
||||
return makeOreFeature(id, blockOre, hostBlock, veins, veinSize, airDiscardChance, VerticalAnchor.absolute(minY), VerticalAnchor.absolute(maxY), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param minY minimum height
|
||||
* @param maxY maximum height.
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, int minY, int maxY) {
|
||||
return makeOreFeature(id, blockOre, hostBlock, veins, veinSize, VerticalAnchor.absolute(minY), VerticalAnchor.absolute(maxY), false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,25 +2,16 @@ package ru.bclib.world.features;
|
|||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.data.worldgen.placement.PlacementUtils;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.valueproviders.UniformInt;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
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.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.placement.BiomeFilter;
|
||||
import net.minecraft.world.level.levelgen.placement.CountOnEveryLayerPlacement;
|
||||
import net.minecraft.world.level.levelgen.placement.CountPlacement;
|
||||
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement;
|
||||
import net.minecraft.world.level.levelgen.placement.InSquarePlacement;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
||||
import net.minecraft.world.level.levelgen.placement.RarityFilter;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.BlockMatchTest;
|
||||
import ru.bclib.api.features.BCLCommonFeatures;
|
||||
|
||||
public class BCLFeature {
|
||||
|
@ -66,11 +57,6 @@ public class BCLFeature {
|
|||
|
||||
/**
|
||||
* Deprecated, use function from {@link BCLCommonFeatures} instead.
|
||||
* Will create a basic plant feature.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param feature {@link Feature} with {@link NoneFeatureConfiguration} config.
|
||||
* @param density iterations per chunk.
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeVegetationFeature(ResourceLocation id, Feature<NoneFeatureConfiguration> feature, int density) {
|
||||
|
@ -78,12 +64,7 @@ public class BCLFeature {
|
|||
}
|
||||
|
||||
/**
|
||||
* Will create a basic plant feature.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param feature {@link Feature} with {@link NoneFeatureConfiguration} config.
|
||||
* @param density iterations per chunk.
|
||||
* @param allHeight if {@code true} will generate plant on all layers, if {@code false} - only on surface.
|
||||
* @return new BCLFeature instance.
|
||||
* Deprecated, use function from {@link BCLCommonFeatures} instead.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeVegetationFeature(ResourceLocation id, Feature<NoneFeatureConfiguration> feature, int density, boolean allHeight) {
|
||||
|
@ -91,211 +72,96 @@ public class BCLFeature {
|
|||
}
|
||||
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param minY minimum height
|
||||
* @param maxY maximum height.
|
||||
* @return new BCLFeature instance.
|
||||
* Deprecated, use function from {@link BCLCommonFeatures} instead.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, int minY, int maxY) {
|
||||
return makeOreFeature(id, blockOre, hostBlock, veins, veinSize, VerticalAnchor.absolute(minY), VerticalAnchor.absolute(maxY), false);
|
||||
return BCLCommonFeatures.makeOreFeature(id, blockOre, hostBlock, veins, veinSize, VerticalAnchor.absolute(minY), VerticalAnchor.absolute(maxY), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param airDiscardChance chance that this orge gets discarded when it is exposed to air
|
||||
* @param minY minimum height
|
||||
* @param maxY maximum height.
|
||||
* @return new BCLFeature instance.
|
||||
* Deprecated, use function from {@link BCLCommonFeatures} instead.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, float airDiscardChance, int minY, int maxY) {
|
||||
return makeOreFeature(id, blockOre, hostBlock, veins, veinSize, airDiscardChance, VerticalAnchor.absolute(minY), VerticalAnchor.absolute(maxY), false);
|
||||
return BCLCommonFeatures.makeOreFeature(id, blockOre, hostBlock, veins, veinSize, airDiscardChance, VerticalAnchor.absolute(minY), VerticalAnchor.absolute(maxY), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param airDiscardChance chance that this orge gets discarded when it is exposed to air
|
||||
* @param minY A {@link VerticalAnchor} for the minimum height, for example
|
||||
* {@code VerticalAnchor.bottom()}, {@code VerticalAnchor.absolute(10)}, {@code VerticalAnchor.aboveBottom(10)}
|
||||
* @param maxY A {@link VerticalAnchor} for the maximum height.
|
||||
* @return new BCLFeature instance.
|
||||
* Deprecated, use function from {@link BCLCommonFeatures} instead.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, float airDiscardChance, VerticalAnchor minY, VerticalAnchor maxY) {
|
||||
return makeOreFeature(id, blockOre, hostBlock, veins, veinSize, airDiscardChance, minY, maxY, false);
|
||||
return BCLCommonFeatures.makeOreFeature(id, blockOre, hostBlock, veins, veinSize, airDiscardChance, minY, maxY, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param minY A {@link VerticalAnchor} for the minimum height, for example
|
||||
* {@code VerticalAnchor.bottom()}, {@code VerticalAnchor.absolute(10)}, {@code VerticalAnchor.aboveBottom(10)}
|
||||
* @param maxY A {@link VerticalAnchor} for the maximum height.
|
||||
* @return new BCLFeature instance.
|
||||
* Deprecated, use function from {@link BCLCommonFeatures} instead.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, VerticalAnchor minY, VerticalAnchor maxY) {
|
||||
return makeOreFeature(id, blockOre, hostBlock, veins, veinSize, 0.0f, minY, maxY, false);
|
||||
return BCLCommonFeatures.makeOreFeature(id, blockOre, hostBlock, veins, veinSize, 0.0f, minY, maxY, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
*
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param airDiscardChance chance that this orge gets discarded when it is exposed to air
|
||||
* @param minY A {@link VerticalAnchor} for the minimum height, for example
|
||||
* {@code VerticalAnchor.bottom()}, {@code VerticalAnchor.absolute(10)}, {@code VerticalAnchor.aboveBottom(10)}
|
||||
* @param maxY A {@link VerticalAnchor} for the maximum height.
|
||||
* @param rare when true, this is placed as a rare resource
|
||||
* @return new BCLFeature instance.
|
||||
* Deprecated, moved to {@link BCLCommonFeatures}. Will be completely removed.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, float airDiscardChance, VerticalAnchor minY, VerticalAnchor maxY, boolean rare) {
|
||||
return makeOreFeature(id, blockOre, hostBlock, veins, veinSize, airDiscardChance, HeightRangePlacement.uniform(minY, maxY), rare);
|
||||
return BCLCommonFeatures.makeOreFeature(id, blockOre, hostBlock, veins, veinSize, airDiscardChance, HeightRangePlacement.uniform(minY, maxY), rare);
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
*
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param minY A {@link VerticalAnchor} for the minimum height, for example
|
||||
* {@code VerticalAnchor.bottom()}, {@code VerticalAnchor.absolute(10)}, {@code VerticalAnchor.aboveBottom(10)}
|
||||
* @param maxY A {@link VerticalAnchor} for the maximum height.
|
||||
* @param rare when true, this is placed as a rare resource
|
||||
* @return new BCLFeature instance.
|
||||
* Deprecated, moved to {@link BCLCommonFeatures}. Will be completely removed.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, VerticalAnchor minY, VerticalAnchor maxY, boolean rare) {
|
||||
return makeOreFeature(id, blockOre, hostBlock, veins, veinSize, 0.0f, HeightRangePlacement.uniform(minY, maxY), rare);
|
||||
return BCLCommonFeatures.makeOreFeature(id, blockOre, hostBlock, veins, veinSize, 0.0f, HeightRangePlacement.uniform(minY, maxY), rare);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
*
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param airDiscardChance chance that this orge gets discarded when it is exposed to air
|
||||
* @param placement {@link net.minecraft.world.level.levelgen.placement.PlacementModifier} for the ore distribution,
|
||||
* for example {@code PlacementUtils.FULL_RANGE}, {@code PlacementUtils.RANGE_10_10}
|
||||
* @param rare when true, this is placed as a rare resource
|
||||
* @return new BCLFeature instance.
|
||||
* Deprecated, use function from {@link BCLCommonFeatures} instead.
|
||||
*/
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, float airDiscardChance, PlacementModifier placement, boolean rare) {
|
||||
OreConfiguration featureConfig = new OreConfiguration(
|
||||
new BlockMatchTest(hostBlock),
|
||||
blockOre.defaultBlockState(),
|
||||
veinSize,
|
||||
airDiscardChance
|
||||
);
|
||||
|
||||
PlacedFeature oreFeature = Feature.ORE
|
||||
.configured(featureConfig)
|
||||
.placed(
|
||||
InSquarePlacement.spread(),
|
||||
rare ? RarityFilter.onAverageOnceEvery(veins) : CountPlacement.of(veins),
|
||||
placement,
|
||||
BiomeFilter.biome()
|
||||
);
|
||||
|
||||
return new BCLFeature(
|
||||
net.minecraft.world.level.levelgen.feature.Feature.ORE,
|
||||
Registry.register(BuiltinRegistries.PLACED_FEATURE, id, oreFeature),
|
||||
Decoration.UNDERGROUND_ORES
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, float airDiscardChance, PlacementModifier placement, boolean rare) {
|
||||
return BCLCommonFeatures.makeOreFeature(id, blockOre, hostBlock, veins, veinSize, airDiscardChance, placement, rare);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create a basic ore feature.
|
||||
*
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param placement {@link net.minecraft.world.level.levelgen.placement.PlacementModifier} for the ore distribution,
|
||||
* for example {@code PlacementUtils.FULL_RANGE}, {@code PlacementUtils.RANGE_10_10}
|
||||
* @param rare when true, this is placed as a rare resource
|
||||
* @return new BCLFeature instance.
|
||||
* Deprecated, use function from {@link BCLCommonFeatures} instead.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, PlacementModifier placement, boolean rare) {
|
||||
return makeOreFeature(id, blockOre, hostBlock, veins, veinSize, 0.0f, placement, rare);
|
||||
return BCLCommonFeatures.makeOreFeature(id, blockOre, hostBlock, veins, veinSize, 0.0f, placement, rare);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create feature which will be generated once in each chunk.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param step {@link Decoration} feature step.
|
||||
* @param feature {@link Feature} with {@link NoneFeatureConfiguration} config.
|
||||
* @return new BCLFeature instance.
|
||||
* Deprecated, use function from {@link BCLCommonFeatures} instead.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeChunkFeature(ResourceLocation id, Decoration step, Feature<NoneFeatureConfiguration> feature) {
|
||||
return makeFeature(id, step, feature, CountPlacement.of(1));
|
||||
return BCLCommonFeatures.makeChunkFeature(id, step, feature);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create feature with chanced decoration, chance for feature to generate per chunk is 1 / chance.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param step {@link Decoration} feature step.
|
||||
* @param feature {@link Feature} with {@link NoneFeatureConfiguration} config.
|
||||
* @param chance chance for feature to be generated in.
|
||||
* @return new BCLFeature instance.
|
||||
* Deprecated, use function from {@link BCLCommonFeatures} instead.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeChancedFeature(ResourceLocation id, Decoration step, Feature<NoneFeatureConfiguration> feature, int chance) {
|
||||
return makeFeature(id, step, feature, RarityFilter.onAverageOnceEvery(chance));
|
||||
return BCLCommonFeatures.makeChancedFeature(id, step, feature, chance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create feature with specified generation iterations per chunk.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param step {@link Decoration} feature step.
|
||||
* @param feature {@link Feature} with {@link NoneFeatureConfiguration} config.
|
||||
* @param count iterations steps.
|
||||
* @return new BCLFeature instance.
|
||||
* Deprecated, use function from {@link BCLCommonFeatures} instead.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeCountFeature(ResourceLocation id, Decoration step, Feature<NoneFeatureConfiguration> feature, int count) {
|
||||
return makeFeature(id, step, feature, CountPlacement.of(count));
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes simple configured feature with {@link NoneFeatureConfiguration} set to NONE.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param step {@link Decoration} feature step.
|
||||
* @param feature {@link Feature} with {@link NoneFeatureConfiguration} config.
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
public static BCLFeature makeFeatureConfigured(ResourceLocation id, Decoration step, Feature<NoneFeatureConfiguration> feature) {
|
||||
return makeFeature(id, step, feature);
|
||||
return BCLCommonFeatures.makeCountFeature(id, step, feature, count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated, use {@link ru.bclib.api.features.BCLFeatureBuilder} instead.
|
||||
*
|
||||
* Creates and configures new BCLib feature.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param step {@link Decoration} feature step.
|
||||
|
@ -303,6 +169,7 @@ public class BCLFeature {
|
|||
* @param placementModifiers array of {@link PlacementModifier}
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static BCLFeature makeFeature(ResourceLocation id, Decoration step, Feature<NoneFeatureConfiguration> feature, PlacementModifier... placementModifiers) {
|
||||
PlacedFeature configured = feature.configured(FeatureConfiguration.NONE).placed(placementModifiers);
|
||||
return new BCLFeature(id, feature, step, configured);
|
||||
|
|
Loading…
Reference in a new issue