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,21 +257,24 @@ public class StormCloudEntity extends Entity implements MagicImmune {
|
||||||
|
|
||||||
private void pickRandomPoints(int count, Consumer<BlockPos> action) {
|
private void pickRandomPoints(int count, Consumer<BlockPos> action) {
|
||||||
BlockPos.iterateRandomly(random, 3, getBlockPos(), getSizeInBlocks()).forEach(pos -> {
|
BlockPos.iterateRandomly(random, 3, getBlockPos(), getSizeInBlocks()).forEach(pos -> {
|
||||||
|
action.accept(findSurfaceBelow(getWorld(), pos));
|
||||||
BlockPos.Mutable mutable = new BlockPos.Mutable();
|
|
||||||
mutable.set(pos);
|
|
||||||
while (getWorld().isInBuildLimit(mutable) && getWorld().isAir(mutable)) {
|
|
||||||
mutable.move(Direction.DOWN);
|
|
||||||
}
|
|
||||||
while (getWorld().isInBuildLimit(mutable) && !getWorld().isAir(mutable)) {
|
|
||||||
mutable.move(Direction.UP);
|
|
||||||
}
|
|
||||||
mutable.move(Direction.DOWN);
|
|
||||||
|
|
||||||
action.accept(pos);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BlockPos findSurfaceBelow(World world, BlockPos pos) {
|
||||||
|
BlockPos.Mutable mutable = new BlockPos.Mutable();
|
||||||
|
mutable.set(pos);
|
||||||
|
while (world.isInBuildLimit(mutable) && world.isAir(mutable)) {
|
||||||
|
mutable.move(Direction.DOWN);
|
||||||
|
}
|
||||||
|
while (world.isInBuildLimit(mutable) && !world.isAir(mutable)) {
|
||||||
|
mutable.move(Direction.UP);
|
||||||
|
}
|
||||||
|
mutable.move(Direction.DOWN);
|
||||||
|
|
||||||
|
return mutable;
|
||||||
|
}
|
||||||
|
|
||||||
private void spawnLightningStrike(BlockPos pos, boolean cosmetic, boolean infect) {
|
private void spawnLightningStrike(BlockPos pos, boolean cosmetic, boolean infect) {
|
||||||
if (infect) {
|
if (infect) {
|
||||||
if (!CrystalShardsEntity.infestBlock((ServerWorld)getWorld(), pos)) {
|
if (!CrystalShardsEntity.infestBlock((ServerWorld)getWorld(), pos)) {
|
||||||
|
|
Loading…
Reference in a new issue