mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Update clients when setting blocks to air
This commit is contained in:
parent
57cff1f17f
commit
e213840fce
1 changed files with 29 additions and 0 deletions
|
@ -0,0 +1,29 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||
Date: Sat, 25 Jun 2016 21:04:05 -0500
|
||||
Subject: [PATCH] Update clients when setting blocks to air
|
||||
|
||||
In fixing SPIGOT-611, the server sets an area to air and doesn't update the clients.
|
||||
Usually this is fine, most of the time we'll just be setting the intended block shortly after anyway.
|
||||
|
||||
Except if we're setting air. In which case the server will not send the change because it already sees the block as set.
|
||||
We workaround this by telling the server to send the client the block change if it is of ID 0 (Air). I assume this
|
||||
patch will not last long enough to warrant moving away from the ID.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -0,0 +0,0 @@ public class CraftBlock implements Block {
|
||||
BlockPosition position = new BlockPosition(x, y, z);
|
||||
|
||||
// SPIGOT-611: need to do this to prevent glitchiness. Easier to handle this here (like /setblock) than to fix weirdness in tile entity cleanup
|
||||
- chunk.getHandle().getWorld().setTypeAndData(position, Blocks.AIR.getBlockData(), 0);
|
||||
+ // Paper start - If we're setting air, we need to explicitly tell it to send to clients
|
||||
+ int flag = (type == 0) ? 2 : 0;
|
||||
+ chunk.getHandle().getWorld().setTypeAndData(position, Blocks.AIR.getBlockData(), flag);
|
||||
+ // Paper end
|
||||
|
||||
if (applyPhysics) {
|
||||
return chunk.getHandle().getWorld().setTypeAndData(position, blockData, 3);
|
||||
--
|
Loading…
Reference in a new issue