-
Notifications
You must be signed in to change notification settings - Fork 2
Action Codeblocks
Amp63 edited this page Dec 22, 2025
·
2 revisions
PlayerAction.[action_name]((args...), (target), (tags))
Example:
# Gives the player a Diamond Pickaxe when they join the plot
from dfpyre import *
PlayerEvent.Join([
PlayerAction.GiveItems(Item('diamond_pickaxe'))
])EntityAction.[action_name]((args...), (target), (tags))
Example:
# Heals an entity for 20 HP whenever it takes damage
from dfpyre import *
EntityEvent.EntityDmg([
EntityAction.Heal(20)
])GameAction.[action_name]((args...), (tags))
Example:
# Spawns a sheep whenever a player joins the plot
from dfpyre import *
PlayerEvent.Join([
GameAction.SpawnMob(Item('sheep_spawn_egg'), Location(10.5, 50.5, 10.5))
])SetVariable.[action_name]((args...), (tags))
Example:
# Sets the variable `max` to either `a` or `b` depending on which is larger
from dfpyre import *
Function('GetMax', codeblocks=[
SetVariable.MaxNumber(Variable('max'), [Variable('a'), Variable('b')])
])SelectObject.[action_name]((args...), (tags), (sub_action), (inverted))
Example:
# Selects all players that do not have a diamond, then gives one to them
from dfpyre import *
Function('CheckDiamond', codeblocks=[
SelectObject.PlayersCond(Item('diamond'), sub_action='HasItem', inverted=True),
PlayerAction.GiveItems(Item('diamond'))
])Control.[action_name((args...), (tags))
# Sends a message to the player, then plays a sound 1 second later
from dfpyre import *
PlayerEvent.Join([
PlayerAction.SendMessage(Text('Hello!')),
Control.Wait(20),
PlayerAction.PlaySound(Sound('Harp', 1.0, 2.0))
])