Fix "prevent players from moving into unloaded chunks"
it used public method instead of private, and moved to world config also improved the implementation to not use obfuscated stuff Also removed the Fix Double chest conversion patch since its fixed in other ways in vanilla
This commit is contained in:
parent
042ccbb9b2
commit
eb38e51ee0
|
@ -1,67 +0,0 @@
|
|||
From 7ac07ac07ac07ac07ac07ac07ac07ac07ac07ac0 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 20 Sep 2018 19:11:33 -0400
|
||||
Subject: [PATCH] MC-134115: Fix Double Chest Conversion Error
|
||||
|
||||
A bug with double chest conversion would lead to data
|
||||
loss from chunks if they crossed chunk boundries.
|
||||
|
||||
This fixes the issue.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 7ac07ac07ac0..7ac07ac07ac0 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -514,6 +514,26 @@ public class Chunk implements IChunkAccess {
|
||||
return this.setType(blockposition, iblockdata, flag, true);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public void setTypeDirect(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
+ int i = blockposition.getX() & 15;
|
||||
+ int j = blockposition.getY();
|
||||
+ int k = blockposition.getZ() & 15;
|
||||
+ ChunkSection section = this.sections[j >> 4];
|
||||
+
|
||||
+ if (section == Chunk.EMPTY_CHUNK_SECTION) {
|
||||
+ if (iblockdata.isAir()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ section = new ChunkSection(j >> 4 << 4, this.world.worldProvider.g(), this, this.world, true); // Paper - Anti-Xray
|
||||
+ this.sections[j >> 4] = section;
|
||||
+ }
|
||||
+
|
||||
+ section.setType(i, j & 15, k, iblockdata);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Nullable
|
||||
public IBlockData setType(BlockPosition blockposition, IBlockData iblockdata, boolean flag, boolean doPlace) {
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkConverter.java b/src/main/java/net/minecraft/server/ChunkConverter.java
|
||||
index 7ac07ac07ac0..7ac07ac07ac0 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkConverter.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkConverter.java
|
||||
@@ -198,10 +198,15 @@ public class ChunkConverter {
|
||||
EnumDirection enumdirection1 = (EnumDirection)iblockdata.get(BlockChest.FACING);
|
||||
if (enumdirection.k() != enumdirection1.k() && enumdirection1 == iblockdata1.get(BlockChest.FACING)) {
|
||||
BlockPropertyChestType blockpropertychesttype = enumdirection == enumdirection1.e() ? BlockPropertyChestType.LEFT : BlockPropertyChestType.RIGHT;
|
||||
- generatoraccess.setTypeAndData(blockposition1, (IBlockData)iblockdata1.set(BlockChest.b, blockpropertychesttype.a()), 18);
|
||||
+ // Paper start
|
||||
+ Chunk chunk = ((World) generatoraccess.getMinecraftWorld()).getChunkAtWorldCoords(blockposition);
|
||||
+ Chunk chunk1 = ((World) generatoraccess.getMinecraftWorld()).getChunkAtWorldCoords(blockposition1);
|
||||
+ chunk1.setTypeDirect(blockposition1, (IBlockData)iblockdata1.set(BlockChest.b, blockpropertychesttype.a()));
|
||||
+
|
||||
if (enumdirection1 == EnumDirection.NORTH || enumdirection1 == EnumDirection.EAST) {
|
||||
- TileEntity tileentity = generatoraccess.getTileEntity(blockposition);
|
||||
- TileEntity tileentity1 = generatoraccess.getTileEntity(blockposition1);
|
||||
+ TileEntity tileentity = chunk.getTileEntity(blockposition);
|
||||
+ TileEntity tileentity1 = chunk1.getTileEntity(blockposition1);
|
||||
+ // Paper end
|
||||
if (tileentity instanceof TileEntityChest && tileentity1 instanceof TileEntityChest) {
|
||||
TileEntityChest.a((TileEntityChest)tileentity, (TileEntityChest)tileentity1);
|
||||
}
|
||||
--
|
||||
2.19.1
|
||||
|
|
@ -26,7 +26,7 @@ index 7ac07ac07ac0..7ac07ac07ac0 100644
|
|||
}
|
||||
|
||||
this.x = true;
|
||||
@@ -578,7 +578,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -558,7 +558,7 @@ public class Chunk implements IChunkAccess {
|
||||
} else {
|
||||
if (flag1) {
|
||||
this.initLighting();
|
|
@ -19,7 +19,7 @@ diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/m
|
|||
index 7ac07ac07ac0..7ac07ac07ac0 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -573,7 +573,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -553,7 +553,7 @@ public class Chunk implements IChunkAccess {
|
||||
this.world.n(blockposition);
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/m
|
|||
index 7ac07ac07ac0..7ac07ac07ac0 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -1205,7 +1205,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -1185,7 +1185,7 @@ public class Chunk implements IChunkAccess {
|
||||
}
|
||||
|
||||
public boolean isReady() {
|
||||
|
@ -26,7 +26,7 @@ index 7ac07ac07ac0..7ac07ac07ac0 100644
|
|||
}
|
||||
|
||||
public boolean v() {
|
||||
@@ -1443,6 +1443,13 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -1423,6 +1423,13 @@ public class Chunk implements IChunkAccess {
|
||||
this.h.clear();
|
||||
this.a(ChunkStatus.POSTPROCESSED);
|
||||
this.m.a(this);
|
|
@ -5,17 +5,17 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded
|
|||
chunks #1551
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 7ac07ac07ac0..7ac07ac07ac0 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -458,4 +458,9 @@ public class PaperConfig {
|
||||
velocitySecretKey = secret.getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -564,4 +564,9 @@ public class PaperWorldConfig {
|
||||
replacementBlocks = getList("anti-xray.replacement-blocks", Arrays.asList("stone", "planks"));
|
||||
log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius);
|
||||
}
|
||||
+
|
||||
+ public static boolean preventMovingIntoUnloadedChunks = false;
|
||||
+ public static void preventMovingIntoUnloadedChunks() {
|
||||
+ public boolean preventMovingIntoUnloadedChunks = false;
|
||||
+ private void preventMovingIntoUnloadedChunks() {
|
||||
+ preventMovingIntoUnloadedChunks = getBoolean("settings.prevent-moving-into-unloaded-chunks", false);
|
||||
+ }
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ index 7ac07ac07ac0..7ac07ac07ac0 100644
|
|||
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
|
||||
|
||||
+ // Paper start - Prevent moving into unloaded chunks
|
||||
+ if(com.destroystokyo.paper.PaperConfig.preventMovingIntoUnloadedChunks && !worldserver.isChunkLoaded((int) Math.floor(d4) >> 4, (int) Math.floor(d6) >> 4, false)) {
|
||||
+ if (player.world.paperConfig.preventMovingIntoUnloadedChunks && !worldserver.isChunkLoaded((int) Math.floor(packetplayinvehiclemove.getX()) >> 4, (int) Math.floor(packetplayinvehiclemove.getZ()) >> 4, false)) {
|
||||
+ this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
|
||||
+ return;
|
||||
+ }
|
||||
|
@ -37,12 +37,24 @@ index 7ac07ac07ac0..7ac07ac07ac0 100644
|
|||
if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && (!this.minecraftServer.H() || !this.minecraftServer.G().equals(entity.getDisplayName().getString()))) {
|
||||
// CraftBukkit end
|
||||
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8));
|
||||
@@ -851,9 +858,9 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
double d1 = this.player.locY;
|
||||
double d2 = this.player.locZ;
|
||||
double d3 = this.player.locY;
|
||||
- double d4 = packetplayinflying.a(this.player.locX);
|
||||
+ double d4 = packetplayinflying.a(this.player.locX);double toX = d4; // Paper - OBFHELPER
|
||||
double d5 = packetplayinflying.b(this.player.locY);
|
||||
- double d6 = packetplayinflying.c(this.player.locZ);
|
||||
+ double d6 = packetplayinflying.c(this.player.locZ);double toZ = d6; // Paper - OBFHELPER
|
||||
float f = packetplayinflying.a(this.player.yaw);
|
||||
float f1 = packetplayinflying.b(this.player.pitch);
|
||||
double d7 = d4 - this.l;
|
||||
@@ -893,6 +900,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
speed = player.abilities.walkSpeed * 10f;
|
||||
}
|
||||
|
||||
+ // Paper start - Prevent moving into unloaded chunks
|
||||
+ if(com.destroystokyo.paper.PaperConfig.preventMovingIntoUnloadedChunks && !worldserver.isChunkLoaded((int) Math.floor(d4) >> 4, (int) Math.floor(d6) >> 4, false)) {
|
||||
+ if (player.world.paperConfig.preventMovingIntoUnloadedChunks && (this.player.locX != toX || this.player.locZ != toZ) && !worldserver.isChunkLoaded((int) Math.floor(toX) >> 4, (int) Math.floor(toZ) >> 4, false)) {
|
||||
+ this.internalTeleport(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch, Collections.emptySet());
|
||||
+ return;
|
||||
+ }
|
|
@ -1,4 +1,4 @@
|
|||
From 74d15ab6f2245fde253e1718bc7269170716f2b7 Mon Sep 17 00:00:00 2001
|
||||
From 7ac07ac07ac07ac07ac07ac07ac07ac07ac07ac0 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach@zachbr.io>
|
||||
Date: Tue, 23 Oct 2018 20:53:43 -0400
|
||||
Subject: [PATCH] Strip private area unicode characters from signs
|
||||
|
@ -20,7 +20,7 @@ think of no reason to use it.
|
|||
Fixes GH-1571
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
|
||||
index 20dc3f272..3c712fc93 100644
|
||||
index 7ac07ac07ac0..7ac07ac07ac0 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
|
||||
@@ -11,6 +11,11 @@ public class TileEntitySign extends TileEntity implements ICommandListener {
|
Loading…
Reference in New Issue