Note: This is a rather large update, and as such comes with a high likelyhood of overlooked bugs. If you value stability you may want to wait until these are ironed out. On the other hand i'd be grateful for some feedback
Parameters
This part of the update nobody asked for specifically, but oh well ...
You can now define item parameters which allow you to slightly adjust the behavior of an item when giving it out. For example the jumper example is now:
Code (YAML):
jumper
:
# This item demonstrates the use of a tool + damage value
item:
type
: DIAMOND_PICKAXE
name
:
"&aJumper"
lore
:
[
"&1Click for some vertical displacement ..."
]
glow
: true
unbreakable
: true
damage
: 50
parameters:
fixedHeight
: 10
randomOffset
: 5
consumed
: true
cooldown
: 20
actions:
- { action
: MATH_EXPR, target
:
"YOFF", expr
:
"rand() * randomOffset + fixedHeight", actions
:
[
{ action
: COMMAND, by
: PLAYER_PRIVILEGED, perm
: minecraft.command.teleport, command
:
"tp ~ ~{YOFF} ~"
},
{ action
: MATH_EXPR, round
: true, target
:
"YOFF", expr
:
"YOFF", actions
:
[
{ action
: MESSAGE, to
: PLAYER, message
:
"&aWeeee ... ouch! (Sent you up roughly {YOFF}m)"
}
]
}
]
}
Which defines the two parameters fixedHeight and randomOffset, each including their default value. These can then be adjusted when you give out an item like so:
Code (Text):
/cmdi give Yamakaja jumper 1 fixedHeight=200 randomOffset=10
messages.yml
The messages.yml allows you to adjust all user messages, which does *not* include /cmdi output, just cooldown information, etc:
Code (YAML):
item:
disabled
:
"&cThis item has been disabled!"
nopermission
:
"&cYou don't have permission to use this item!"
# cooldown: "&cYou can only use this item once every $TIME_PERIOD!"
cooldown
:
"&cYou can use this item again in $TIME_REMAINING!"
error
:
"&cSo
Player Heads
If an item is of type PLAYER_HEAD you can specify a user for the texture:
Code (YAML):
toomanyzombies:
item:
type
: PLAYER_HEAD
name
:
"&c&lZoooombies"
lore
:
[
"&1Make sure you're prepared for what's coming!"
]
glow
: true
skullUser
: Zombie
# skullUser: 02b0e86d-c86a-4ae7-bc41-015d21f80c1c # Alternatively provide the uuid
consumed
: true
cooldown
: 30
parameters:
range
: 10
actions:
- { action
: REPEAT, from
: 0, to
: 31, increment
: 1, delay
: 0, period
: 4, actions
:
[
{ action
: MATH_EXPR, target
: xoff, expr
:
"x + range * sin(2*pi * i/32) + randn()*range/5", actions
:
[
{ action
: MATH_EXPR, target
: zoff, expr
:
"z + range * cos(2*pi * i/32) + randn()*range/5", actions
:
[
{ action
: COMMAND, by
: PLAYER_PRIVILEGED, perm
: minecraft.command.summon, command
:
"summon minecraft:zombie {xoff} ~ {zoff}"
}
]
}
]
}
]
}
Math expressions
This new action allows for a much more convention form of mathematical operations, for more information see the examples above and the documentation on GitHub:
https://github.com/Yamakaja/commanditems#math_expr
You can use the new cmdi subcommand "calc" to play around with expressions! For example to evaluate the gaussian pdf:
Code (Text):
/cmdi calc 1/sqrt(2*pi*sigma^2)*exp(-(x-mu)^2/(2*sigma^2)) mu=0 sigma=5 x=0
Inspect command
The new
/cmdi inspect subcommand will show you more information about a command item that you're holding.
Things that you can view:
* Which command (the key in your config.yml) this item is bound to
* Parameters set on that specific item
* An execution trace or summary of the actions that will be taken