Fixes for meteorite crater decay and placement.
This commit is contained in:
@@ -164,9 +164,7 @@ public final class MeteoritePlacer {
|
|||||||
this.putter.put(world, blockPos, Blocks.LAVA.getDefaultState());
|
this.putter.put(world, blockPos, Blocks.LAVA.getDefaultState());
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
// TODO reconsider
|
||||||
if (state.canBeReplacedByLogs(world, new BlockPos(blockPos))) {
|
if (state.getMaterial().isReplaceable()) {
|
||||||
blk = Platform.AIR_BLOCK;
|
if (!world.isAirBlock(blockPosUp)) {
|
||||||
final Block blk_b = world.getBlockState(blockPosUp).getBlock();
|
|
||||||
|
|
||||||
if (blk_b != blk) {
|
|
||||||
final BlockState stateUp = world.getBlockState(blockPosUp);
|
final BlockState stateUp = world.getBlockState(blockPosUp);
|
||||||
world.setBlockState(blockPos, stateUp, 3);
|
world.setBlockState(blockPos, stateUp, 3);
|
||||||
} else if (randomShit < 100 * this.crater) {
|
} else if (randomShit < 100 * this.crater) {
|
||||||
@@ -338,12 +333,12 @@ public final class MeteoritePlacer {
|
|||||||
final double dist = dx * dx + dy * dy + dz * dz;
|
final double dist = dx * dx + dy * dy + dz * dz;
|
||||||
|
|
||||||
final BlockState xf = world.getBlockState(blockPosDown);
|
final BlockState xf = world.getBlockState(blockPosDown);
|
||||||
if (!xf.canBeReplacedByLogs(world, blockPosDown)) {
|
if (!xf.getMaterial().isReplaceable()) {
|
||||||
final double extraRange = Math.random() * 0.6;
|
final double extraRange = Math.random() * 0.6;
|
||||||
final double height = this.crater * (extraRange + 0.2)
|
final double height = this.crater * (extraRange + 0.2)
|
||||||
- Math.abs(dist - this.crater * 1.7);
|
- 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++;
|
randomShit++;
|
||||||
this.type.getRandomFall(world, blockPos);
|
this.type.getRandomFall(world, blockPos);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,8 +46,9 @@ public class MeteoriteSpawner {
|
|||||||
int minY = 10 + stepSize;
|
int minY = 10 + stepSize;
|
||||||
BlockPos.Mutable mutablePos = new BlockPos.Mutable(startPos);
|
BlockPos.Mutable mutablePos = new BlockPos.Mutable(startPos);
|
||||||
|
|
||||||
int startY = world.getHeight(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, startPos).getY();
|
// Place the center on the first solid ground block
|
||||||
mutablePos.setY(startY + stepSize);
|
int startY = world.getHeight(Heightmap.Type.WORLD_SURFACE_WG, startPos).getY();
|
||||||
|
mutablePos.setY(startY);
|
||||||
|
|
||||||
while (mutablePos.getY() > minY) {
|
while (mutablePos.getY() > minY) {
|
||||||
PlacedMeteoriteSettings spawned = trySpawnMeteorite(world, mutablePos, coreRadius, lava);
|
PlacedMeteoriteSettings spawned = trySpawnMeteorite(world, mutablePos, coreRadius, lava);
|
||||||
|
|||||||
Reference in New Issue
Block a user