Class: DiamondLang::Helpers::Block
- Defined in:
- lib/diamond-lang/helpers/block.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data_value ⇒ Object
Returns the value of attribute data_value.
-
#id ⇒ Object
Returns the value of attribute id.
-
#nbt ⇒ Object
Returns the value of attribute nbt.
Instance Method Summary collapse
-
#initialize(id, data_value = 0, nbt = nil) ⇒ Block
constructor
A new instance of Block.
- #to_falling_sand ⇒ Object
- #to_s(replace_method = nil) ⇒ Object
Constructor Details
#initialize(id, data_value = 0, nbt = nil) ⇒ Block
Returns a new instance of Block.
5 6 7 8 9 |
# File 'lib/diamond-lang/helpers/block.rb', line 5 def initialize(id, data_value=0, nbt=nil) @id = id @data_value = data_value @nbt = nbt end |
Instance Attribute Details
#data_value ⇒ Object
Returns the value of attribute data_value.
4 5 6 |
# File 'lib/diamond-lang/helpers/block.rb', line 4 def data_value @data_value end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/diamond-lang/helpers/block.rb', line 4 def id @id end |
#nbt ⇒ Object
Returns the value of attribute nbt.
4 5 6 |
# File 'lib/diamond-lang/helpers/block.rb', line 4 def nbt @nbt end |
Instance Method Details
#to_falling_sand ⇒ Object
13 14 15 |
# File 'lib/diamond-lang/helpers/block.rb', line 13 def to_falling_sand FallingSand.new self end |
#to_s(replace_method = nil) ⇒ Object
10 11 12 |
# File 'lib/diamond-lang/helpers/block.rb', line 10 def to_s(replace_method=nil) [id, data_value, replace_method, nbt.to_json].select{|e| e && e != 'null'}.join(' ') end |