mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 04:31:58 +01:00
d8847bc1f3
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: fde5602a PR-927: Add PlayerRecipeBookSettingsChangeEvent 949ff217 PR-930: Add methods to get/set evoker fang attack delay f6f7c79d SPIGOT-7514, PR-929: Add "Enchantment Roll" API to enchant items according to Minecraft mechanics d40e22da PR-712: Add API to get full result of crafting items CraftBukkit Changes: c8feb0629 PR-1291: Improve precondition message in Entity#playEffect 482c56a00 PR-1285: Add PlayerRecipeBookSettingsChangeEvent cdf798800 PR-1290: Add methods to get/set evoker fang attack delay 2c1b5f78f SPIGOT-7514, PR-1289: Add "Enchantment Roll" API to enchant items according to Minecraft mechanics 6aa644ae9 PR-992: Add API to get full result of crafting items ffb1319bc PR-1287: Fix scoreboards not updating in Player#setStatistic
67 lines
5.4 KiB
Diff
67 lines
5.4 KiB
Diff
From 0000000000000000000000000000000000000000 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/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 3e6430d5769afbe308703e61f7fb7474811fdf38..6b2a3d3af54af0699a2331cfa6b165d079e38caf 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -466,9 +466,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
double d0 = entity.getX();
|
|
double d1 = entity.getY();
|
|
double d2 = entity.getZ();
|
|
- double d3 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX());
|
|
- double d4 = ServerGamePacketListenerImpl.clampVertical(packet.getY());
|
|
- double d5 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ());
|
|
+ double d3 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX()); final double toX = d3; // Paper - OBFHELPER
|
|
+ double d4 = ServerGamePacketListenerImpl.clampVertical(packet.getY()); final double toY = d4; // Paper - OBFHELPER
|
|
+ double d5 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ()); final double toZ = d5; // Paper - OBFHELPER
|
|
float f = Mth.wrapDegrees(packet.getYRot());
|
|
float f1 = Mth.wrapDegrees(packet.getXRot());
|
|
double d6 = d3 - this.vehicleFirstGoodX;
|
|
@@ -503,6 +503,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
}
|
|
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
|
|
|
|
+ // Paper start - Prevent moving into unloaded chunks
|
|
+ if (this.player.level().paperConfig().chunks.preventMovingIntoUnloadedChunks && (
|
|
+ !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position()))) ||
|
|
+ !worldserver.areChunksLoadedForMove(entity.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(entity.position())))
|
|
+ )) {
|
|
+ this.connection.send(new ClientboundMoveVehiclePacket(entity));
|
|
+ return;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
|
|
// CraftBukkit end
|
|
ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
|
|
@@ -1157,9 +1167,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
this.allowedPlayerTicks = 20; // CraftBukkit
|
|
} else {
|
|
this.awaitingTeleportTime = this.tickCount;
|
|
- double d0 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX(this.player.getX()));
|
|
- double d1 = ServerGamePacketListenerImpl.clampVertical(packet.getY(this.player.getY()));
|
|
- double d2 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ(this.player.getZ()));
|
|
+ double d0 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX(this.player.getX())); final double toX = d0; // Paper - OBFHELPER
|
|
+ double d1 = ServerGamePacketListenerImpl.clampVertical(packet.getY(this.player.getY())); final double toY = d1;
|
|
+ double d2 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ(this.player.getZ())); final double toZ = d2; // Paper - OBFHELPER
|
|
float f = Mth.wrapDegrees(packet.getYRot(this.player.getYRot()));
|
|
float f1 = Mth.wrapDegrees(packet.getXRot(this.player.getXRot()));
|
|
|
|
@@ -1214,6 +1224,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
} else {
|
|
speed = this.player.getAbilities().walkingSpeed * 10f;
|
|
}
|
|
+ // Paper start - Prevent moving into unloaded chunks
|
|
+ if (this.player.level().paperConfig().chunks.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position())))) {
|
|
+ this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot(), Collections.emptySet());
|
|
+ return;
|
|
+ }
|
|
+ // Paper end
|
|
|
|
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
|
|
float f2 = this.player.isFallFlying() ? 300.0F : 100.0F;
|