2019-12-16 02:58:10 +00:00
|
|
|
From 72e8e504ce8125125e9c2a395ea15ad3bbd11507 Mon Sep 17 00:00:00 2001
|
2019-05-05 17:19:34 +00:00
|
|
|
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/server/IBlockAccess.java b/src/main/java/net/minecraft/server/IBlockAccess.java
|
2019-12-16 02:58:10 +00:00
|
|
|
index 0dff023529..29cdc00875 100644
|
2019-05-05 17:19:34 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/IBlockAccess.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/IBlockAccess.java
|
2019-05-27 06:14:14 +00:00
|
|
|
@@ -41,7 +41,15 @@ public interface IBlockAccess {
|
2019-05-05 17:19:34 +00:00
|
|
|
|
2019-10-20 09:03:39 +00:00
|
|
|
// CraftBukkit start - moved block handling into separate method for use by Block#rayTrace
|
|
|
|
default MovingObjectPositionBlock rayTraceBlock(RayTrace raytrace1, BlockPosition blockposition) {
|
2019-05-05 17:19:34 +00:00
|
|
|
- IBlockData iblockdata = this.getType(blockposition);
|
|
|
|
+ // Paper start - Prevent raytrace from loading chunks
|
2019-10-20 09:03:39 +00:00
|
|
|
+ IBlockData iblockdata = this.getTypeIfLoaded(blockposition);
|
2019-05-05 17:19:34 +00:00
|
|
|
+ if (iblockdata == null) {
|
|
|
|
+ // copied the last function parameter (listed below)
|
|
|
|
+ Vec3D vec3d = raytrace1.b().d(raytrace1.a());
|
|
|
|
+
|
|
|
|
+ return MovingObjectPositionBlock.a(raytrace1.a(), EnumDirection.a(vec3d.x, vec3d.y, vec3d.z), new BlockPosition(raytrace1.a()));
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
Fluid fluid = this.getFluid(blockposition);
|
|
|
|
Vec3D vec3d = raytrace1.b();
|
|
|
|
Vec3D vec3d1 = raytrace1.a();
|
|
|
|
--
|
2019-12-13 20:41:01 +00:00
|
|
|
2.24.1
|
2019-05-05 17:19:34 +00:00
|
|
|
|