SPIGOT-834: Stop EnderMites from spawning when EnderPearl event is cancelled.

This commit is contained in:
md_5 2015-05-21 17:28:21 +10:00
parent 6ff4221581
commit 65fba7fb10

View file

@ -1,5 +1,5 @@
--- /home/matt/mc-dev-private//net/minecraft/server/EntityEnderPearl.java 2015-02-26 22:40:22.523608140 +0000
+++ src/main/java/net/minecraft/server/EntityEnderPearl.java 2015-02-26 22:40:22.523608140 +0000
--- ../work/decompile-c2c33c10/net/minecraft/server/EntityEnderPearl.java 2015-05-21 17:27:14.743333223 +1000
+++ src/main/java/net/minecraft/server/EntityEnderPearl.java 2015-05-21 17:27:14.743333223 +1000
@@ -1,5 +1,11 @@
package net.minecraft.server;
@ -12,12 +12,16 @@
public class EntityEnderPearl extends EntityProjectile {
private EntityLiving c;
@@ -41,13 +47,27 @@
this.world.addEntity(entityendermite);
}
@@ -33,21 +39,35 @@
EntityPlayer entityplayer = (EntityPlayer) entityliving;
- if (entityliving.au()) {
- entityliving.mount((Entity) null);
if (entityplayer.playerConnection.a().g() && entityplayer.world == this.world && !entityplayer.isSleeping()) {
- if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean("doMobSpawning")) {
- EntityEndermite entityendermite = new EntityEndermite(this.world);
-
- entityendermite.a(true);
- entityendermite.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
- this.world.addEntity(entityendermite);
+ // CraftBukkit start - Fire PlayerTeleportEvent
+ org.bukkit.craftbukkit.entity.CraftPlayer player = entityplayer.getBukkitEntity();
+ org.bukkit.Location location = getBukkitEntity().getLocation();
@ -28,6 +32,14 @@
+ Bukkit.getPluginManager().callEvent(teleEvent);
+
+ if (!teleEvent.isCancelled() && !entityplayer.playerConnection.isDisconnected()) {
+ if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean("doMobSpawning")) {
+ EntityEndermite entityendermite = new EntityEndermite(this.world);
+
+ entityendermite.a(true);
+ entityendermite.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
+ this.world.addEntity(entityendermite);
+ }
+
+ if (entityliving.au()) {
+ entityliving.mount((Entity) null);
+ }
@ -39,6 +51,10 @@
+ CraftEventFactory.entityDamage = null;
}
-
- if (entityliving.au()) {
- entityliving.mount((Entity) null);
- }
-
- entityliving.enderTeleportTo(this.locX, this.locY, this.locZ);
- entityliving.fallDistance = 0.0F;
- entityliving.damageEntity(DamageSource.FALL, 5.0F);