Class: McBlocky::DSL::CommandBlock
- Defined in:
- lib/mcblocky/dsl/command_block.rb
Constant Summary
Constants inherited from Commands
McBlocky::DSL::Commands::COMMANDS
Instance Attribute Summary collapse
-
#block_data ⇒ Object
readonly
Returns the value of attribute block_data.
-
#block_kind ⇒ Object
readonly
Returns the value of attribute block_kind.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
-
#z ⇒ Object
readonly
Returns the value of attribute z.
Attributes inherited from Commands
Instance Method Summary collapse
- #command(*args) ⇒ Object
-
#initialize(context, x, y, z, facing, kind, nbt = {}) ⇒ CommandBlock
constructor
A new instance of CommandBlock.
- #nbt ⇒ Object
Methods inherited from Commands
#activate, #blockdata, #detect, #disable, #enable, #execute, #gamerule, #replaceitem, #scoreboard, #setblock, #tellraw, #title, #to_nbt
Constructor Details
#initialize(context, x, y, z, facing, kind, nbt = {}) ⇒ CommandBlock
Returns a new instance of CommandBlock.
4 5 6 7 8 9 10 11 12 |
# File 'lib/mcblocky/dsl/command_block.rb', line 4 def initialize(context, x, y, z, facing, kind, nbt={}) super(context, :at) @x = x @y = y @z = z @block_data = facing @block_kind = kind @nbt = nbt end |
Instance Attribute Details
#block_data ⇒ Object (readonly)
Returns the value of attribute block_data.
3 4 5 |
# File 'lib/mcblocky/dsl/command_block.rb', line 3 def block_data @block_data end |
#block_kind ⇒ Object (readonly)
Returns the value of attribute block_kind.
3 4 5 |
# File 'lib/mcblocky/dsl/command_block.rb', line 3 def block_kind @block_kind end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
3 4 5 |
# File 'lib/mcblocky/dsl/command_block.rb', line 3 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
3 4 5 |
# File 'lib/mcblocky/dsl/command_block.rb', line 3 def y @y end |
#z ⇒ Object (readonly)
Returns the value of attribute z.
3 4 5 |
# File 'lib/mcblocky/dsl/command_block.rb', line 3 def z @z end |
Instance Method Details
#command(*args) ⇒ Object
14 15 16 17 |
# File 'lib/mcblocky/dsl/command_block.rb', line 14 def command(*args) raise ArgumentError, "Only one command is allowed per block" unless commands.empty? super end |
#nbt ⇒ Object
19 20 21 |
# File 'lib/mcblocky/dsl/command_block.rb', line 19 def nbt return @nbt.merge({'Command'=>commands[0] || ''}) end |