Some Cleanup
This commit is contained in:
parent
b045627030
commit
9e3dbbec76
1 changed files with 0 additions and 40 deletions
|
@ -14,51 +14,11 @@ import net.minecraft.world.level.levelgen.feature.Feature;
|
|||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
|
||||
public class TemplateFeature<FC extends TemplateFeatureConfig> extends Feature<FC> {
|
||||
|
||||
public static <T extends TemplateFeatureConfig> BCLFeature createAndRegisterRare(
|
||||
ResourceLocation location,
|
||||
TemplateFeatureConfig configuration,
|
||||
int onceEveryChunk
|
||||
) {
|
||||
|
||||
|
||||
return BCLFeatureBuilder
|
||||
.start(location, org.betterx.bclib.api.v3.levelgen.features.BCLFeature.TEMPLATE)
|
||||
.decoration(GenerationStep.Decoration.SURFACE_STRUCTURES)
|
||||
.onceEvery(onceEveryChunk) //discard neighboring chunks
|
||||
.count(16) //try 16 placements in chunk
|
||||
.squarePlacement() //randomize x/z in chunk
|
||||
.randomHeight10FromFloorCeil() //randomize height 10 above and 10 below max vertical
|
||||
.findSolidFloor(12) //cast downward ray to find solid surface
|
||||
.isEmptyAbove4() //make sure we have 4 free blocks above
|
||||
.onlyInBiome() //ensure that we still are in the correct biome
|
||||
|
||||
.buildAndRegister(configuration);
|
||||
}
|
||||
|
||||
public static <T extends TemplateFeatureConfig> BCLFeature createAndRegister(
|
||||
ResourceLocation location,
|
||||
TemplateFeatureConfig configuration,
|
||||
int count
|
||||
) {
|
||||
return BCLFeatureBuilder
|
||||
.start(location, org.betterx.bclib.api.v3.levelgen.features.BCLFeature.TEMPLATE)
|
||||
.decoration(GenerationStep.Decoration.SURFACE_STRUCTURES)
|
||||
.count(count)
|
||||
.squarePlacement()
|
||||
.randomHeight10FromFloorCeil()
|
||||
.findSolidFloor(12) //cast downward ray to find solid surface
|
||||
.isEmptyAbove4()
|
||||
.onlyInBiome()
|
||||
.buildAndRegister(configuration);
|
||||
}
|
||||
|
||||
public TemplateFeature(Codec<FC> codec) {
|
||||
super(codec);
|
||||
}
|
||||
|
||||
protected StructureWorldNBT randomStructure(TemplateFeatureConfig cfg, RandomSource random) {
|
||||
|
||||
if (cfg.structures.size() > 1) {
|
||||
final float chanceSum = cfg.structures.parallelStream().map(c -> c.chance).reduce(0.0f, (p, c) -> p + c);
|
||||
float rnd = random.nextFloat() * chanceSum;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue