Make EntityShulker fire EnderTeleportEvent. Closes #3383

(cherry picked from commit d48985fafaed6de6f09136b999ca8aa44184a7b9)
This commit is contained in:
LexManos 2016-11-16 16:05:41 -08:00
parent f0d9bf7886
commit 6741967608
2 changed files with 17 additions and 1 deletions

View file

@ -0,0 +1,16 @@
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityShulker.java
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityShulker.java
@@ -426,6 +426,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));

View file

@ -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
*
*/