Пример #1
0
 def cb(chunk):
     block = chunk.get_block((x, y, z))
     if block != blocks["trapdoor"].slot:  # already removed
         return
     metadata = chunk.get_metadata((x, y, z))
     chunk.set_metadata((x, y, z), metadata ^ DOOR_IS_SWUNG)
     factory.flush_chunk(chunk)
Пример #2
0
 def cb(chunk):
     block = chunk.get_block((x, y, z))
     if block != blocks["trapdoor"].slot: # already removed
         return
     metadata = chunk.get_metadata((x, y, z))
     chunk.set_metadata((x, y, z), metadata ^ DOOR_IS_SWUNG)
     factory.flush_chunk(chunk)
Пример #3
0
        def cb(chunk):
            block = chunk.get_block((x, y, z))
            if block not in Door.doors:  # already removed
                return
            metadata = chunk.get_metadata((x, y, z))
            chunk.set_metadata((x, y, z), metadata ^ DOOR_IS_SWUNG)

            # Finding out which block is the door's top block.
            if (metadata & DOOR_TOP_BLOCK) != 0:
                other_y = y - 1
            else:
                other_y = y + 1

            other_block = chunk.get_block((x, other_y, z))
            if other_block in Door.doors:
                metadata = chunk.get_metadata((x, other_y, z))
                chunk.set_metadata((x, other_y, z), metadata ^ DOOR_IS_SWUNG)

            # Flush changed chunk
            factory.flush_chunk(chunk)
Пример #4
0
        def cb(chunk):
            block = chunk.get_block((x, y, z))
            if block not in Door.doors: # already removed
                return
            metadata = chunk.get_metadata((x, y, z))
            chunk.set_metadata((x, y, z), metadata ^ DOOR_IS_SWUNG)

            # Finding out which block is the door's top block.
            if (metadata & DOOR_TOP_BLOCK) != 0:
                other_y = y - 1
            else:
                other_y = y + 1

            other_block = chunk.get_block((x, other_y, z))
            if other_block in Door.doors:
                metadata = chunk.get_metadata((x, other_y, z))
                chunk.set_metadata((x, other_y, z), metadata ^ DOOR_IS_SWUNG)

            # Flush changed chunk
            factory.flush_chunk(chunk)
Пример #5
0
 def flushChunks(self):
     for bigx, bigz in self.touchedChunks:
         chunk = yield factory.world.request_chunk(bigx, bigz)
         factory.flush_chunk(chunk)