diff --git a/common/net/minecraftforge/event/entity/EntityStruckByLightningEvent.java b/common/net/minecraftforge/event/entity/EntityStruckByLightningEvent.java new file mode 100644 index 000000000..c55cc4fdb --- /dev/null +++ b/common/net/minecraftforge/event/entity/EntityStruckByLightningEvent.java @@ -0,0 +1,17 @@ +package net.minecraftforge.event.entity; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraftforge.event.Cancelable; + +@Cancelable +public class EntityStruckByLightningEvent extends EntityEvent +{ + public final EntityLightningBolt lightning; + + public EntityStruckByLightningEvent(Entity entity, EntityLightningBolt lightning) + { + super(entity); + this.lightning = lightning; + } +} diff --git a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch new file mode 100644 index 000000000..a0843132e --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch @@ -0,0 +1,23 @@ +--- ../src_base/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java ++++ ../src_work/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java +@@ -10,6 +10,8 @@ + import net.minecraft.util.MathHelper; + import net.minecraft.util.Vec3; + import net.minecraft.world.World; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.entity.EntityStruckByLightningEvent; + + public class EntityLightningBolt extends EntityWeatherEffect + { +@@ -116,7 +118,10 @@ + for (int l = 0; l < list.size(); ++l) + { + Entity entity = (Entity)list.get(l); +- entity.onStruckByLightning(this); ++ if (!MinecraftForge.EVENT_BUS.post(new EntityStruckByLightningEvent(entity, this))) ++ { ++ entity.onStruckByLightning(this); ++ } + } + } + }