Skip to content

Commit d133a83

Browse files
Tweak documentation for type classes
1 parent 37b95e0 commit d133a83

File tree

13 files changed

+56
-39
lines changed

13 files changed

+56
-39
lines changed

docs/api/types/general.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ Here are documented the general types used throughout the Minecraft protocol.
55

66
.. automodule:: mcproto.types
77
:no-undoc-members:
8-
:exclude-members: NBTag, StringNBT, CompoundNBT, EndNBT
8+
:exclude-members: NBTag, StringNBT, CompoundNBT, EndNBT, EntityMetadata, UUID
9+
10+
.. autoclass:: mcproto.types.UUID
11+
:class-doc-from: class

docs/pages/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Latest (git) version
1717

1818
Alternatively, you may want to install the latest available version, which is what you currently see in the ``main``
1919
git branch. Although this method will actually work for any branch with a pretty straightforward change. This kind of
20-
installation should only be done when testing new feautes, and it's likely you'll encounter bugs.
20+
installation should only be done when testing new features, and it's likely you'll encounter bugs.
2121

2222
That said, since mcproto is still in development, changes can often be made pretty quickly, and it can sometimes take a
2323
while for these changes to carry over to PyPI. So if you really want to try out that latest feature, this is the method

mcproto/multiplayer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def compute_server_hash(server_id: str, shared_secret: bytes, server_public_key:
140140
need to know the encryption key (``shared_secret``). A proxy can capture this key, as the client
141141
sends it over to the server in :class:`~mcproto.packets.login.login.LoginEncryptionResponse` packet,
142142
however it is sent encrypted. The client performs this encryption with a public key, which it got
143-
from the server, in :class:`mcproto.packets.login.login.LoginEncryptionRequest` packet.
143+
from the server, in :class:`~mcproto.packets.login.login.LoginEncryptionRequest` packet.
144144
145145
That mans that for a proxy to be able to actually obtain this shared secret value, it would need to
146146
be able to capture the encryption response, and decrypt the shared secret value. That means it would

mcproto/packets/login/login.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class LoginStart(ServerBoundPacket):
3333
Initialize the LoginStart packet.
3434
3535
:param username: Username of the client who sent the request.
36-
:param uuid: UUID of the player logging in (if the player doesn't have a UUID, this can be ``None``)
36+
:param uuid: UUID of the player logging in (unused by the server)
37+
:type uuid: :class:`~mcproto.types.UUID`
3738
"""
3839

3940
PACKET_ID: ClassVar[int] = 0x00
@@ -143,7 +144,9 @@ class LoginSuccess(ClientBoundPacket):
143144
Initialize the LoginSuccess packet.
144145
145146
:param uuid: The UUID of the connecting player/client.
147+
:type uuid: :class:`~mcproto.types.UUID`
146148
:param username: The username of the connecting player/client.
149+
:type username: str
147150
"""
148151

149152
PACKET_ID: ClassVar[int] = 0x02

mcproto/types/advancement.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Advancement(MCType):
2121
https://wiki.vg/Protocol#Update_Advancements
2222
2323
:param parent: The parent advancement.
24-
:type parent: :class:`mcproto.types.identifier.Identifier`, optional
24+
:type parent: :class:`~mcproto.types.identifier.Identifier`, optional
2525
:param display: The display information.
2626
:type display: :class:`AdvancementDisplay`, optional
2727
:param requirements: The criteria for this advancement.
@@ -62,14 +62,14 @@ class AdvancementDisplay(MCType):
6262
"""Describes how an advancement should look.
6363
6464
:param title: The title of the advancement.
65-
:type title: :class:`mcproto.types.chat.TextComponent`
65+
:type title: :class:`~mcproto.types.chat.TextComponent`
6666
:param description: The description of the advancement.
67-
:type description: :class:`mcproto.types.chat.TextComponent`
67+
:type description: :class:`~mcproto.types.chat.TextComponent`
6868
:param icon: The icon of the advancement.
69-
:type icon: :class:`mcproto.types.slot.Slot`
69+
:type icon: :class:`~mcproto.types.slot.Slot`
7070
:param frame: The frame of the advancement (0: task, 1: challenge, 2: goal).
7171
:param background: The background texture of the advancement.
72-
:type background: :class:`mcproto.types.identifier.Identifier`, optional
72+
:type background: :class:`~mcproto.types.identifier.Identifier`, optional
7373
:param show_toast: Whether to show a toast notification.
7474
:type show_toast: bool
7575
:param hidden: Whether the advancement is hidden.
@@ -136,7 +136,7 @@ class AdvancementProgress(MCType):
136136
"""Represents the progress of an advancement.
137137
138138
:param criteria: The criteria for this advancement.
139-
:type criteria: dict[:class:`mcproto.types.identifier.Identifier`, :class:`AdvancementCriterion`]
139+
:type criteria: dict[:class:`~mcproto.types.identifier.Identifier`, :class:`AdvancementCriterion`]
140140
"""
141141

142142
criteria: dict[Identifier, AdvancementCriterion]

mcproto/types/block_entity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class BlockEntity(MCType):
2222
:type nbt: CompoundNBT
2323
2424
.. warning:: The position must be within the chunk.
25-
.. note :: This class is used in the :class:`mcproto.packets.play.ChunkData` packet.
25+
.. note :: This class is used in the :class:`~mcproto.packets.play.ChunkData` packet.
2626
"""
2727

2828
position: Position

mcproto/types/entity/metadata.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -372,13 +372,15 @@ class EntityMetadata(MCType, metaclass=EntityMetadataCreator):
372372
You can set attributes of the entity class by using the entry() and proxy() functions.
373373
374374
Example:
375-
```python
376-
class EntityMetadata(EntityMetadata):
377-
byte_entry: ClassVar[int] = entry(ByteEME, 0) # ByteEME is the type and 0 is the default value
378-
varint_entry: int = entry(VarIntEME, 0)
379-
proxy_entry: int = proxy(byte_entry, Masked, mask=0x01)
380-
proxy_entry2: int = proxy(byte_entry, Masked, mask=0x02)
381-
```
375+
376+
.. code-block:: python
377+
378+
class EntityMetadata(EntityMetadata):
379+
byte_entry: ClassVar[int] = entry(ByteEME, 0) # ByteEME is the type and 0 is the default value
380+
varint_entry: int = entry(VarIntEME, 0)
381+
proxy_entry: int = proxy(byte_entry, Masked, mask=0x01)
382+
proxy_entry2: int = proxy(byte_entry, Masked, mask=0x02)
383+
382384
383385
Note that the extra arguments for the proxy() function are passed to the proxy class and that the
384386
bound entry is passed as the first argument without quotes.

mcproto/types/identifier.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Identifier(MCType, NBTagConvertible):
1717
:param path: The path of the identifier.
1818
:type path: str, optional
1919
20-
If the path is not provided, the namespace and path will be extracted from the :arg:`namespace` argument.
20+
If the path is not provided, the namespace and path will be extracted from the :attr:`namespace` argument.
2121
If the namespace is not provided, it will default to "minecraft".
2222
"""
2323

mcproto/types/modifier.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ class ModifierOperation(IntEnum):
2929
@final
3030
@define
3131
class ModifierData(MCType):
32-
"""Represents a modifier data in the :class:`mcproto.packets.play.UpdateAttributes` packet.
32+
"""Represents a modifier data in the :class:`~mcproto.packets.play.UpdateAttributes` packet.
3333
3434
https://wiki.vg/Protocol#Update_Attributes
3535
3636
:param uuid: The UUID of the modifier.
37-
:type uuid: :class:`mcproto.types.uuid.UUID`
37+
:type uuid: :class:`~mcproto.types.uuid.UUID`
3838
:param amount: The amount of the modifier.
3939
:type amount: float
4040
:param operation: The operation of the modifier.

mcproto/types/particle_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ class ParticleData(MCType):
4848
:type roll: float, optional
4949
5050
:param item: The item that will be displayed as a particle.
51-
:type item: :class:`mcproto.types.item.Slot`, optional
51+
:type item: :class:`~mcproto.types.item.Slot`, optional
5252
5353
:param source_type: The type of the source of the particle. (0 for `minecraft:block`, 1 for `minecraft:entity`)
5454
:type source_type: int, optional
5555
:param block_position: The position of the block that is the source of the particle. (used when `source_type` is 0)
56-
:type block_position: :class:`mcproto.types.vec3.Position`, optional
56+
:type block_position: :class:`~mcproto.types.vec3.Position`, optional
5757
:param entity_id: The ID of the entity that is the source of the particle. (used when `source_type` is 1)
5858
:type entity_id: int, optional
5959
:param entity_eye_height: The height of the entity's eye relative to the entity. (used when `source_type` is 1)

0 commit comments

Comments
 (0)