Skip to main content

replace_craftengine_block

Replace Block - Action entry.

Replaces the block or furniture at a location with another one.

Entry Information

PropertyValue
Entry IDreplace_craftengine_block
TypeAction

Fields

FieldDescription
LocationThe location to replace. Bind it to the position of the triggering event. The yaw orients placed furniture.
Replace WithWhat the location becomes: CUSTOM_BLOCK, FURNITURE, VANILLA_BLOCK or AIR.
Block IdThe CraftEngine block ID to place (namespace:block_id). Only used for custom blocks.
Furniture IdThe CraftEngine furniture ID to place (namespace:furniture_id). Only used for furniture.
MaterialThe vanilla material to place. Only used for vanilla blocks.
Play SoundWhether to play the placement sound of the new block or furniture.

Behaviour

Any CraftEngine custom block or furniture already present is removed through the CraftEngine API first, so the engine drops its own data instead of leaving a ghost state behind. That makes every combination valid: block to furniture, furniture to vanilla block, furniture to furniture, and so on.

The replacement is applied one tick after the trigger, so the write lands outside the interaction that caused it.

How could this be used?

Combine it with on_craftengine_block_interact_event or on_craftengine_furniture_interact_event and bind the location to the event's position: right-clicking a lever-like custom block can turn it into its "activated" variant, an empty chair can be swapped for an occupied one, a crop can be reset to its first growth stage, or a puzzle block can be cleared away once solved.

Usage

Add this entry from the Typewriter editor and fill in its fields. Every field carries an inline description in the editor.