use getChunkImmediately for vehicles

This commit is contained in:
Spottedleaf 2019-07-28 00:38:49 +01:00 committed by Shane Freeder
parent fe7ef7b5d6
commit 6f709200dd
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C

View File

@ -1,4 +1,4 @@
From 2bc98858fe530d335079b28b0a47627b5aa6d22a Mon Sep 17 00:00:00 2001
From e48549fad9ec1b3e24e92b4ffc9f434552828f90 Mon Sep 17 00:00:00 2001
From: Gabriele C <sgdc3.mail@gmail.com>
Date: Mon, 22 Oct 2018 17:34:10 +0200
Subject: [PATCH] Add option to prevent players from moving into unloaded
@ -6,7 +6,7 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 63f313a92d..2299860b81 100644
index 63f313a92..2299860b8 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -429,4 +429,9 @@ public class PaperWorldConfig {
@ -20,7 +20,7 @@ index 63f313a92d..2299860b81 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index a814d8cae9..9eb6982508 100644
index a814d8cae..b0fd4d800 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -348,6 +348,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -28,7 +28,7 @@ index a814d8cae9..9eb6982508 100644
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
+ // Paper start - Prevent moving into unloaded chunks
+ if (player.world.paperConfig.preventMovingIntoUnloadedChunks && !worldserver.isChunkLoaded((int) Math.floor(packetplayinvehiclemove.getX()) >> 4, (int) Math.floor(packetplayinvehiclemove.getZ()) >> 4)) {
+ if (player.world.paperConfig.preventMovingIntoUnloadedChunks && worldserver.getChunkIfLoadedImmediately((int) Math.floor(packetplayinvehiclemove.getX()) >> 4, (int) Math.floor(packetplayinvehiclemove.getZ()) >> 4) == null) {
+ this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
+ return;
+ }