Fix lighting rod height calculation (#3167). Thanks to Gaider10

This commit is contained in:
Gaider10 2023-07-24 21:40:06 +03:00 committed by GitHub
parent c31a400725
commit 5045566a98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -97,8 +97,8 @@ public class LightningRodBlockEntity extends PowerAcceptorBlockEntity implements
}
public float getLightningStrikeMultiplier() {
final float actualHeight = 256;
final float groundLevel = world.getTopPosition(Heightmap.Type.MOTION_BLOCKING, getPos()).getY();
final float actualHeight = world.getTopY();
final float groundLevel = world.getSeaLevel() + 1;
for (int i = pos.getY() + 1; i < actualHeight; i++) {
if (!isValidIronFence(i)) {
if (groundLevel >= i)
@ -108,7 +108,7 @@ public class LightningRodBlockEntity extends PowerAcceptorBlockEntity implements
return 1.2F - got / max;
}
}
return 4F;
return 0.2F;
}
public boolean isValidIronFence(int y) {