aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0009-MC-Utils.patch
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2023-08-16 17:58:07 +1000
committerGitHub <[email protected]>2023-08-16 17:58:07 +1000
commit73af2d4cea597e65dd13dafab6325ea5709c9067 (patch)
tree5098825349b9a2a1584f42dd0e738d36a598550a /patches/server/0009-MC-Utils.patch
parent47b805fdf1ac2d026233130ca5b5a2349ce76b1d (diff)
downloadPaper-73af2d4cea597e65dd13dafab6325ea5709c9067.tar.gz
Paper-73af2d4cea597e65dd13dafab6325ea5709c9067.zip
Add clicked position to PlayerUseUnknownEntityEvent (#9604)
Diffstat (limited to 'patches/server/0009-MC-Utils.patch')
-rw-r--r--patches/server/0009-MC-Utils.patch16
1 files changed, 14 insertions, 2 deletions
diff --git a/patches/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch
index 3d4391fce8..e6877d6b8b 100644
--- a/patches/server/0009-MC-Utils.patch
+++ b/patches/server/0009-MC-Utils.patch
@@ -3480,24 +3480,28 @@ index 0000000000000000000000000000000000000000..cea9c098ade00ee87b8efc8164ab72f5
+}
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
new file mode 100644
-index 0000000000000000000000000000000000000000..6779a0cc401231c53545dd22827b404be80b2ad0
+index 0000000000000000000000000000000000000000..9572294a50110f2452090da1f32e0a73edc3db05
--- /dev/null
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
-@@ -0,0 +1,522 @@
+@@ -0,0 +1,534 @@
+package io.papermc.paper.util;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
++import io.papermc.paper.math.BlockPosition;
++import io.papermc.paper.math.FinePosition;
+import io.papermc.paper.math.Position;
+import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet;
+import java.lang.ref.Cleaner;
+import net.minecraft.core.BlockPos;
+import net.minecraft.core.Direction;
++import net.minecraft.core.Vec3i;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.level.ChunkPos;
+import net.minecraft.world.level.ClipContext;
+import net.minecraft.world.level.Level;
++import net.minecraft.world.phys.Vec3;
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.bukkit.Location;
+import org.bukkit.block.BlockFace;
@@ -3960,6 +3964,14 @@ index 0000000000000000000000000000000000000000..6779a0cc401231c53545dd22827b404b
+ return new BlockPos(vec.getBlockX(), vec.getBlockY(), vec.getBlockZ());
+ }
+
++ public static FinePosition toPosition(Vec3 vector) {
++ return Position.fine(vector.x, vector.y, vector.z);
++ }
++
++ public static BlockPosition toPosition(Vec3i vector) {
++ return Position.block(vector.getX(), vector.getY(), vector.getZ());
++ }
++
+ public static boolean isEdgeOfChunk(BlockPos pos) {
+ final int modX = pos.getX() & 15;
+ final int modZ = pos.getZ() & 15;