Skip to content

Commit 65ff6ad

Browse files
Added the Entity Metadata type
* Modified the conf.py sphinx configuration file to ignore the custom fields used in the Entity Metadata type * Added the Entity Metadata type to the documentation * Added `scripts` to the .codeclimate.yml ignore list * Added a changelog entry for the pull request
1 parent 29a2759 commit 65ff6ad

18 files changed

+16845
-5
lines changed

.codeclimate.yml

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ checks:
3131
return-statements:
3232
enabled: false
3333

34+
35+
3436
exclude_patterns:
3537
- "tests/**"
3638
- ".github/**"
39+
# The scripts directory is only there to provide quick scripts to generate things that are in the actual code
40+
# They don't need testing as they are not meant to be used outside the developpment process
41+
- "scripts/**"

changes/297.feature.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
- Added more types to the implementation:
2+
- `Angle`: Represents an angle.
3+
- `BitSet`: Represents a set of bits of variable length.
4+
- `FixedBitSet`: Represents a set of bits of fixed length.
5+
- `TextComponent`: Represents a Minecraft text component.
6+
- Renamed `ChatMessage` to `JSONTextComponent`.
7+
- `Identifier`: Represents a Minecraft identifier.
8+
- `Quaternion`: Represents a quaternion.
9+
- `Slot`: Represents an item slot.
10+
- `Vec3`: Represents a 3D vector.
11+
- `Position`: Represents a position with packed integers.
12+
- `EntityMetadata`: Represents metadata for an entity.
13+
> There are **A LOT** of different entity metadata types, so I'm not going to list them all here.

docs/api/types/entity_metadata.rst

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Entity Metadata
2+
======================
3+
4+
This is the documentation for the NBT type used in Minecraft's network protocol.
5+
6+
7+
8+
9+
.. automodule:: mcproto.types.entity
10+
:no-undoc-members:

docs/api/types/index.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
.. api/types documentation master file
1+
.. Types Documentation
22
3-
=======================
4-
API Types Documentation
5-
=======================
3+
Types Documentation
4+
==================================
65

7-
Welcome to the API Types documentation! This documentation provides information about the various types used in the API.
6+
This folder contains the documentation for various types used in the project.
87

98
.. toctree::
109
:maxdepth: 2
1110

1211
nbt.rst
12+
entity_metadata.rst

docs/api/types/nbt.rst

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
NBT Format
22
==========
33

4+
This is the documentation for the NBT type used in Minecraft's network protocol.
5+
6+
47
.. automodule:: mcproto.types.nbt
58
:members:
69
:show-inheritance:

docs/conf.py

+18
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212
import sys
1313
import datetime
1414
from pathlib import Path
15+
from typing import Any
1516

1617
from packaging.version import parse as parse_version
1718
from typing_extensions import override
1819

20+
from mcproto.types.entity.metadata import _ProxyEntityMetadataEntry, _DefaultEntityMetadataEntry
21+
1922
if sys.version_info >= (3, 11):
2023
from tomllib import load as toml_parse
2124
else:
@@ -117,6 +120,21 @@
117120
"exclude-members": "__dict__,__weakref__",
118121
}
119122

123+
124+
def autodoc_skip_member(app: Any, what: str, name: str, obj: Any, skip: bool, options: Any) -> bool:
125+
"""Skip EntityMetadataEntry class fields as they are already documented in the docstring."""
126+
if isinstance(obj, type) and (
127+
issubclass(obj, _ProxyEntityMetadataEntry) or issubclass(obj, _DefaultEntityMetadataEntry)
128+
):
129+
return True
130+
return skip
131+
132+
133+
def setup(app: Any) -> None:
134+
"""Set up the Sphinx app."""
135+
app.connect("autodoc-skip-member", autodoc_skip_member)
136+
137+
120138
# -- sphinx.ext.autosectionlabel ---------------
121139

122140
# Automatically generate section labels:

0 commit comments

Comments
 (0)