Skip to main content

Action On Block Place (Power Type)

Runs actions when the player that has the power places a block.

Type ID: apoli:action_on_block_place

Fields

FieldTypeDefaultDescription
entity_actionEntity Action TypeoptionalIf set, this action runs on the player when they place a block.
held_item_actionItem Action TypeoptionalIf set, this action runs on the item the player placed the block with.
place_to_actionBlock Action TypeoptionalIf set, this action runs at the position of the placed block.
place_on_actionBlock Action TypeoptionalIf set, this action runs on the block the player placed the block against.
item_conditionItem Condition TypeoptionalIf set, the actions only run when the item the player placed the block with passes this condition.
place_to_conditionBlock Condition TypeoptionalIf set, the actions only run when the block at the placed position passes this condition.
place_on_conditionBlock Condition TypeoptionalIf set, the actions only run when the block placed against passes this condition.
directionsArray of String["up", "down", "north", "south", "east", "west"]The sides of a block the player has to place against for the actions to run.
handsArray of Hand["main_hand", "off_hand"]The hands the player has to use for the actions to run.
result_stackItem StackoptionalIf set, this item stack is given to the player when they place a block. It goes into the hand that was used if that hand is now empty, otherwise into the inventory, and it is dropped at their feet if the inventory is full.
result_item_actionItem Action TypeoptionalIf set, this action runs on result_stack before the player gets it. Without result_stack it does nothing.
note

The power fires after the block goes down, so place_to_condition matches the block that was just placed. Use apoli:prevent_block_place to inspect the space before it is filled.

Examples

{
	"type": "apoli:action_on_block_place",
	"entity_action": {
		"type": "apoli:heal",
		"amount": 2
	},
	"item_condition": {
		"type": "apoli:ingredient",
		"ingredient": {
			"item": "minecraft:wheat_seeds"
		}
	},
	"place_on_condition": {
		"type": "apoli:block",
		"block": "minecraft:farmland"
	},
	"directions": [
		"up"
	]
}

This heals the player when they plant wheat seeds on top of farmland.

{
	"type": "apoli:action_on_block_place",
	"place_to_action": {
		"type": "apoli:and",
		"actions": [
			{
				"type": "apoli:area_of_effect",
				"radius": 4.00,
				"shape": "star",
				"block_action": {
					"type": "apoli:set_block",
					"block": "minecraft:air"
				}
			},
			{
				"type": "apoli:set_block",
				"block": "minecraft:magma_block"
			}
		]
	},
	"place_to_condition": {
		"type": "apoli:fluid",
		"fluid_condition": {
			"type": "apoli:in_tag",
			"tag": "minecraft:lava"
		}
	},
	"item_condition": {
		"type": "apoli:ingredient",
		"ingredient": {
			"item": "minecraft:netherrack"
		}
	}
}

When the player places netherrack into lava, the lava within a star-shaped area with a radius of 4 is removed, and the placed netherrack becomes a magma block.