Example #1
0
 def test_tag(self):
     be1 = BlockEntity('chest')
     be2 = be1.tag({'Lock': 'password'})
     self.assertEqual(be1.block_id, 'chest')
     self.assertEqual(be1.data_tag, CompoundDataTag())
     self.assertEqual(be2.block_id, 'chest')
     self.assertEqual(be2.data_tag, CompoundDataTag({'Lock': 'password'}))
Example #2
0
 def test_tag_overwrite(self):
     be1 = BlockEntity('chest',
                       data_tag=CompoundDataTag({'Lock': 'password'}))
     be2 = be1.tag({'Lock': 'guessme'})
     self.assertEqual(be1.block_id, 'chest')
     self.assertEqual(be1.data_tag, CompoundDataTag({'Lock': 'password'}))
     self.assertEqual(be2.block_id, 'chest')
     self.assertEqual(be2.data_tag, CompoundDataTag({'Lock': 'guessme'}))
Example #3
0
 def test_tag_more(self):
     be1 = BlockEntity('chest',
                       data_tag=CompoundDataTag({'Lock': 'password'}))
     be2 = be1.tag({'CustomName': 'Materials'})
     self.assertEqual(be1.block_id, 'chest')
     self.assertEqual(be1.data_tag, CompoundDataTag({'Lock': 'password'}))
     self.assertEqual(be2.block_id, 'chest')
     self.assertEqual(
         be2.data_tag,
         CompoundDataTag({
             'Lock': 'password',
             'CustomName': 'Materials'
         }))
Example #4
0
 def test_block_with_id_and_state_and_data_tag(self):
     cmd = commands.setblock(position=ZERO_OFFSET,
                             block=BlockEntity(
                                 block_id='dropper',
                                 block_state=dict(facing='up'),
                                 data_tag={'Lock': 'password'}))
     self.assertEqual(str(cmd),
                      'setblock ~ ~ ~ dropper[facing=up]{Lock:password}')
Example #5
0
 def test_with_id(self):
     be = BlockEntity('chest')
     self.assertEqual(be.block_id, 'chest')
Example #6
0
 def test_data_tag_from_braces(self):
     be = BlockEntity('chest', data_tag={'Lock': 'password'})
     self.assertEqual(be.data_tag['Lock'], StringDataTag('password'))
Example #7
0
 def test_data_tag_from_dict(self):
     be = BlockEntity('chest', data_tag=dict(lock='password'))
     self.assertEqual(be.data_tag['lock'], StringDataTag('password'))
Example #8
0
 def test_with_id_and_block_state_and_data_tag(self):
     be = BlockEntity('chest', BlockState(facing='north'),
                      CompoundDataTag(lock='password'))
     self.assertEqual(be.block_id, 'chest')
     self.assertEqual(be.block_state['facing'], 'north')
     self.assertEqual(be.data_tag['lock'], StringDataTag('password'))
Example #9
0
 def test_with_id_and_block_state(self):
     be = BlockEntity('chest', BlockState(facing='north'))
     self.assertEqual(be.block_id, 'chest')
     self.assertEqual(be.block_state['facing'], 'north')