From 4723f0c7a001f567accb2de8dd5c86d3fa774389 Mon Sep 17 00:00:00 2001 From: Sollace Date: Tue, 16 Feb 2021 13:46:56 +0200 Subject: [PATCH] Flying in a storm is now an even worse idea --- .../unicopia/entity/player/PlayerPhysics.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java index 39358766..bc3c2916 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java @@ -15,6 +15,8 @@ import net.minecraft.block.BlockState; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityPose; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LightningEntity; import net.minecraft.entity.attribute.EntityAttributeInstance; import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.player.PlayerEntity; @@ -304,6 +306,13 @@ public class PlayerPhysics extends EntityPhysics implements Tickable, Moti velocity.x += - forward * MathHelper.sin((player.yaw + glance) * 0.017453292F); velocity.z += forward * MathHelper.cos((player.yaw + glance) * 0.017453292F); + + if (!player.world.isClient && player.world.isThundering() && player.world.random.nextInt(9000) == 0) { + LightningEntity lightning = EntityType.LIGHTNING_BOLT.create(player.world); + lightning.refreshPositionAfterTeleport(player.getX(), player.getY(), player.getZ()); + + player.world.spawnEntity(lightning); + } } protected double getHorizontalMotion(Entity e) {