aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0243-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch
diff options
context:
space:
mode:
authormaxcom1 <[email protected]>2024-03-23 22:26:17 +0100
committerGitHub <[email protected]>2024-03-23 17:26:17 -0400
commitb6001403e9703cadaa6e8c8558e732b91c3c6d6e (patch)
treea8c57bbc334a8ad48d4ad2b43db335667b142bee /patches/api/0243-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch
parent9ec7dfcbc41c6e625de0050b6997160a75df9f44 (diff)
downloadPaper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.tar.gz
Paper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.zip
Add methods to change entity physics (#10334)
Diffstat (limited to 'patches/api/0243-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch')
-rw-r--r--patches/api/0243-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/patches/api/0243-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch b/patches/api/0243-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch
new file mode 100644
index 0000000000..c25fbd796f
--- /dev/null
+++ b/patches/api/0243-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch
@@ -0,0 +1,48 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Madeline Miller <[email protected]>
+Date: Mon, 4 Jan 2021 16:40:55 +1000
+Subject: [PATCH] Add API to get exact interaction point in PlayerInteractEvent
+
+
+diff --git a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java
+index ed72095b5cf669d9f25852e8ef772a710c54012a..ddea08e4de2198a0a7565e2fd7a05571ed48f27b 100644
+--- a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java
++++ b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java
+@@ -1,5 +1,6 @@
+ package org.bukkit.event.player;
+
++import org.bukkit.Location;
+ import org.bukkit.Material;
+ import org.bukkit.block.Block;
+ import org.bukkit.block.BlockFace;
+@@ -234,13 +235,30 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
+ * <p>
+ * All vector components are between 0.0 and 1.0 inclusive.
+ *
++ * @deprecated misleading, use {@link #getInteractionPoint()}
+ * @return the clicked position. May be null.
+ */
+ @Nullable
++ @Deprecated // Paper
+ public Vector getClickedPosition() {
+ return clickedPosistion;
+ }
+
++ // Paper start
++ /**
++ * The exact point at which the interaction occurred. May be null.
++ *
++ * @return the exact interaction point. May be null.
++ */
++ @Nullable
++ public Location getInteractionPoint() {
++ if (this.blockClicked == null || this.clickedPosistion == null) {
++ return null;
++ }
++ return this.blockClicked.getLocation().add(this.clickedPosistion);
++ }
++ // Paper end
++
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {