Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 39 lines (29 sloc) 0.862 kb
88ab8a8b » mpd
2010-09-22 work on writing nbt files. we can now read and rewrite the simple tes…
1 # encoding: UTF-8
2
da2cf70f » mpd
2010-09-22 initial commit. classes read test nbt files as expected.
3 require 'bundler'
4 Bundler.require :default
5
cebe42db » mpd
2010-09-23 gemify, change name
6 require File.expand_path('./lib/nbt_utils', File.dirname(__FILE__))
da2cf70f » mpd
2010-09-22 initial commit. classes read test nbt files as expected.
7 require 'zlib'
8
9 @compound = nil
10
d6db7c6f » mpd
2010-09-28 Reading the file into memory and using a stringio to read the bytes i…
11 #file = NBTUtils::File.new('doc/test.nbt')
12 #@compound = file.read
13 #
14 #puts @compound.to_s
15 #
16 #@compound.update_tag('name', 'asdf')
17 #puts @compound.to_s
18 #
19 #@compound.remove_tag('name')
20 #puts @compound.to_s
59e89abc » mpd
2010-09-24 add some code to update tag values. not all tag types handled yet.
21
801343f7 » mpd
2010-09-23 refactor, get the rest of the classes to write nbt strings. not sure …
22 #puts @compound.to_nbt_string
4c997aab » mpd
2010-09-28 some performance tweaks, most importantly using a bindata string isnt…
23 #NBTUtils::File.new.write('biglolwut.nbt', @compound)
da2cf70f » mpd
2010-09-22 initial commit. classes read test nbt files as expected.
24
d6db7c6f » mpd
2010-09-28 Reading the file into memory and using a stringio to read the bytes i…
25 #@compound = NBTUtils::File.new.read('doc/bigtest.nbt')
26 #puts @compound.to_s
27
28
29 @compound = NBTUtils::File.new.read('doc/test.mclevel')
4c997aab » mpd
2010-09-28 some performance tweaks, most importantly using a bindata string isnt…
30 puts @compound.to_s
be40da71 » mpd
2010-09-22 refactoring, add some validity checking around adding tags to compoun…
31
1eb5a07c » mpd
2010-09-23 fix up writing nbt files. just need to encapsule file handling to the…
32 #puts @compound.to_nbt_string
4c997aab » mpd
2010-09-28 some performance tweaks, most importantly using a bindata string isnt…
33 #NBTUtils::File.new.write('biglolwut.nbt', @compound)
1eb5a07c » mpd
2010-09-23 fix up writing nbt files. just need to encapsule file handling to the…
34
d6db7c6f » mpd
2010-09-28 Reading the file into memory and using a stringio to read the bytes i…
35 #p @compound.find_tag(/Test/)
36 #p @compound.find_tag('Test')
37 #p @compound.find_tag('intTest')
38 #p @compound.find_tags(/(?:byte|int)Test/)
39 #p @compound.find_tags 'intasdf'
Something went wrong with that request. Please try again.