diff --git a/common/net/minecraftforge/event/entity/living/EndermanTeleportEvent.java b/common/net/minecraftforge/event/entity/living/EnderTeleportEvent.java similarity index 59% rename from common/net/minecraftforge/event/entity/living/EndermanTeleportEvent.java rename to common/net/minecraftforge/event/entity/living/EnderTeleportEvent.java index a2d0688d4..7ae23c2a1 100644 --- a/common/net/minecraftforge/event/entity/living/EndermanTeleportEvent.java +++ b/common/net/minecraftforge/event/entity/living/EnderTeleportEvent.java @@ -5,18 +5,18 @@ import net.minecraftforge.event.Cancelable; import net.minecraftforge.event.Event; /** - * Event for when an Enderman teleports. Can be used to either modify the target position, or cancel the teleport outright. + * Event for when an Enderman teleports or an ender pearl is used. Can be used to either modify the target position, or cancel the teleport outright. * @author Mithion * */ @Cancelable -public class EndermanTeleportEvent extends LivingEvent{ +public class EnderTeleportEvent extends LivingEvent{ public double targetX; public double targetY; public double targetZ; - public EndermanTeleportEvent(EntityLiving entity, double targetX, double targetY, double targetZ) + public EnderTeleportEvent(EntityLiving entity, double targetX, double targetY, double targetZ) { super(entity); this.targetX = targetX; diff --git a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch new file mode 100644 index 000000000..836b40c6e --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch @@ -0,0 +1,28 @@ +--- ../src_base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java ++++ ../src_work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java +@@ -8,6 +8,8 @@ + import net.minecraft.util.DamageSource; + import net.minecraft.util.MovingObjectPosition; + import net.minecraft.world.World; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.entity.living.EnderTeleportEvent; + + public class EntityEnderPearl extends EntityThrowable + { +@@ -50,9 +52,13 @@ + + if (!entityplayermp.playerNetServerHandler.connectionClosed && entityplayermp.worldObj == this.worldObj) + { +- this.getThrower().setPositionAndUpdate(this.posX, this.posY, this.posZ); +- this.getThrower().fallDistance = 0.0F; +- this.getThrower().attackEntityFrom(DamageSource.fall, 5); ++ EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ); ++ if (!MinecraftForge.EVENT_BUS.post(event)){ ++ this.getThrower().setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); ++ this.getThrower().fallDistance = 0.0F; ++ this.getThrower().attackEntityFrom(DamageSource.fall, 5); ++ } ++ + } + } + diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch index e597f28b5..24ec55cfe 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -5,7 +5,7 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.living.EndermanTeleportEvent; ++import net.minecraftforge.event.entity.living.EnderTeleportEvent; public class EntityEnderman extends EntityMob { @@ -13,7 +13,7 @@ */ protected boolean teleportTo(double par1, double par3, double par5) { -+ EndermanTeleportEvent event = new EndermanTeleportEvent(this, par1, par3, par5); ++ EnderTeleportEvent event = new EnderTeleportEvent(this, par1, par3, par5); + if (!MinecraftForge.EVENT_BUS.post(event)){ + return false; + }