geforkt von Mirrors/Paper
30 Zeilen
1.7 KiB
Diff
30 Zeilen
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Mon, 26 Nov 2018 19:21:58 -0500
|
|
Subject: [PATCH] Prevent rayTrace from loading chunks
|
|
|
|
ray tracing into an unloaded chunk should be treated as a miss
|
|
this saves a ton of lag for when AI tries to raytrace near unloaded chunks.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java
|
|
index e85e4a2dfceb0aa40e73b43a5e122a5906cac585..fe4dba491b586757a16aa36e62682f364daa2602 100644
|
|
--- a/src/main/java/net/minecraft/world/level/BlockGetter.java
|
|
+++ b/src/main/java/net/minecraft/world/level/BlockGetter.java
|
|
@@ -75,7 +75,15 @@ public interface BlockGetter extends LevelHeightAccessor {
|
|
|
|
// CraftBukkit start - moved block handling into separate method for use by Block#rayTrace
|
|
default BlockHitResult rayTraceBlock(ClipContext raytrace1, BlockPos blockposition) {
|
|
- BlockState iblockdata = this.getBlockState(blockposition);
|
|
+ // Paper start - Prevent raytrace from loading chunks
|
|
+ BlockState iblockdata = this.getTypeIfLoaded(blockposition);
|
|
+ if (iblockdata == null) {
|
|
+ // copied the last function parameter (listed below)
|
|
+ Vec3 vec3d = raytrace1.getFrom().subtract(raytrace1.getTo());
|
|
+
|
|
+ return BlockHitResult.miss(raytrace1.getTo(), Direction.getNearest(vec3d.x, vec3d.y, vec3d.z), new BlockPos(raytrace1.getTo()));
|
|
+ }
|
|
+ // Paper end
|
|
FluidState fluid = this.getFluidState(blockposition);
|
|
Vec3 vec3d = raytrace1.getFrom();
|
|
Vec3 vec3d1 = raytrace1.getTo();
|