Fixes for meteorite crater decay and placement.

This commit is contained in:
Sebastian Hartte
2020-06-21 14:22:29 +02:00
parent 6d76bb989c
commit 25413c58f6
2 changed files with 8 additions and 12 deletions
@@ -164,9 +164,7 @@ public final class MeteoritePlacer {
this.putter.put(world, blockPos, Blocks.LAVA.getDefaultState());
}
} else {
if (!currentBlock.isAir(world, blockPos)) {
this.putter.put(world, blockPos, Blocks.AIR.getDefaultState());
}
this.putter.put(world, blockPos, Blocks.AIR.getDefaultState());
}
}
}
@@ -324,11 +322,8 @@ public final class MeteoritePlacer {
}
// TODO reconsider
if (state.canBeReplacedByLogs(world, new BlockPos(blockPos))) {
blk = Platform.AIR_BLOCK;
final Block blk_b = world.getBlockState(blockPosUp).getBlock();
if (blk_b != blk) {
if (state.getMaterial().isReplaceable()) {
if (!world.isAirBlock(blockPosUp)) {
final BlockState stateUp = world.getBlockState(blockPosUp);
world.setBlockState(blockPos, stateUp, 3);
} else if (randomShit < 100 * this.crater) {
@@ -338,12 +333,12 @@ public final class MeteoritePlacer {
final double dist = dx * dx + dy * dy + dz * dz;
final BlockState xf = world.getBlockState(blockPosDown);
if (!xf.canBeReplacedByLogs(world, blockPosDown)) {
if (!xf.getMaterial().isReplaceable()) {
final double extraRange = Math.random() * 0.6;
final double height = this.crater * (extraRange + 0.2)
- Math.abs(dist - this.crater * 1.7);
if (xf.getBlock() != blk && height > 0 && Math.random() > 0.6) {
if (!xf.isAir(world, blockPosDown) && height > 0 && Math.random() > 0.6) {
randomShit++;
this.type.getRandomFall(world, blockPos);
}
@@ -46,8 +46,9 @@ public class MeteoriteSpawner {
int minY = 10 + stepSize;
BlockPos.Mutable mutablePos = new BlockPos.Mutable(startPos);
int startY = world.getHeight(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, startPos).getY();
mutablePos.setY(startY + stepSize);
// Place the center on the first solid ground block
int startY = world.getHeight(Heightmap.Type.WORLD_SURFACE_WG, startPos).getY();
mutablePos.setY(startY);
while (mutablePos.getY() > minY) {
PlacedMeteoriteSettings spawned = trySpawnMeteorite(world, mutablePos, coreRadius, lava);