Class: CraftBook::NBT::LongArrayTag
- Inherits:
-
EnumerableTag
- Object
- Tag
- EnumerableTag
- CraftBook::NBT::LongArrayTag
- Defined in:
- lib/craftbook/nbt/long_array_tag.rb
Overview
cRepresents a contiguous collection of signed 64-bit integers in the range of -9223372036854775808
and 9223372036854775807
inclusive.
Constant Summary
Constants inherited from Tag
Tag::TYPE_BYTE, Tag::TYPE_BYTE_ARRAY, Tag::TYPE_COMPOUND, Tag::TYPE_DOUBLE, Tag::TYPE_END, Tag::TYPE_FLOAT, Tag::TYPE_INT, Tag::TYPE_INT_ARRAY, Tag::TYPE_LIST, Tag::TYPE_LONG, Tag::TYPE_LONG_ARRAY, Tag::TYPE_SHORT, Tag::TYPE_STRING
Instance Attribute Summary
Attributes inherited from Tag
Instance Method Summary collapse
-
#initialize(name, *values) ⇒ LongArrayTag
constructor
Creates a new instance of the LongArrayTag class.
-
#stringify ⇒ String
The NBT tag as an SNBT string.
-
#to_h ⇒ Hash{Symbol => Object}
The hash-representation of this object.
-
#to_s ⇒ String
The NBT tag as a formatted and human-readable string.
Methods inherited from EnumerableTag
#[], #[]=, #each, #push, #size
Methods inherited from Tag
parse, #pretty, #pretty_print, #to_json
Constructor Details
#initialize(name, *values) ⇒ LongArrayTag
Creates a new instance of the CraftBook::NBT::LongArrayTag class.
14 15 16 |
# File 'lib/craftbook/nbt/long_array_tag.rb', line 14 def initialize(name, *values) super(TYPE_LONG_ARRAY, name, *values) end |
Instance Method Details
#stringify ⇒ String
Returns the NBT tag as an SNBT string.
32 33 34 |
# File 'lib/craftbook/nbt/long_array_tag.rb', line 32 def stringify "#{snbt_prefix}[L;#{to_a.join(',')}]" end |
#to_h ⇒ Hash{Symbol => Object}
Returns the hash-representation of this object.
20 21 22 |
# File 'lib/craftbook/nbt/long_array_tag.rb', line 20 def to_h { name: @name, type: @type, values: @values } end |
#to_s ⇒ String
Returns the NBT tag as a formatted and human-readable string.
26 27 28 |
# File 'lib/craftbook/nbt/long_array_tag.rb', line 26 def to_s "TAG_Long_Array(#{@name ? "\"#{@name}\"" : 'None'}): #{size} #{size == 1 ? 'item' : 'items'}" end |