diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/BlockGetter.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/BlockGetter.java.patch | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/BlockGetter.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/BlockGetter.java.patch new file mode 100644 index 0000000000..b36a28adfd --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/BlockGetter.java.patch @@ -0,0 +1,49 @@ +--- a/net/minecraft/world/level/BlockGetter.java ++++ b/net/minecraft/world/level/BlockGetter.java +@@ -58,24 +58,30 @@ + }); + } + +- default BlockHitResult clip(ClipContext clipcontext) { +- return (BlockHitResult) traverseBlocks(clipcontext.getFrom(), clipcontext.getTo(), clipcontext, (clipcontext1, blockpos) -> { +- BlockState blockstate = this.getBlockState(blockpos); +- FluidState fluidstate = this.getFluidState(blockpos); +- Vec3 vec3 = clipcontext1.getFrom(); +- Vec3 vec31 = clipcontext1.getTo(); +- VoxelShape voxelshape = clipcontext1.getBlockShape(blockstate, this, blockpos); +- BlockHitResult blockhitresult = this.clipWithInteractionOverride(vec3, vec31, blockpos, voxelshape, blockstate); +- VoxelShape voxelshape1 = clipcontext1.getFluidShape(fluidstate, this, blockpos); +- BlockHitResult blockhitresult1 = voxelshape1.clip(vec3, vec31, blockpos); +- double d0 = blockhitresult == null ? Double.MAX_VALUE : clipcontext1.getFrom().distanceToSqr(blockhitresult.getLocation()); +- double d1 = blockhitresult1 == null ? Double.MAX_VALUE : clipcontext1.getFrom().distanceToSqr(blockhitresult1.getLocation()); ++ // CraftBukkit start - moved block handling into separate method for use by Block#rayTrace ++ default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) { ++ IBlockData iblockdata = this.getBlockState(blockposition); ++ FluidState fluid = this.getFluidState(blockposition); ++ Vec3 vec3d = raytrace1.getFrom(); ++ Vec3 vec3d1 = raytrace1.getTo(); ++ VoxelShape voxelshape = raytrace1.getBlockShape(iblockdata, this, blockposition); ++ BlockHitResult movingobjectpositionblock = this.clipWithInteractionOverride(vec3d, vec3d1, blockposition, voxelshape, iblockdata); ++ VoxelShape voxelshape1 = raytrace1.getFluidShape(fluid, this, blockposition); ++ BlockHitResult movingobjectpositionblock1 = voxelshape1.clip(vec3d, vec3d1, blockposition); ++ double d0 = movingobjectpositionblock == null ? Double.MAX_VALUE : raytrace1.getFrom().distanceToSqr(movingobjectpositionblock.getLocation()); ++ double d1 = movingobjectpositionblock1 == null ? Double.MAX_VALUE : raytrace1.getFrom().distanceToSqr(movingobjectpositionblock1.getLocation()); + +- return d0 <= d1 ? blockhitresult : blockhitresult1; +- }, (clipcontext1) -> { +- Vec3 vec3 = clipcontext1.getFrom().subtract(clipcontext1.getTo()); ++ return d0 <= d1 ? movingobjectpositionblock : movingobjectpositionblock1; ++ } ++ // CraftBukkit end + +- return BlockHitResult.miss(clipcontext1.getTo(), Direction.getNearest(vec3.x, vec3.y, vec3.z), BlockPos.containing(clipcontext1.getTo())); ++ default BlockHitResult clip(ClipContext context) { ++ return (BlockHitResult) traverseBlocks(context.getFrom(), context.getTo(), context, (raytrace1, blockposition) -> { ++ return this.clip(raytrace1, blockposition); // CraftBukkit - moved into separate method ++ }, (raytrace1) -> { ++ Vec3 vec3d = raytrace1.getFrom().subtract(raytrace1.getTo()); ++ ++ return BlockHitResult.miss(raytrace1.getTo(), Direction.getNearest(vec3d.x, vec3d.y, vec3d.z), BlockPos.containing(raytrace1.getTo())); + }); + } + |