Commits
md_5 authored 65fba7fb104
1 - | --- /home/matt/mc-dev-private//net/minecraft/server/EntityEnderPearl.java 2015-02-26 22:40:22.523608140 +0000 |
2 - | +++ src/main/java/net/minecraft/server/EntityEnderPearl.java 2015-02-26 22:40:22.523608140 +0000 |
1 + | --- ../work/decompile-c2c33c10/net/minecraft/server/EntityEnderPearl.java 2015-05-21 17:27:14.743333223 +1000 |
2 + | +++ src/main/java/net/minecraft/server/EntityEnderPearl.java 2015-05-21 17:27:14.743333223 +1000 |
3 3 | |
4 4 | package net.minecraft.server; |
5 5 | |
6 6 | +// CraftBukkit start |
7 7 | +import org.bukkit.Bukkit; |
8 8 | +import org.bukkit.craftbukkit.event.CraftEventFactory; |
9 9 | +import org.bukkit.event.player.PlayerTeleportEvent; |
10 10 | +// CraftBukkit end |
11 11 | + |
12 12 | public class EntityEnderPearl extends EntityProjectile { |
13 13 | |
14 14 | private EntityLiving c; |
15 - | |
16 - | this.world.addEntity(entityendermite); |
17 - | } |
15 + | |
16 + | EntityPlayer entityplayer = (EntityPlayer) entityliving; |
18 17 | |
19 - | - if (entityliving.au()) { |
20 - | - entityliving.mount((Entity) null); |
18 + | if (entityplayer.playerConnection.a().g() && entityplayer.world == this.world && !entityplayer.isSleeping()) { |
19 + | - if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean("doMobSpawning")) { |
20 + | - EntityEndermite entityendermite = new EntityEndermite(this.world); |
21 + | - |
22 + | - entityendermite.a(true); |
23 + | - entityendermite.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch); |
24 + | - this.world.addEntity(entityendermite); |
21 25 | + // CraftBukkit start - Fire PlayerTeleportEvent |
22 26 | + org.bukkit.craftbukkit.entity.CraftPlayer player = entityplayer.getBukkitEntity(); |
23 27 | + org.bukkit.Location location = getBukkitEntity().getLocation(); |
24 28 | + location.setPitch(player.getLocation().getPitch()); |
25 29 | + location.setYaw(player.getLocation().getYaw()); |
26 30 | + |
27 31 | + PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL); |
28 32 | + Bukkit.getPluginManager().callEvent(teleEvent); |
29 33 | + |
30 34 | + if (!teleEvent.isCancelled() && !entityplayer.playerConnection.isDisconnected()) { |
35 + | + if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean("doMobSpawning")) { |
36 + | + EntityEndermite entityendermite = new EntityEndermite(this.world); |
37 + | + |
38 + | + entityendermite.a(true); |
39 + | + entityendermite.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch); |
40 + | + this.world.addEntity(entityendermite); |
41 + | + } |
42 + | + |
31 43 | + if (entityliving.au()) { |
32 44 | + entityliving.mount((Entity) null); |
33 45 | + } |
34 46 | + |
35 47 | + entityplayer.playerConnection.teleport(teleEvent.getTo()); |
36 48 | + entityliving.fallDistance = 0.0F; |
37 49 | + CraftEventFactory.entityDamage = this; |
38 50 | + entityliving.damageEntity(DamageSource.FALL, 5.0F); |
39 51 | + CraftEventFactory.entityDamage = null; |
40 52 | } |
41 53 | - |
54 + | - if (entityliving.au()) { |
55 + | - entityliving.mount((Entity) null); |
56 + | - } |
57 + | - |
42 58 | - entityliving.enderTeleportTo(this.locX, this.locY, this.locZ); |
43 59 | - entityliving.fallDistance = 0.0F; |
44 60 | - entityliving.damageEntity(DamageSource.FALL, 5.0F); |
45 61 | + // CraftBukkit end |
46 62 | } |
47 63 | } else if (entityliving != null) { |
48 64 | entityliving.enderTeleportTo(this.locX, this.locY, this.locZ); |