Prepared EYE

This commit is contained in:
Frank 2022-06-06 03:46:14 +02:00
parent 0bcfa65f0c
commit e52230e7e3
2 changed files with 21 additions and 12 deletions

View file

@ -114,17 +114,7 @@ public class ScatterFeature<FC extends ScatterFeatureConfig>
POS.set(x, basePos.getY(), z);
if (BlocksHelper.findSurroundingSurface(level, POS, surfaceDirection, 4, config::isValidBase)) {
int myHeight;
if (config.growWhileFree) {
myHeight = BlocksHelper.blockCount(level,
POS,
direction,
config.maxHeight,
BlocksHelper::isFree
);
} else {
myHeight = centerHeight;
}
int myHeight = freeHeight(level, direction, centerHeight, config, POS);
int dx = x - POS.getX();
int dz = z - POS.getZ();
@ -151,6 +141,25 @@ public class ScatterFeature<FC extends ScatterFeatureConfig>
}
}
private int freeHeight(LevelAccessor level,
Direction direction,
int centerHeight,
ScatterFeatureConfig config,
BlockPos.MutableBlockPos POS) {
int myHeight;
if (config.growWhileFree) {
myHeight = BlocksHelper.blockCount(level,
POS,
direction,
config.maxHeight,
BlocksHelper::isFree
);
} else {
myHeight = centerHeight;
}
return myHeight;
}
private void buildPillarWithBase(LevelAccessor level,
BlockPos origin,
BlockPos basePos,

View file

@ -191,7 +191,7 @@ public abstract class ScatterFeatureConfig implements FeatureConfiguration {
}
public Builder<T> singleBlock(Block b) {
return block(b.defaultBlockState()).heightRange(1, 1).spread(0, 0);
return block(b.defaultBlockState()).heightRange(1, 1).spread(0, 0, ConstantInt.of(0));
}
public Builder<T> block(BlockState s) {