diff --git a/paper-server/nms-patches/IBlockAccess.patch b/paper-server/nms-patches/IBlockAccess.patch new file mode 100644 index 0000000000..86400b59a5 --- /dev/null +++ b/paper-server/nms-patches/IBlockAccess.patch @@ -0,0 +1,35 @@ +--- a/net/minecraft/server/IBlockAccess.java ++++ b/net/minecraft/server/IBlockAccess.java +@@ -25,8 +25,8 @@ + return 256; + } + +- default MovingObjectPositionBlock rayTrace(RayTrace raytrace) { +- return (MovingObjectPositionBlock) a(raytrace, (raytrace1, blockposition) -> { ++ // CraftBukkit start - moved block handling into separate method for use by Block#rayTrace ++ default MovingObjectPositionBlock rayTraceBlock(RayTrace raytrace1, BlockPosition blockposition) { + IBlockData iblockdata = this.getType(blockposition); + Fluid fluid = this.getFluid(blockposition); + Vec3D vec3d = raytrace1.b(); +@@ -39,6 +39,12 @@ + double d1 = movingobjectpositionblock1 == null ? Double.MAX_VALUE : raytrace1.b().distanceSquared(movingobjectpositionblock1.getPos()); + + return d0 <= d1 ? movingobjectpositionblock : movingobjectpositionblock1; ++ } ++ // CraftBukkit end ++ ++ default MovingObjectPositionBlock rayTrace(RayTrace raytrace) { ++ return (MovingObjectPositionBlock) a(raytrace, (raytrace1, blockposition) -> { ++ return this.rayTraceBlock(raytrace1, blockposition); // CraftBukkit - moved into separate method + }, (raytrace1) -> { + Vec3D vec3d = raytrace1.b().d(raytrace1.a()); + +@@ -96,7 +102,7 @@ + double d13 = d10 * (i1 > 0 ? 1.0D - MathHelper.h(d4) : MathHelper.h(d4)); + double d14 = d11 * (j1 > 0 ? 1.0D - MathHelper.h(d5) : MathHelper.h(d5)); + +- Object object; ++ T object; // CraftBukkit - decompile error + + do { + if (d12 > 1.0D && d13 > 1.0D && d14 > 1.0D) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index 2bc0b2e093..b073f89473 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -660,7 +660,7 @@ public class CraftBlock implements Block { Vec3D startPos = new Vec3D(start.getX(), start.getY(), start.getZ()); Vec3D endPos = new Vec3D(start.getX() + dir.getX(), start.getY() + dir.getY(), start.getZ() + dir.getZ()); - MovingObjectPosition nmsHitResult = world.rayTrace(new RayTrace(startPos, endPos, RayTrace.BlockCollisionOption.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), null)); + MovingObjectPosition nmsHitResult = world.rayTraceBlock(new RayTrace(startPos, endPos, RayTrace.BlockCollisionOption.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), null), position); return CraftRayTraceResult.fromNMS(this.getWorld(), nmsHitResult); }