Esempio n. 1
0
 def setUp(self):
     self.tile = FurnaceTile(0, 0, 0)
     self.protocol = FakeProtocol()
     self.protocol.windows.append(FurnaceWindow(7, Inventory(),
         self.tile.inventory, coords))
     self.factory = FakeFactory()
     self.factory.protocols = {1: self.protocol}
Esempio n. 2
0
    def setUp(self):
        self.tile = FurnaceTile(0, 0, 0)
        self.tile2 = FurnaceTile(0, 1, 0)

        # no any windows
        self.protocol1 = FakeProtocol()
        # window with different coordinates
        self.protocol2 = FakeProtocol()
        self.protocol2.windows.append(FurnaceWindow(1, Inventory(),
            self.tile2.inventory, coords2))
        # windows with proper coodinates
        self.protocol3 = FakeProtocol()
        self.protocol3.windows.append(FurnaceWindow(2, Inventory(),
            self.tile.inventory, coords))

        self.factory = FakeFactory()
        self.factory.protocols = {
            1: self.protocol1,
            2: self.protocol2,
            3: self.protocol3
        }
Esempio n. 3
0
class TestFurnaceIntegration(unittest.TestCase):
    def setUp(self):
        self.i = FurnaceWindow(1, Inventory(), FurnaceStorage(), 0)

    def test_internals(self):
        self.assertEqual(self.i.metalist, [[None], [None], [None], [None] * 27, [None] * 9])

    def test_furnace_no_drop(self):
        self.i.slots.crafted[0] = Slot(1, 0, 1)
        self.i.slots.crafting[0] = Slot(2, 0, 1)
        self.i.slots.fuel[0] = Slot(3, 0, 1)
        items, packets = self.i.close()
        self.assertEqual(items, [])
        self.assertEqual(packets, "")
Esempio n. 4
0
class TestFurnaceIntegration(unittest.TestCase):
    def setUp(self):
        self.i = FurnaceWindow(1, Inventory(), FurnaceStorage(), 0)

    def test_internals(self):
        self.assertEqual(self.i.metalist,
                         [[None], [None], [None], [None] * 27, [None] * 9])

    def test_furnace_no_drop(self):
        self.i.slots.crafted[0] = Slot(1, 0, 1)
        self.i.slots.crafting[0] = Slot(2, 0, 1)
        self.i.slots.fuel[0] = Slot(3, 0, 1)
        items, packets = self.i.close()
        self.assertEqual(items, [])
        self.assertEqual(packets, "")
Esempio n. 5
0
    def open_hook(self, player, container, block):
        """
        The ``player`` is a Player's protocol
        The ``container`` is a 0x64 message
        The ``block`` is a block we trying to open
        :returns: None or window object
        """
        if block not in (blocks["furnace"].slot, blocks["burning-furnace"].slot):
            returnValue(None)

        bigx, smallx, bigz, smallz = split_coords(container.x, container.z)
        chunk = yield factory.world.request_chunk(bigx, bigz)

        furnace = self.get_furnace_tile(chunk, (smallx, container.y, smallz))
        if furnace is None:
            returnValue(None)

        coords = bigx, smallx, bigz, smallz, container.y
        window = FurnaceWindow(player.wid, player.player.inventory,
                               furnace.inventory, coords)
        player.windows.append(window)
        returnValue(window)
Esempio n. 6
0
 def setUp(self):
     self.i = FurnaceWindow(1, Inventory(), FurnaceStorage(), 0)
Esempio n. 7
0
 def setUp(self):
     self.i = FurnaceWindow(1, Inventory(), FurnaceStorage(), 0)