Make EntityShulker fire EnderTeleportEvent. Closes #3383

This commit is contained in:
LexManos committed 2016-11-16 16:00:20 -08:00
1 parent c416f38461
commit d48985fafa
2 files changed
+17 -1

No files matched your search

@@ -0,0 +1,16 @@
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityShulker.java
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityShulker.java
@@ -391,6 +391,13 @@
if (flag)
{
+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, blockpos1.func_177958_n(), blockpos1.func_177956_o(), blockpos1.func_177952_p(), 0);
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) flag = false;
+ blockpos1 = new BlockPos(event.getTargetX(), event.getTargetY(), event.getTargetZ());
+ }
+
+ if (flag)
+ {
this.func_184185_a(SoundEvents.field_187791_eX, 1.0F, 1.0F);
this.field_70180_af.func_187227_b(field_184701_b, Optional.of(blockpos1));
this.field_70180_af.func_187227_b(field_184702_c, Byte.valueOf((byte)0));
@@ -23,7 +23,7 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.EntityLivingBase;
/**
* 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.
* Event for when an Enderman/Shulker teleports or an ender pearl is used. Can be used to either modify the target position, or cancel the teleport outright.
* @author Mithion
*
*/