mirror of
https://github.com/PaperMC/Folia.git
synced 2024-11-24 12:25:23 +01:00
Do not allow players to interact with blocks outside of their region
This commit is contained in:
parent
4af9f6c889
commit
d2a5acba4a
@ -15746,7 +15746,7 @@ index abcc3266d18f34d160eac87fdea153dce24c60b8..7cf0619883577a0f21ed75ba70ece90d
|
||||
Collections.shuffle( this.connections );
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 3472f7f9b98d6d9c9f6465872803ef17fa67486d..7bd6a7a86c10f5b0db94d4a1222310857d56111d 100644
|
||||
index 3472f7f9b98d6d9c9f6465872803ef17fa67486d..eb717d86deeebda89b5bcbbfce1755dd10420da9 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -320,10 +320,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@ -15991,10 +15991,19 @@ index 3472f7f9b98d6d9c9f6465872803ef17fa67486d..7bd6a7a86c10f5b0db94d4a122231085
|
||||
case STOP_DESTROY_BLOCK:
|
||||
// Paper start - Don't allow digging in unloaded chunks
|
||||
- if (this.player.level.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) {
|
||||
+ if (!io.papermc.paper.util.TickThread.isTickThreadFor(this.player.getLevel(), blockposition) || this.player.level.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) { // Folia - region threading - don't destroy blocks not owned
|
||||
+ if (!io.papermc.paper.util.TickThread.isTickThreadFor(this.player.getLevel(), blockposition.getX() >> 4, blockposition.getZ() >> 4, 8) || this.player.level.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) { // Folia - region threading - don't destroy blocks not owned
|
||||
this.player.connection.ackBlockChangesUpTo(packet.getSequence());
|
||||
return;
|
||||
}
|
||||
@@ -1943,7 +1958,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
BlockPos blockposition = movingobjectpositionblock.getBlockPos();
|
||||
Vec3 vec3d1 = Vec3.atCenterOf(blockposition);
|
||||
|
||||
- if (this.player.getEyePosition().distanceToSqr(vec3d1) <= ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) {
|
||||
+ if (io.papermc.paper.util.TickThread.isTickThreadFor(this.player.getLevel(), blockposition.getX() >> 4, blockposition.getZ() >> 4, 8) && this.player.getEyePosition().distanceToSqr(vec3d1) <= ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) { // Folia - do not allow players to interact with blocks outside the current region
|
||||
Vec3 vec3d2 = vec3d.subtract(vec3d1);
|
||||
double d0 = 1.0000001D;
|
||||
|
||||
@@ -2056,7 +2071,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
Entity entity = packet.getEntity(worldserver);
|
||||
|
||||
|
@ -38,7 +38,7 @@ index 22f06033a731c3ba1b815842be7a9d575fa820f2..93262f2ade2e9f70377bbf9acfe1a02e
|
||||
PlaceCommand.register(this.dispatcher);
|
||||
PlaySoundCommand.register(this.dispatcher);
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 7bd6a7a86c10f5b0db94d4a1222310857d56111d..1fe4ac645f6e460d4960ebef7fb4e0025f5ae301 100644
|
||||
index eb717d86deeebda89b5bcbbfce1755dd10420da9..372b043c613d5071ad8cc1381826a40b7ae41bda 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2222,7 +2222,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
Loading…
Reference in New Issue
Block a user