Ghost Block (Block Action Type)

Places a temporary block that restores itself, and that nobody can break, use or move.

Places a temporary block that restores itself after a set number of ticks, and that nobody can break, use or move while it is there.

Type ID: apoli:ghost_block

The original block — and its block entity data, if it had any — is remembered when the ghost is placed and put back when it expires. Placing a second ghost block on top of a live one keeps the first original, so a platform that is repeatedly refreshed still restores the world correctly.

Ghost blocks are solid and have collision, so they work as temporary bridges, walls and platforms. They are not a resource: they cannot be mined, right-clicked, blown up or pushed by a piston, and they never drop anything. Without those guarantees a ghost block that names a valuable block would be free ore on a multiplayer server.

Fields

FieldTypeDefaultDescription
blockIdentifierrequiredThe block to place, in its default state.
nbtNBToptionalBlock entity data applied to the placed block.
durationInteger20How many ticks the ghost block lasts. Also accepted as tick.
block_actionBlock Action TypeoptionalRun at the ghost block’s position right after it is placed.
end_actionBlock Action TypeoptionalRun at the position right after the original block is put back.

What “cannot be interacted with” covers

VectorWhat happens
Mining (survival or creative)The break is refused and the block is re-sent to the client.
Right-clicking the blockThe interaction is refused, so a ghost chest or furnace can never be opened.
ExplosionsThe position is removed from the blast list — the ghost survives and drops nothing.
PistonsThe block is immovable, so it can never be pushed off its registered position.

Ghost blocks are also placed and removed without neighbour updates and with drops suppressed, so they do not trigger redstone, observers or gravity, and replacing a block never drops it.

Examples

{
	"type": "apoli:ghost_block",
	"block": "minecraft:ice",
	"duration": 60
}

A patch of ice that lasts three seconds and then gives the original block back.

{
	"type": "apoli:block_action_at",
	"block_action": {
		"type": "apoli:offset",
		"y": -1,
		"action": {
			"type": "apoli:ghost_block",
			"block": "minecraft:obsidian",
			"duration": 40,
			"end_action": {
				"type": "apoli:execute_command",
				"command": "particle minecraft:cloud ~ ~ ~ 0.3 0.3 0.3 0 10"
			}
		}
	}
}

Conjures a two-second obsidian tile under the holder’s feet and puffs a cloud when it fades. Use apoli:offset to move the placement off the block the action was invoked at — there is no add_block field.

The set of live ghost blocks is kept in memory, not saved to the world. They are all restored when the server stops normally, and a ghost whose chunk has unloaded is force-loaded briefly so it still gets restored. A hard crash while a ghost block is placed leaves it behind — keep durations short, which is what they are for.