Sending custom blocks and items from a server
A Dragonfly (Go) server has no behavior pack (BP) or Script API runner. Go types define blocks and items, and the server sends those definitions to the client as NBT at join. Block definitions go in the block entries (name and compound) of the StartGame packet, and item definitions in the ItemRegistry packet. Textures, models and names come from the resource pack the server sends. The server side has no rule IDs like JSON UI, so this guide points to topic page sections as evidence.
When to use it
| What you want | Method in this guide | When it does not fit |
|---|---|---|
| Add custom blocks and items on a Go server | Implement world.CustomBlock, world.CustomItem and a resource pack | For BDS or a single world, Making a custom block with an add-on |
Add client components Dragonfly does not build (minecraft:digger, minecraft:use_modifiers, minecraft:fuel, tool tags, the type of light values) | Edit the block entries and item list sent at join in a packet hook | If Dragonfly's own behavior must change, patch it in a fork |
| A custom block behaves like a vanilla slab, door, crop or leaves | vanilla_block_data.block_archetype in the block entry | Behavior not in the list is written in server code |
| Draw 3 items on a custom block | The shelf_block archetype and Shelf block entity NBT in the chunk | Other layouts or rotations need a custom entity holding the item |
| Draw sign text on a custom block | The sign_block archetype and Sign NBT in the chunk | Text alone without the board is not possible |
| Make a custom block into an item frame or flower pot | Not possible even from a server; they are not in the archetype list {code (binary)} | A custom entity holding the item |
| Use an archetype from behavior pack JSON | Not possible. Add-on JSON rejects internal_vanilla_data on custom blocks as a schema error | Server only |
| The block shape moves | Blocks animate only textures (flipbook) | An entity |
Minimal example
One shelf_block archetype custom block that draws 3 items. The setup is taken from the test recorded in the shelf item of section 6 of Blocks and the 28 archetypes section (2026-12-04 Windows 1.26.65, Dragonfly test server) {measured, code (binary)}. The Go code is shortened from the test server code in Shelf and sign block entity NBT.
Server-side steps:
- A Go block type implements
world.CustomBlock.TexturesofProperties()(customblock.Material) gives the face textures and render method. A full cube uses the vanillaminecraft:geometry.full_blockand needs no model file; another shape puts an identifier inProperties().Geometryand the.geo.jsonin the resource pack'smodels/blocks/. - Register one state only, and pick a name whose hash is the largest so it comes last in the block runtime ID list. The client builds the states of the shelf archetype itself (
powered_shelf_type,powered_bit,minecraft:cardinal_direction), so they differ from the server's count. Placed last, it does not shift the runtime IDs of other blocks{measured}. - The same type implements
NBTerand returns the block entity NBT below. That puts the block entity into the chunk (subchunk). - In a packet hook, edit that block's entry in StartGame (table below). Two changes: add the
vanilla_block_data.block_archetypecompound, and delete the top-levelproperties. - To change the contents, send NBT of the same shape again with
BlockActorData.
The code for steps 3 and 4. probeBlock is the block type of step 1, and hookConn is a connection that wraps the session.Conn returned by the Dragonfly listener. shelfArchName is the identifier picked in step 2.
type shelfNBTBlock struct {
probeBlock
data map[string]any
}
func (b shelfNBTBlock) EncodeNBT() map[string]any { return maps.Clone(b.data) }
func (b shelfNBTBlock) DecodeNBT(data map[string]any) any {
b.data = data
return b
}
func patchShelf(e *protocol.BlockEntry) {
if e.Name != shelfArchName {
return
}
data, _ := e.Properties["vanilla_block_data"].(map[string]any)
if data == nil {
data = map[string]any{}
e.Properties["vanilla_block_data"] = data
}
data["block_archetype"] = map[string]any{"type": "shelf_block"}
delete(e.Properties, "properties")
}
func (c *hookConn) StartGameContext(ctx context.Context, data minecraft.GameData) error {
for i := range data.CustomBlocks {
patchShelf(&data.CustomBlocks[i])
}
return c.Conn.StartGameContext(ctx, data)
}
The part of the block entry to edit (definition NBT written as JSON; keep every other key as Dragonfly built it):
{
"vanilla_block_data": {
"block_archetype": { "type": "shelf_block" }
}
}
| Key | NBT type | What to do |
|---|---|---|
vanilla_block_data | Compound | Create it if missing |
vanilla_block_data.block_archetype | Compound | Add it |
vanilla_block_data.block_archetype.type | String | One of the 28 archetype names |
properties | List of Compound | Delete it |
minecraft:geometry, minecraft:material_instances in components | Compound | Keep them. Without them the block is invisible and only the items are drawn |
The block entity NBT to put in the chunk (the data of shelfNBTBlock; the items and counts are example values):
func shelfData(pos cube.Pos) map[string]any {
stack := func(name string, count byte) map[string]any {
return map[string]any{"Name": name, "Count": count, "Damage": int16(0), "WasPickedUp": byte(0)}
}
return map[string]any{
"id": "Shelf",
"Items": []any{stack("minecraft:diamond", 1), stack("minecraft:apple", 3), stack("minecraft:golden_apple", 1)},
"BlockEntityVersion": int32(0),
"x": int32(pos.X()), "y": int32(pos.Y()), "z": int32(pos.Z()),
}
}
| Key | NBT type |
|---|---|
id | String |
Items | List of Compound (3 slots) |
Items[].Name | String |
Items[].Count | Byte |
Items[].Damage | Short |
Items[].WasPickedUp | Byte |
BlockEntityVersion | Int |
x, y, z | Int |
Resource pack (the pack the server sends):
pack/manifest.json
pack/textures/terrain_texture.json
pack/textures/blocks/custom_display_shelf.png
pack/texts/en_US.lang
pack/textures/terrain_texture.json: the key is the texture name given to the Go customblock.Material.
{
"resource_pack_name": "custom",
"texture_name": "atlas.terrain",
"texture_data": {
"custom_display_shelf": { "textures": "textures/blocks/custom_display_shelf" }
}
}
pack/texts/en_US.lang (for the block identifier custom:display_shelf; replace it with the real name chosen for the hash condition):
tile.custom:display_shelf.name=Display Shelf
- The shelf renderer takes the position and size of its 3 slots from a constant table inside the renderer. Only the 4 directions from
minecraft:cardinal_direction(the first direction when the state is missing) and the items placed can change{code (binary)}. - Neighbour checks use the names of the 13 vanilla shelves, so archetype custom shelves can be powered but never form a row with each other
{code (binary)}.
Switching to a sign
Set type to sign_block and put Sign NBT in the chunk with the same shelfNBTBlock. The keys are id (String, Sign), FrontText and BackText (Compound), IsWaxed (Byte) and x/y/z (Int), and each side compound has Text (String, lines split with \n), TextOwner (String), SignTextColor (Int, -1 is white), IgnoreLighting, HideGlowOutline and PersistFormatting (all Byte) (table). The sign renderer draws the board and post with the oak sign texture (textures/entity/sign), so the board stays even without geometry. Without geometry a dark box is drawn in front of the board too; full_block geometry with an alpha_test transparent texture leaves only the sign. When no direction state is sent, the board faces south {measured, code (binary)} (2026-12-04 Windows 1.26.65).
Must match
-
Definition NBT types are strict. A key with a different type is read as missing and gets the default
{code (binary)}. Do not copy BP JSON straight into NBT; use the vanilla data-driven block entries (Dragonflyworld/data_driven_blocks.nbt) or a real packet as the model. -
The key layout of definition NBT differs from BP JSON.
BP JSON Definition NBT "minecraft:tags"or"tag:<name>": {}Top-level blockTagsof the entry (List of String)"minecraft:light_emission": 15"minecraft:light_emission": {"emission": <Byte>}"minecraft:light_dampening"{"lightLevel": <Byte>}{code (binary)}"minecraft:collision_box": {"origin", "size"}{"enabled", "boxes": [{"minX" ... "maxZ"}]}"minecraft:liquid_detection": {"detection_rules": [...]}{"detectionRules": [{"liquidType", "canContainLiquid", "onLiquidTouches", ...}]}description.internal_vanilla_data.block_archetype: {"slab_block": {...}}vanilla_block_data.block_archetype: {"type": "slab_block", ...}"minecraft:redstone_conductivity": {"redstone_conductor"}{"redstoneConductor", "allowsWireToStepDown"} -
Send light
emissionas a Byte. A block sent with an Int (the Dragonfly default) did not light its surroundings at night{measured}. -
Put tool tags in the top-level
blockTagsof the entry. Astag:components they have no effect{measured}. -
Sort block properties (
properties) by name. The client pairs runtime IDs with block states in order. -
When giving an archetype, do not send
properties. The client builds the states from the archetype itself. Sendingpropertiestoo shifts runtime IDs{measured}. -
The server must register the same states the client adds from the archetype for runtime IDs to match. For the slab, registering
minecraft:vertical_halfon the server matched{measured}. When the count cannot be matched, register one state and pick a name that sorts last in the runtime IDs (shelf){measured}. -
typemust be one of the 28 below. A value not in the list is ignored silently and the block stays ordinary{code (binary)}. There is no experiment, format version or namespace check. -
Add the keys the archetype compound reads.
base_blockofstair_blockis required, and the block is not built when it names a missing block.stripped_blockoflog_blockis looked up at build time, so register it first{code (binary)}. -
An archetype gives no geometry or texture. The block entry needs
minecraft:geometryandminecraft:material_instances, and the resource pack needs the textures. -
Send the shelf and sign block entity NBT in the chunk.
BlockActorDataalone with no chunk NBT draws nothing{measured}. -
Collision and selection boxes sent by the server are read in geometry space, whose x axis is opposite to the world. Flip boxes in x for shapes that differ east and west
{measured}. -
The block item in the inventory is drawn with the shape of the first state. Put the shape the item should show in state 0
{measured}. -
Always put
max_stack_sizein the item'sitem_properties. A missing key reads as 0, and the item merged with another custom item{measured}. -
A custom item that reacts to clicks in the air needs
minecraft:use_modifiersin its client entry (for exampleuse_duration0.05,movement_modifier1){measured}. A custom fuel needsminecraft:fuelfor the client to allow it in the furnace slot{code}. -
Send names as translation keys:
tile.<id>.namefor blocks,item.<id>.namefor items. Dragonfly puts theName()text intominecraft:display_nameof custom items, so change that value toitem.<id>.namein the item list hook. -
Put lang lines in both the lang file of the language used and
en_US.lang.en_US.langis the fallback for every other language. -
Resource packs are cached by
UUID + version. When the content changes, change themanifest.jsonversion (computed from a content hash). -
At join, send
VoxelShapeswith the default shapesminecraft:emptyandminecraft:unit_cube. Dragonfly does not, and 1.26 clients log it{measured}.
The 28 archetype names (Windows 1.26.65): bush_block, button_block, carpet_block, crop_block, dirt_block, door_block, double_sapling_block, farm_block, fence_block, fence_gate_block, flower_bed_block, hanging_sign_block, leaves_block, log_block, mushroom_block, path_block, planks_block, pressure_plate_block, pumpkin_block, sapling_block, shelf_block, sign_block, slab_block, stair_block, stripped_log_block, trapdoor_block, wall_foliage_block, wall_sign_block. Only four get a block entity and a dedicated renderer: shelf_block, sign_block, wall_sign_block, hanging_sign_block. The rest change behavior only and the shape is drawn from the definition's geometry {inferred}. The states the client adds and the keys it reads per archetype are in the 28 archetypes table.
Common mistakes
| Symptom | Cause | Fix |
|---|---|---|
| After joining, air shows as fire or lava and the floor as other blocks | The block state counts of server and client differ, so runtime IDs shifted (properties sent with an archetype, or the server registered a different number of states) | Delete properties, and register the states the archetype adds, or one state with a name that sorts last {measured} |
| The archetype is given but the block behaves as an ordinary block | type is spelled differently from the 28 names, or block_archetype is outside vanilla_block_data | Fix the name and location {code (binary)} |
| The shelf block shows but has no items | Only BlockActorData was sent, without block entity NBT in the chunk | Have the block type return the NBT through NBTer so it goes in the chunk {measured} |
| Only floating items show, no block | Geometry and materials were deleted from the block entry | Keep minecraft:geometry and minecraft:material_instances {measured} |
| The archetype block shows the unknown block texture | An archetype gives no texture | Give material_instances and a terrain_texture.json key {measured} |
| The sign board and post are black | textures/entity/sign was made transparent | Restore the texture. On a black board, give SignTextColor white (-1) {measured} |
| A dark box shows in front of the sign board | The geometry was removed | Give full_block geometry with an alpha_test transparent texture {measured} |
| A light-emitting block does not light its surroundings | emission was sent as an Int | Send it as a Byte {measured} |
| Pickaxe mining time does not change | The tool tag was added as a tag: component | Put it in the top-level blockTags {measured} |
| Two custom items merge or behave strangely | item_properties has no max_stack_size | Always include it {measured} |
| Using a custom item in the air sends nothing to the server | The client thinks the item cannot be used | Add minecraft:use_modifiers {measured} |
| The item name shows the same text in every language | Dragonfly put the Name() text into display_name | Change it to item.<id>.name in the item list hook |
| A key or identifier shows where the name should be | The lang line is missing, or missing from en_US.lang | Put it in both the language used and en_US.lang |
| Collision or selection boxes are mirrored left to right against the model | The box x axis is opposite to the world | Flip the boxes in x {measured} |
| A custom block does not break after the cracks finish | The real client does not send a destroy action for custom blocks | The server breaks it when the break time has passed (Dragonfly patch) |
| The client keeps the old look after the pack changed | The pack version is the same, so the client used its cache | Compute the version from a content hash |
| Pack download fails | Chunks were sent too fast to a client after 1.26.30 | Leave a chunk send delay (gophertunnel default 200ms) |
| Drawing an item frame item on a custom block does not work | The item frame block entity exists only on vanilla minecraft:frame and minecraft:glow_frame | Use the shelf_block archetype or a custom entity holding the item {measured, code (binary)} |
Version conditions
- The measurements on this page use a Windows 1.26.65 client and Dragonfly master (protocol 1.26.60).
- Windows 1.26.65 has 28 archetype names. The Android 1.26.52.3 binary has 27, without
mushroom_block{code (binary)}. - 1.26 clients log a message when
VoxelShapesis missing{measured}. - Clients after 1.26.30 may fail pack downloads when pack chunks are sent too aggressively.
minecraft:neighbor_change,minecraft:vibration_propertiesandminecraft:enchantment_power_transmitterpass an experiment check on Windows 1.26.65. Definitions received over the network appear to go through the same check, in which case the server's experiment settings decide{inferred}.- The wiki has no fact that changes this task in the 26.70 preview.
How to check
- Keep a test that connects a fake client to the server once, hashes each received block entry and item registration, and compares them with golden files. Keep a golden by item name as well. Goldens should change only in changes meant to change what the client receives.
- Join with the game and first check that air and the floor look normal. If they show as other blocks, runtime IDs are shifted.
- Place the archetype block. For the example, 3 items are drawn on the block in the same layout as a vanilla shelf.
- Send other items with
BlockActorDataand see whether the drawing changes. - For a light-emitting block, see whether the floor around it brightens at night; for tool tags, whether pickaxe mining gets faster.
- In the inventory, check the block item's shape (first state) and its name (current language).
- Look for definition errors in the content log. For example, an empty
categoryinmenu_categorygivesMenu Category should not have an empty value, and an unknown value givesMenu Category has an invalid value of ...{code (binary)}. - After changing the pack, confirm that the pack version changed, then reconnect and see whether the client downloads the pack again.
Further reading
- Custom items, blocks, entities and names: custom blocks, adding client components, the 28 archetypes, names and translation, resource pack operating rules
- Blocks: custom blocks like item frames and shelves: shelf, sign, item frame, flower pot measurements
- Dragonfly server notes: layers, client data verification, upstream behavior and how to fix it
- Fake blocks and chunks: block state order
- Resource pack delivery: version hash, required packs, chunk send settings
- Protocol basics: subchunks and block entities, runtime IDs and the cache
native-notes/block-item-definition-nbt.mdin the repository: the full table of definition NBT keys and types (NBT readers per component)
| id | Source | License | Commit | Accessed |
|---|---|---|---|---|
private-research | Private research (-) | - | 2026-11-13 | |
dragonfly | Dragonfly (df-mc) | MIT | d86aefd (baseline of a patch for one Dragonfly-based server) | 2026-11-13 |
gophertunnel | gophertunnel (Sandertv) | MIT (c) 2019 Sandertv | e2251a6 | 2026-11-13 |
bedrock-samples | Mojang bedrock-samples | Minecraft EULA applies, (c) Mojang AB. All rights reserved | 15701fa9 (guide baseline 46ba6ea) | 2026-11-13 |
bedrock-protocol-docs | Mojang bedrock-protocol-docs | (c) Mojang AB. All rights reserved (Minecraft EULA applies) | 88e783a | 2026-11-13 |
repo-ore-ui-loading | Ore UI loading research (this repository) (ore-ui-loading/) | This project's material | 2026-11-13 | |
ms-learn | Minecraft Creator documentation (Microsoft Learn) | CC BY 4.0 (documentation), MIT (code) | a9fd1c0 | 2026-11-13 |
bedrock-wiki | Bedrock Wiki | CC BY 4.0 (docs/licenses/CC-BY-4.0.md in the repository) | 0930b39 | 2026-11-13 |
repo-guide | JSON UI comprehensive guide (this repository) (guide/) | This project's material | 2026-11-13 |