Skip to content

Commit

Permalink
use getChunkImmediately for vehicles
Browse files Browse the repository at this point in the history
  • Loading branch information
Spottedleaf authored and electronicboy committed Jul 27, 2019
1 parent fe7ef7b commit 6f70920
Showing 1 changed file with 4 additions and 4 deletions.
@@ -1,12 +1,12 @@
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
chunks #1551


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 {
Expand All @@ -20,15 +20,15 @@ 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 {
}
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;
+ }
Expand Down

0 comments on commit 6f70920

Please sign in to comment.