コード例 #1
0
 def decode(cls, buf: Buffer) -> PlayPlayerPositionAndRotationServerBound:
     return cls(
         buf.unpack("d"),
         buf.unpack("d"),
         buf.unpack("d"),
         buf.unpack("d"),
         buf.unpack("d"),
         buf.unpack("?"),
     )
コード例 #2
0
 def decode(cls, buf: Buffer) -> PlayClientSettings:
     return cls(
         buf.unpack_string(),
         buf.unpack("b"),
         buf.unpack_varint(),
         buf.unpack("?"),
         buf.unpack("B"),
         buf.unpack_varint(),
     )
コード例 #3
0
 def decode(cls, buf: Buffer) -> PlayClickWindow:
     return cls(
         buf.unpack("B"),
         buf.unpack("h"),
         buf.unpack("b"),
         buf.unpack("h"),
         buf.unpack_varint(),
         buf.unpack_slot(),
     )
コード例 #4
0
ファイル: block.py プロジェクト: Iapetus-11/PyMine
 def decode(cls, buf: Buffer) -> PlayBlockPlacement:
     return cls(
         buf.unpack_varint(),
         *buf.unpack_pos(),
         buf.unpack_varint(),
         buf.unpack("f"),
         buf.unpack("f"),
         buf.unpack("f"),
         buf.unpack("?"),
     )
コード例 #5
0
ファイル: test_buffer.py プロジェクト: sunarch/PyMine
def test_basic():
    buf = Buffer()

    buf.write(
        Buffer.pack("i", 123) + Buffer.pack("b", 1) + Buffer.pack("?", True) +
        Buffer.pack("q", 1234567890456))
    assert buf.buf == b"\x00\x00\x00{\x01\x01\x00\x00\x01\x1fq\xfb\x06\x18"

    assert buf.unpack("i") == 123
    assert buf.unpack("b") == 1
    assert buf.unpack("?") is True
    assert buf.unpack("q") == 1234567890456
コード例 #6
0
 def decode(cls, buf: Buffer) -> PlayUpdateStructureBlock:
     return cls(
         *buf.unpack_pos(),
         buf.unpack_varint(),
         buf.unpack_varint(),
         buf.unpack_string(),
         buf.unpack("b"),
         buf.unpack("b"),
         buf.unpack("b"),
         buf.unpack("b"),
         buf.unpack("b"),
         buf.unpack("b"),
         buf.unpack_varint(),
         buf.unpack_varint(),
         buf.unpack_string(),
         buf.unpack("f"),
         buf.unpack_varint(),
         buf.unpack("b"),
     )
コード例 #7
0
ファイル: entity.py プロジェクト: Iapetus-11/PyMine
 def decode(cls, buf: Buffer) -> PlayInteractEntity:
     return cls(
         buf.unpack_varint(),
         buf.unpack_varint(),
         buf.unpack_optional(buf.unpack_varint),
         buf.unpack_optional(buf.unpack_varint),
         buf.unpack_optional(buf.unpack_varint),
         buf.unpack_optional(buf.unpack_varint),
         buf.unpack("?"),
     )
コード例 #8
0
ファイル: difficulty.py プロジェクト: pixlperfect01/PyMine
 def decode(cls, buf: Buffer) -> PlayLockDifficulty:
     return cls(buf.unpack("?"))
コード例 #9
0
ファイル: difficulty.py プロジェクト: pixlperfect01/PyMine
 def decode(cls, buf: Buffer) -> PlaySetDifficulty:
     return cls(buf.unpack("b"))
コード例 #10
0
ファイル: command_block.py プロジェクト: sunarch/PyMine
 def decode(cls, buf: Buffer) -> PlayUpdateCommandBlock:
     return cls(
         *buf.unpack_position(), buf.unpack_string(), buf.unpack_varint(), buf.unpack("b")
     )
コード例 #11
0
 def decode(cls, buf: Buffer) -> PlayPlayerDigging:
     return cls(buf.unpack_varint(), *buf.unpack_position(), buf.unpack("b"))
