aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches-Unmapped/0644-Implement-API-to-expose-exact-interaction-point.patch
diff options
context:
space:
mode:
authorKyle Wood <[email protected]>2021-04-24 17:01:33 -0500
committerKyle Wood <[email protected]>2021-04-25 18:37:43 -0500
commit3093b81fee3064603c368ab934eddf66ce304433 (patch)
treecb99f05b5f31de92c41af4cc40b4bef5f3cbf573 /Spigot-Server-Patches-Unmapped/0644-Implement-API-to-expose-exact-interaction-point.patch
parent1af696a05d21cbdd7b5a7170f95598c013257588 (diff)
downloadPaper-3093b81fee3064603c368ab934eddf66ce304433.tar.gz
Paper-3093b81fee3064603c368ab934eddf66ce304433.zip
Move patches
Diffstat (limited to 'Spigot-Server-Patches-Unmapped/0644-Implement-API-to-expose-exact-interaction-point.patch')
-rw-r--r--Spigot-Server-Patches-Unmapped/0644-Implement-API-to-expose-exact-interaction-point.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/Spigot-Server-Patches-Unmapped/0644-Implement-API-to-expose-exact-interaction-point.patch b/Spigot-Server-Patches-Unmapped/0644-Implement-API-to-expose-exact-interaction-point.patch
new file mode 100644
index 0000000000..9843cfe9b8
--- /dev/null
+++ b/Spigot-Server-Patches-Unmapped/0644-Implement-API-to-expose-exact-interaction-point.patch
@@ -0,0 +1,59 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Matthew Miller <[email protected]>
+Date: Mon, 4 Jan 2021 16:40:27 +1000
+Subject: [PATCH] Implement API to expose exact interaction point
+
+
+diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
+index 5974cc9f895478eebd4922faa26d5a944064d7b6..1511cf54fea53577a2808b5d84417eee834db984 100644
+--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
++++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
+@@ -495,7 +495,7 @@ public class PlayerInteractManager {
+ cancelledBlock = true;
+ }
+
+- PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityplayer, Action.RIGHT_CLICK_BLOCK, blockposition, movingobjectpositionblock.getDirection(), itemstack, cancelledBlock, enumhand);
++ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityplayer, Action.RIGHT_CLICK_BLOCK, blockposition, movingobjectpositionblock.getDirection(), itemstack, cancelledBlock, enumhand, movingobjectpositionblock.getPos()); // Paper
+ firedInteract = true;
+ interactResult = event.useItemInHand() == Event.Result.DENY;
+ interactPosition = blockposition.immutableCopy();
+diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+index 93157e38f40af84341b8bb20598cf07118e723bc..d03a9c1946da672509c56416bab9c1878e37ddb7 100644
+--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+@@ -68,7 +68,9 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
+ import net.minecraft.world.phys.MovingObjectPosition;
+ import net.minecraft.world.phys.MovingObjectPositionBlock;
+ import net.minecraft.world.phys.MovingObjectPositionEntity;
++import net.minecraft.world.phys.Vec3D;
+ import org.bukkit.Bukkit;
++import org.bukkit.Location; // Paper
+ import org.bukkit.Material;
+ import org.bukkit.NamespacedKey;
+ import org.bukkit.Server;
+@@ -469,7 +471,13 @@ public class CraftEventFactory {
+ return callPlayerInteractEvent(who, action, position, direction, itemstack, false, hand);
+ }
+
++ // Paper start - Add interactionPoint
+ public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, BlockPosition position, EnumDirection direction, ItemStack itemstack, boolean cancelledBlock, EnumHand hand) {
++ return callPlayerInteractEvent(who, action, position, direction, itemstack, cancelledBlock, hand, null);
++ }
++
++ public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, BlockPosition position, EnumDirection direction, ItemStack itemstack, boolean cancelledBlock, EnumHand hand, Vec3D hitVec) {
++ // Paper end
+ Player player = (who == null) ? null : (Player) who.getBukkitEntity();
+ CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);
+
+@@ -495,7 +503,10 @@ public class CraftEventFactory {
+ itemInHand = null;
+ }
+
+- PlayerInteractEvent event = new PlayerInteractEvent(player, action, itemInHand, blockClicked, blockFace, (hand == null) ? null : ((hand == EnumHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND));
++ // Paper start
++ Location interactionPoint = hitVec == null ? null : new Location(craftWorld, hitVec.x, hitVec.y, hitVec.z);
++ PlayerInteractEvent event = new PlayerInteractEvent(player, action, itemInHand, blockClicked, blockFace, (hand == null) ? null : ((hand == EnumHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND), interactionPoint);
++ // Paper end
+ if (cancelledBlock) {
+ event.setUseInteractedBlock(Event.Result.DENY);
+ }