Skip to content

Commit e2e5026

Browse files
author
ptbnate
committed
Accurate pearl Y level tracking (configurable)
1 parent dfdbd53 commit e2e5026

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: ptbnate <[email protected]>
3+
Date: Mon, 3 Feb 2025 18:43:24 +0500
4+
Subject: [PATCH] Accurate pearl Y level tracking (Configurable)
5+
6+
7+
diff --git a/src/main/java/com/hpfxd/pandaspigot/config/PandaSpigotWorldConfig.java b/src/main/java/com/hpfxd/pandaspigot/config/PandaSpigotWorldConfig.java
8+
index 360ed37b95fce68941c234615b465090b8ea7308..4db44d9ce50feb9a08b8762f21a6dde8579afbbb 100644
9+
--- a/src/main/java/com/hpfxd/pandaspigot/config/PandaSpigotWorldConfig.java
10+
+++ b/src/main/java/com/hpfxd/pandaspigot/config/PandaSpigotWorldConfig.java
11+
@@ -62,4 +62,7 @@ public class PandaSpigotWorldConfig {
12+
@Comment("This option controls whether or not there is a chance for arrow crits to deal extra damage.\n" +
13+
"By default, this is true (vanilla behaviour)")
14+
public boolean randomArrowDamage = true;
15+
+
16+
+ @Comment("Whether the player teleports to the opponent's Y level when their pearl hits the opponent.")
17+
+ public boolean pearlMatchY = false;
18+
}
19+
diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java
20+
index 319c0bc6f621d54ca36e6e2b210a308122f1e070..4cfa2dc8a379d6386e8444999af0d3c0d33758a3 100644
21+
--- a/src/main/java/net/minecraft/server/EntityEnderPearl.java
22+
+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java
23+
@@ -53,6 +53,12 @@ public class EntityEnderPearl extends EntityProjectile {
24+
location.setPitch(player.getLocation().getPitch());
25+
location.setYaw(player.getLocation().getYaw());
26+
27+
+ // PandaSpigot start - Teleport the player to the opponent's Y level when hit.
28+
+ if (movingobjectposition.entity instanceof EntityPlayer && this.world.pandaSpigotConfig.pearlMatchY) {
29+
+ location.setY(movingobjectposition.entity.locY);
30+
+ }
31+
+ // PandaSpigot end
32+
+
33+
PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
34+
Bukkit.getPluginManager().callEvent(teleEvent);
35+

0 commit comments

Comments
 (0)