コード例 #12
0
 def decode(cls, buf: Buffer) -> PlaySteerVehicle:
     return cls(buf.unpack("f"), buf.unpack("f"), buf.unpack("B"))
コード例 #13
0
 def decode(cls, buf: Buffer) -> PlayCloseWindowServerBound:
     return cls(buf.unpack("b"))
コード例 #14
0
 def decode(cls, buf: Buffer) -> PlayCraftRecipeRequest:
     return cls(buf.unpack("b"), buf.unpack_string(), buf.unpack("?"))
コード例 #15
0
ファイル: legacy_ping.py プロジェクト: pixlperfect01/PyMine
 def decode(cls, buf: Buffer) -> HandshakeLegacyPingRequest:
     buf.read(15)
     return cls(buf.read(1),
                buf.read(buf.unpack("h")).decode("UTF-16BE"),
                buf.unpack("i"))
コード例 #16
0
 def decode(cls, buf: Buffer) -> PlayEditBook:
     return cls(buf.unpack_slot(), buf.unpack("?"), buf.unpack_varint())
コード例 #17
0
 def decode(cls, buf: Buffer) -> PlayPlayerAbilitiesServerBound:
     return cls(buf.unpack("b") == 0x02)
コード例 #18
0
 def decode(cls, buf: Buffer) -> PlayHeldItemChangeServerBound:
     return cls(buf.unpack("h"))
コード例 #19
0
 def decode(cls, buf: Buffer) -> PlaySetRecipeBookState:
     return cls(buf.unpack_varint(), buf.unpack("?"), buf.unpack("?"))
コード例 #20
0
ファイル: command_block.py プロジェクト: sunarch/PyMine
 def decode(cls, buf: Buffer) -> PlayUpdateCommandBlockMinecart:
     return cls(buf.unpack_varint(), buf.unpack_string(), buf.unpack("?"))
コード例 #21
0
ファイル: handshake.py プロジェクト: pixlperfect01/PyMine
 def decode(cls, buf: Buffer) -> HandshakeHandshake:
     return cls(buf.unpack_varint(), buf.unpack_string(), buf.unpack("H"),
                buf.unpack_varint())
コード例 #22
0
 def decode(cls, buf: Buffer) -> PlaySteerBoat:
     return cls(buf.unpack("?"), buf.unpack("?"))
コード例 #23
0
 def decode(cls, buf: Buffer) -> PlayWindowConfirmationServerBound:
     return cls(buf.unpack("b"), buf.unpack("h"), buf.unpack("?"))
コード例 #24
0
 def decode(cls, buf: Buffer) -> PlayVehicleMoveServerBound:
     return cls(buf.unpack("d"), buf.unpack("d"), buf.unpack("d"),
                buf.unpack("f"), buf.unpack("f"))
コード例 #25
0
 def decode(cls, buf: Buffer) -> PlayCloseWindowButton:
     return cls(buf.unpack("b"), buf.unpack("b"))
コード例 #26
0
 def decode(cls, buf: Buffer) -> PlayCreativeInventoryAction:
     return cls(buf.unpack("h"), buf.unpack_slot())
コード例 #27
0
 def decode(cls, buf: Buffer) -> PlayPlayerRotation:
     return cls(buf.unpack("d"), buf.unpack("d"), buf.unpack("?"))
コード例 #28
0
ファイル: advancement.py プロジェクト: Iapetus-11/PyMine
 def decode(cls, buf: Buffer) -> PlayAdvancementTab:
     return cls(buf.unpack_varint(),
                (buf.unpack_varint() if buf.unpack("?") else None))
コード例 #29
0
 def decode(cls, buf: Buffer) -> StatusStatusPingPong:
     return cls(buf.unpack("q"))
コード例 #30
0
 def decode(cls, buf: Buffer) -> PlayPlayerMovement:
     return cls(buf.unpack("?"))