mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 00:56:39 +01:00
6048122e23
This patch appears to be causing some issues with 1.14.3 entity AI
32 lines
1.5 KiB
Diff
32 lines
1.5 KiB
Diff
From 88d1db834cf7efcf8175b0f510661869b476c2f7 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/server/IBlockAccess.java b/src/main/java/net/minecraft/server/IBlockAccess.java
|
|
index 577b227758..c5586e44d4 100644
|
|
--- a/src/main/java/net/minecraft/server/IBlockAccess.java
|
|
+++ b/src/main/java/net/minecraft/server/IBlockAccess.java
|
|
@@ -41,7 +41,15 @@ public interface IBlockAccess {
|
|
|
|
default MovingObjectPositionBlock rayTrace(RayTrace raytrace) {
|
|
return (MovingObjectPositionBlock) a(raytrace, (raytrace1, blockposition) -> {
|
|
- IBlockData iblockdata = this.getType(blockposition);
|
|
+ // Paper start - Prevent raytrace from loading chunks
|
|
+ IBlockData iblockdata = ((World)this).getTypeIfLoaded(blockposition);
|
|
+ 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();
|
|
--
|
|
2.22.0
|
|
|