Builder count modifiers
This commit is contained in:
parent
1150816af2
commit
9ae9c318bd
1 changed files with 39 additions and 0 deletions
|
@ -4,8 +4,10 @@ import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
|
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
|
||||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
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.FeatureConfiguration;
|
||||||
|
import net.minecraft.world.level.levelgen.placement.CountPlacement;
|
||||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||||
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
||||||
|
import net.minecraft.world.level.levelgen.placement.RarityFilter;
|
||||||
import ru.bclib.world.features.BCLFeature;
|
import ru.bclib.world.features.BCLFeature;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -54,6 +56,43 @@ public class BCLFeatureBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate feature in certain iterations (per chunk).
|
||||||
|
* @param count how many times feature will be generated in chunk.
|
||||||
|
* @return same {@link BCLFeatureBuilder} instance.
|
||||||
|
*/
|
||||||
|
public BCLFeatureBuilder count(int count) {
|
||||||
|
return modifier(CountPlacement.of(count));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate feature in certain iterations (per chunk), count can be different in different chunks.
|
||||||
|
* @param average how many times feature will be generated in chunk (in average).
|
||||||
|
* @return same {@link BCLFeatureBuilder} instance.
|
||||||
|
*/
|
||||||
|
public BCLFeatureBuilder countAverage(int average) {
|
||||||
|
return modifier(RarityFilter.onAverageOnceEvery(average));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate feature in certain iterations (per chunk), count can be different in different chunks.
|
||||||
|
* Feature will be generated on all layers (example - Nether plants).
|
||||||
|
* @param average how many times feature will be generated in chunk (in average).
|
||||||
|
* @return same {@link BCLFeatureBuilder} instance.
|
||||||
|
*/
|
||||||
|
public BCLFeatureBuilder countLayers(int average) {
|
||||||
|
return modifier(RarityFilter.onAverageOnceEvery(average));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will place feature once in certain amount of chunks (in average).
|
||||||
|
* @param chunks amount of chunks.
|
||||||
|
* @return same {@link BCLFeatureBuilder} instance.
|
||||||
|
*/
|
||||||
|
public BCLFeatureBuilder oncePerChunks(int chunks) {
|
||||||
|
return modifier(RarityFilter.onAverageOnceEvery(chunks));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds a new {@link BCLFeature} instance. Features will be registered during this process.
|
* Builds a new {@link BCLFeature} instance. Features will be registered during this process.
|
||||||
* @param configuration any {@link FeatureConfiguration} for provided {@link Feature}.
|
* @param configuration any {@link FeatureConfiguration} for provided {@link Feature}.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue