Ender Teleport Changes
Renamed Ender Teleport Event and added it in to ender pearls.
This commit is contained in:
parent
81ff5d7896
commit
e13dff305e
3 changed files with 33 additions and 5 deletions
|
@ -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;
|
|
@ -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);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
+ }
|
||||
|
|
Loading…
Reference in a new issue