Skip to main content

Fake blocks and chunks, and the entity chest

Concept​

The client draws the block update (UpdateBlock) and chunk (LevelChunk, SubChunk) packets the server sends as they are. So a server can send different blocks or chunks to one player without changing the world, and show only that person a different landscape. These are called fake blocks and fake chunks. To restore, send the real values again the same way. This is used for map views, previews, and correcting ghost blocks the client predicted and drew. (Source: private research)

Fake blocks​

Send UpdateBlock (position, block runtime ID, layer 0 block or layer 1 liquid) only to that player's session. If the block has block entity data, send that data separately too. To restore, send the world's real block the same way. In Dragonfly this is built with a packet hook that reaches the session's packet writes and the block registry.

  • A block the client predicted and drew when it was not actually placed is also corrected by resending the real block. Resending the surrounding blocks after a block Activate succeeds erases the ghost block the client placed by prediction.
  • On top of a block the server sent as an interactive block (Dragonfly Activatable), the client does not predict placing the block it holds.
  • When layer 0 of a cell becomes air, the client moves the layer 1 (liquid layer) block up to layer 0. When restoring a fake view that used both layers, restore layer 1 first and layer 0 after it. In the reverse order the layer 1 block is left behind as a clickable block {measured} (2026-11-10).
  • Vanilla stained glass sent on layer 1 of a cell whose layer 0 is a solid block is drawn by the client, so it can tint a real block. Whether a custom block sent on layer 1 is drawn too was not checked {measured}.
  • The client aims at, clicks and mines a fake block on layer 0 as if it were real. A display-only custom block with no collision or selection box on layer 0 lets clicks reach the face behind it {measured}.

Example: sending and restoring a fake block (Go)​

Send UpdateBlock to that player only, through the connection the packet hook holds (the WritePacket of the gophertunnel connection). Show sends the fake layer 0 block, and Restore sends the real layer 1 value first and the real layer 0 value after it. This order follows the {measured} (2026-11-10) item above. How a hook wraps the connection is in section 5.1 of chest-ui.mdx.

package fakeblock

import (
"github.com/df-mc/dragonfly/server/block/cube"
"github.com/df-mc/dragonfly/server/world"
"github.com/sandertv/gophertunnel/minecraft/protocol"
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
)

type packetWriter interface {
WritePacket(pk packet.Packet) error
}

func updateBlock(w packetWriter, pos cube.Pos, layer uint32, b world.Block) error {
return w.WritePacket(&packet.UpdateBlock{
Position: protocol.BlockPos{int32(pos.X()), int32(pos.Y()), int32(pos.Z())},
NewBlockRuntimeID: world.BlockRuntimeID(b),
Flags: packet.BlockUpdateNetwork,
Layer: layer,
})
}

func Show(w packetWriter, pos cube.Pos, fake world.Block) error {
return updateBlock(w, pos, 0, fake)
}

func Restore(w packetWriter, pos cube.Pos, real0, real1 world.Block) error {
if err := updateBlock(w, pos, 1, real1); err != nil {
return err
}
return updateBlock(w, pos, 0, real0)
}

It was only compiled, against Dragonfly v0.11.7-0.20261107232451-0f9a3a573626 and gophertunnel v1.63.0, and was not run in game {code}. The BlockUpdateNetwork used for Flags follows the gophertunnel source comment on UpdateBlock, which says sending only that flag is typically sufficient, and this wiki has not checked it in game {needs measurement}. A block with block entity data needs that data sent separately, which this example does not do.

Fake chunks​

Dragonfly has no chunk visible to only one player, so the fork adds it to the session. While a fake chunk is shown, world block updates for that chunk are not sent to that player, and chunk resends or subchunk requests are answered with the fake chunk. If you cache subchunk data, keep fake chunks out of the cache.

If you send the chunk center to another position with NetworkChunkPublisherUpdate, the client keeps and draws the chunks around that position instead of around the player (until it next moves to a different chunk). The client discards chunks outside the chunk center, so this is needed when showing a fake chunk right after a teleport. The SubChunk request protocol is in protocol-basics.mdx.

Example: a top-down map​

A region of the world is shown like a map far away (about +30000 in x and z). (Source: private research)

  1. For each chunk, send that player only a fake chunk in which only the top block of each cell is pressed down to a low height and glass is laid over it. If the top block is not a full opaque block, the first block under it is also laid one cell lower.
  2. The body also moves to the map and is fixed 4 cells above the camera. The camera narrows the field of view to 30 degrees and looks down from 65 cells up (camera-and-input.mdx).
  3. When finished, restore the body and field of view and send the real chunks again.

Entities visible to only one player​

To show a player model that exists in no world to just one client, put the skin in PlayerList, add the model, then remove it from the list. The model stays and the player list shows no new person. If a model with the same runtime ID exists, remove it first.

A Dragonfly session remembers hidden entities (private field hiddenEntities). If you clear this list when the player changes worlds, the hidden entities become visible again afterwards. They are not created at once; the new world shows its own entities as chunks arrive. It must be cleared inside the player's transaction.

Floating text is sent as a minecraft:falling_block entity with a name tag (specify an air block if there is no block variant).

Entity chest: a chest window with a chosen slot count​

The server makes an invisible client-only entity and has the client open a chest window on that entity's container. Window 255 close handling, open retries, the ride link, the Dragonfly implementation and the resource pack that picks the size are in Chest UI section 5.

Example: packet order

1. Append the identifier to AvailableActorIdentifiers and send it at join (no entity definition file needed)
2. AddActor { transparent, NoAI, ContainerType=INVENTORY(-1), ContainerSize=slot count, name=window title }
3. ContainerOpen { ContainerTypeContainer, ContainerEntityUniqueID }
4. Send the contents (InventoryContent)
5. When you close a window and open another right away, confirm the close was processed with a NetworkStackLatency round trip, then open

Block state order and orientation​

  • The client matches block runtime IDs in block state order. If you merge the state into one number, the order cannot drift from the server. Properties are sorted by name (to match the order in which the client numbers states). With block-network-ids-are-hashes (BDS default true), a stable hash ID is used instead of the sequence number.
  • Entity models are drawn half a turn from the world (the model's front faces north). When converting world coordinates to model coordinates, flip only the sign of z and leave x as it is.
  • Rotation of a debug shape is [pitch, yaw, roll] in degrees, and yaw 0 reads from north. The reference differs from entity yaw (south 0, north 180), so using it as is flips north and south. A value in radians is effectively 0 degrees.
  • A debug shape box is drawn centered on its position, not from a corner. A box meant to cover a block goes at the block's center with the block model's size (half for a slab) {measured} (2026-11-10).
Sources
idSourceLicenseCommitAccessed
private-researchPrivate research (-)-2026-11-13
bedrock-protocol-docsMojang bedrock-protocol-docs(c) Mojang AB. All rights reserved (Minecraft EULA applies)88e783a2026-11-13
gophertunnelgophertunnel (Sandertv)MIT (c) 2019 Sandertve2251a62026-11-13
dragonflyDragonfly (df-mc)MITd86aefd (baseline of a patch for one Dragonfly-based server)2026-11-13