Skip to content

Commit

Permalink
Add test layout
Browse files Browse the repository at this point in the history
  • Loading branch information
DonoA committed Jan 7, 2019
1 parent d8920d6 commit 883906f
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 5 deletions.
5 changes: 2 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
from pyanvil import World, BlockState, Material

with World('A', save_location='/home/dallen/.minecraft/saves', debug=True) as wrld:
print('World loaded!')
cv = wrld.get_canvas()
cv.select_rectangle((50, 90, -260), (60, 92, -220)).fill(BlockState(Material.diamond_block, {}))
cv.select_rectangle((156, 96, -271), (177, 131, -249)).copy().paste(wrld, (100, 110, -250))
cv.select_rectangle((334, 67, -240), (347, 100, -222)).copy().paste(wrld, (411, 105, -302))
cv.select_rectangle((334, 67, -240), (347, 100, -222)).fill(BlockState(Material.diamond_block, {}))

print('Saved!')
7 changes: 7 additions & 0 deletions pyanvil/nbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def parse(cls, stream, name):
)

def __init__(self, tag_value, tag_name='None'):
int(tag_value)
self.tag_name = tag_name
self.tag_value = tag_value

Expand Down Expand Up @@ -190,6 +191,9 @@ def __init__(self, sub_type_id, tag_name='None', children=[]):
def add_child(self, tag):
self.children.append(tag)

def get(self):
return [c.get() for c in self.children]

def name(self):
return self.tag_name

Expand Down Expand Up @@ -248,6 +252,9 @@ def add_child(self, tag):
def get(self, name):
return self.children[name]

# def get(self):
# return { n: v.get() for n, v in self.children }

def name(self):
return self.tag_name

Expand Down
4 changes: 2 additions & 2 deletions pyanvil/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ def serialize(self):
serial_section.add_child(self._serialize_blockstates(mat_id_mapping))

if not serial_section.has('SkyLight'):
serial_section.add_child(nbt.ByteArrayTag(tag_name='SkyLight', children=[nbt.ByteTag('None', -1) for i in range(2048)]))
serial_section.add_child(nbt.ByteArrayTag(tag_name='SkyLight', children=[nbt.ByteTag(-1, tag_name='None') for i in range(2048)]))

if not serial_section.has('BlockLight'):
serial_section.add_child(nbt.ByteArrayTag(tag_name='BlockLight', children=[nbt.ByteTag('None', -1) for i in range(2048)]))
serial_section.add_child(nbt.ByteArrayTag(tag_name='BlockLight', children=[nbt.ByteTag(-1, tag_name='None') for i in range(2048)]))

return serial_section

Expand Down
9 changes: 9 additions & 0 deletions test/canvas_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class TestCanvas:
def test_selection(args):
pass

def test_deselection(args):
pass

def test_fill(args):
pass
9 changes: 9 additions & 0 deletions test/schematic_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class TestSchematics:
def test_pasting(args):
pass

def test_saving(args):
pass

def test_loading(args):
pass
12 changes: 12 additions & 0 deletions test/world_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class TestWorld:
def test_loading_low_pack_world(args):
pass

def test_loading_high_pack_world(args):
pass

def test_save_simple_change_world(args):
pass

def test_save_resized_chunk_world(args):
pass

0 comments on commit 883906f

Please sign in to comment.