aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch
new file mode 100644
index 0000000000..5bf2ed6971
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch
@@ -0,0 +1,56 @@
+--- a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
++++ b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
+@@ -17,6 +17,12 @@
+ import net.minecraft.world.level.Level;
+ import net.minecraft.world.phys.EntityHitResult;
+ import net.minecraft.world.phys.HitResult;
++// CraftBukkit start
++import org.bukkit.Bukkit;
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++import org.bukkit.event.entity.CreatureSpawnEvent;
++import org.bukkit.event.player.PlayerTeleportEvent;
++// CraftBukkit end
+
+ public class ThrownEnderpearl extends ThrowableItemProjectile {
+
+@@ -56,9 +59,12 @@
+ if (entity instanceof ServerPlayer) {
+ ServerPlayer serverplayer = (ServerPlayer) entity;
+
+- if (serverplayer.connection.isAcceptingMessages() && serverplayer.level() == this.level() && !serverplayer.isSleeping()) {
+- if (this.random.nextFloat() < 0.05F && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
+- Endermite endermite = (Endermite) EntityType.ENDERMITE.create(this.level());
++ if (entityplayer.connection.isAcceptingMessages() && entityplayer.level() == this.level() && !entityplayer.isSleeping()) {
++ // CraftBukkit start - Fire PlayerTeleportEvent
++ org.bukkit.craftbukkit.entity.CraftPlayer player = entityplayer.getBukkitEntity();
++ org.bukkit.Location location = getBukkitEntity().getLocation();
++ location.setPitch(player.getLocation().getPitch());
++ location.setYaw(player.getLocation().getYaw());
+
+ if (endermite != null) {
+ endermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
+@@ -72,8 +83,13 @@
+ entity.teleportTo(this.getX(), this.getY(), this.getZ());
+ }
+
+- entity.resetFallDistance();
+- entity.hurt(this.damageSources().fall(), 5.0F);
++ entityplayer.connection.teleport(teleEvent.getTo());
++ entity.resetFallDistance();
++ CraftEventFactory.entityDamage = this;
++ entity.hurt(this.damageSources().fall(), 5.0F);
++ CraftEventFactory.entityDamage = null;
++ }
++ // CraftBukkit end
+ this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_TELEPORT, SoundSource.PLAYERS);
+ }
+ } else if (entity != null) {
+@@ -105,7 +119,7 @@
+ public Entity changeDimension(ServerLevel serverlevel) {
+ Entity entity = this.getOwner();
+
+- if (entity != null && entity.level().dimension() != serverlevel.dimension()) {
++ if (entity != null && server != null && entity.level().dimension() != server.dimension()) { // CraftBukkit - SPIGOT-6113
+ this.setOwner((Entity) null);
+ }
+