Removed color provider
This commit is contained in:
parent
2c8862a37b
commit
4040597a6d
475 changed files with 5411 additions and 7521 deletions
|
@ -15,20 +15,19 @@ import java.util.Random;
|
|||
public abstract class ScatterFeature extends DefaultFeature {
|
||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
private final int radius;
|
||||
|
||||
|
||||
public ScatterFeature(int radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
public abstract boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos,
|
||||
float radius);
|
||||
|
||||
|
||||
public abstract boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius);
|
||||
|
||||
public abstract void generate(WorldGenLevel world, Random random, BlockPos blockPos);
|
||||
|
||||
|
||||
protected BlockPos getCenterGround(WorldGenLevel world, BlockPos pos) {
|
||||
return getPosOnSurfaceWG(world, pos);
|
||||
}
|
||||
|
||||
|
||||
protected boolean canSpawn(WorldGenLevel world, BlockPos pos) {
|
||||
if (pos.getY() < 5) {
|
||||
return false;
|
||||
|
@ -38,7 +37,7 @@ public abstract class ScatterFeature extends DefaultFeature {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected boolean getGroundPlant(WorldGenLevel world, MutableBlockPos pos) {
|
||||
int down = BlocksHelper.downRay(world, pos, 16);
|
||||
if (down > Math.abs(getYOffset() * 2)) {
|
||||
|
@ -47,26 +46,26 @@ public abstract class ScatterFeature extends DefaultFeature {
|
|||
pos.setY(pos.getY() - down);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected int getYOffset() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
|
||||
protected int getChance() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
center = getCenterGround(world, center);
|
||||
|
||||
|
||||
if (!canSpawn(world, center)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
float r = MHelper.randRange(radius * 0.5F, radius, random);
|
||||
int count = MHelper.floor(r * r * MHelper.randRange(1.5F, 3F, random));
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
@ -74,14 +73,13 @@ public abstract class ScatterFeature extends DefaultFeature {
|
|||
float theta = random.nextFloat() * MHelper.PI2;
|
||||
float x = pr * (float) Math.cos(theta);
|
||||
float z = pr * (float) Math.sin(theta);
|
||||
|
||||
|
||||
POS.set(center.getX() + x, center.getY() + getYOffset(), center.getZ() + z);
|
||||
if (getGroundPlant(world, POS) && canGenerate(world, random, center, POS, r)
|
||||
&& (getChance() < 2 || random.nextInt(getChance()) == 0)) {
|
||||
if (getGroundPlant(world, POS) && canGenerate(world, random, center, POS, r) && (getChance() < 2 || random.nextInt(getChance()) == 0)) {
|
||||
generate(world, random, POS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue