PaperMC/nms-patches/IBlockAccess.patch
2020-06-25 10:00:00 +10:00

35 lines
1.7 KiB
Diff

--- a/net/minecraft/server/IBlockAccess.java
+++ b/net/minecraft/server/IBlockAccess.java
@@ -30,8 +30,8 @@
return BlockPosition.a(axisalignedbb).map(this::getType);
}
- 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();
@@ -44,6 +44,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());
@@ -101,7 +107,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) {