Class: MCP::MCMetadata
- Inherits:
-
BinData::Primitive
- Object
- BinData::Primitive
- MCP::MCMetadata
- Defined in:
- lib/mcp/types.rb
Instance Method Summary collapse
-
#get ⇒ Object
array :data, :type => :mc_byte#, :initial_length => 1.
- #read(stream) ⇒ Object
- #set(a) ⇒ Object
Instance Method Details
#get ⇒ Object
array :data, :type => :mc_byte#, :initial_length => 1
77 |
# File 'lib/mcp/types.rb', line 77 def get; return self.datax; end |
#read(stream) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/mcp/types.rb', line 80 def read(stream) self.datax = [] while (x = MCByte.read(stream)) != 127 #data.initial_length = data.initial_length+1 index = x & 0x1F ty = x >> 5 val = case ty when 0 then MCByte.read(stream) when 1 then MCShort.read(stream) when 2 then MCInt.read(stream) when 3 then nil # TODO: MC FLOAT!!! when 4 then MCString.read(stream) when 5 then {id: MCShort.read(stream), count: MCByte.read(stream), damage: MCShort.read(stream)} when 6 then [MCInt.read(stream),MCInt.read(stream),MCInt.read(stream)] else nil end self.datax << val end end |
#set(a) ⇒ Object
78 |
# File 'lib/mcp/types.rb', line 78 def set(a); puts "nie ma setania"; end |