mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Fixed storm clouds not spawning lightning in the correct place
This commit is contained in:
parent
c3fee217d1
commit
84cb3de5e3
1 changed files with 15 additions and 12 deletions
|
@ -257,19 +257,22 @@ public class StormCloudEntity extends Entity implements MagicImmune {
|
|||
|
||||
private void pickRandomPoints(int count, Consumer<BlockPos> action) {
|
||||
BlockPos.iterateRandomly(random, 3, getBlockPos(), getSizeInBlocks()).forEach(pos -> {
|
||||
action.accept(findSurfaceBelow(getWorld(), pos));
|
||||
});
|
||||
}
|
||||
|
||||
public static BlockPos findSurfaceBelow(World world, BlockPos pos) {
|
||||
BlockPos.Mutable mutable = new BlockPos.Mutable();
|
||||
mutable.set(pos);
|
||||
while (getWorld().isInBuildLimit(mutable) && getWorld().isAir(mutable)) {
|
||||
while (world.isInBuildLimit(mutable) && world.isAir(mutable)) {
|
||||
mutable.move(Direction.DOWN);
|
||||
}
|
||||
while (getWorld().isInBuildLimit(mutable) && !getWorld().isAir(mutable)) {
|
||||
while (world.isInBuildLimit(mutable) && !world.isAir(mutable)) {
|
||||
mutable.move(Direction.UP);
|
||||
}
|
||||
mutable.move(Direction.DOWN);
|
||||
|
||||
action.accept(pos);
|
||||
});
|
||||
return mutable;
|
||||
}
|
||||
|
||||
private void spawnLightningStrike(BlockPos pos, boolean cosmetic, boolean infect) {
|
||||
|
|
Loading…
Reference in a new issue