aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/BlockGetter.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/BlockGetter.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/level/BlockGetter.java.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/BlockGetter.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/BlockGetter.java.patch
new file mode 100644
index 0000000000..792bece095
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/BlockGetter.java.patch
@@ -0,0 +1,48 @@
+--- a/net/minecraft/world/level/BlockGetter.java
++++ b/net/minecraft/world/level/BlockGetter.java
+@@ -64,22 +58,30 @@
+ );
+ }
+
++ // 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 ? movingobjectpositionblock : movingobjectpositionblock1;
++ }
++ // CraftBukkit end
++
+ default BlockHitResult clip(ClipContext context) {
+- return traverseBlocks(context.getFrom(), context.getTo(), context, (traverseContext, traversePos) -> {
+- BlockState blockState = this.getBlockState(traversePos);
+- FluidState fluidState = this.getFluidState(traversePos);
+- Vec3 from = traverseContext.getFrom();
+- Vec3 to = traverseContext.getTo();
+- VoxelShape blockShape = traverseContext.getBlockShape(blockState, this, traversePos);
+- BlockHitResult blockHitResult = this.clipWithInteractionOverride(from, to, traversePos, blockShape, blockState);
+- VoxelShape fluidShape = traverseContext.getFluidShape(fluidState, this, traversePos);
+- BlockHitResult blockHitResult1 = fluidShape.clip(from, to, traversePos);
+- double d = blockHitResult == null ? Double.MAX_VALUE : traverseContext.getFrom().distanceToSqr(blockHitResult.getLocation());
+- double d1 = blockHitResult1 == null ? Double.MAX_VALUE : traverseContext.getFrom().distanceToSqr(blockHitResult1.getLocation());
+- return d <= d1 ? blockHitResult : blockHitResult1;
+- }, failContext -> {
+- Vec3 vec3 = failContext.getFrom().subtract(failContext.getTo());
+- return BlockHitResult.miss(failContext.getTo(), Direction.getNearest(vec3.x, vec3.y, vec3.z), BlockPos.containing(failContext.getTo()));
++ 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()));
+ });
+ }
+