Skip to content

Commit

Permalink
Added the Entity Metadata type
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
LiteApplication committed May 26, 2024
1 parent c550b3e commit 80811f7
Show file tree
Hide file tree
Showing 18 changed files with 16,845 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ checks:
return-statements:
enabled: false



exclude_patterns:
- "tests/**"
- ".github/**"
# The scripts directory is only there to provide quick scripts to generate things that are in the actual code
# They don't need testing as they are not meant to be used outside the developpment process
- "scripts/**"
13 changes: 13 additions & 0 deletions changes/297.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- Added more types to the implementation:
- `Angle`: Represents an angle.
- `BitSet`: Represents a set of bits of variable length.
- `FixedBitSet`: Represents a set of bits of fixed length.
- `TextComponent`: Represents a Minecraft text component.
- Renamed `ChatMessage` to `JSONTextComponent`.
- `Identifier`: Represents a Minecraft identifier.
- `Quaternion`: Represents a quaternion.
- `Slot`: Represents an item slot.
- `Vec3`: Represents a 3D vector.
- `Position`: Represents a position with packed integers.
- `EntityMetadata`: Represents metadata for an entity.
> There are **A LOT** of different entity metadata types, so I'm not going to list them all here.
10 changes: 10 additions & 0 deletions docs/api/types/entity_metadata.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Entity Metadata
======================

This is the documentation for the NBT type used in Minecraft's network protocol.




.. automodule:: mcproto.types.entity
:no-undoc-members:
10 changes: 5 additions & 5 deletions docs/api/types/index.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.. api/types documentation master file
.. Types Documentation
=======================
API Types Documentation
=======================
Types Documentation
==================================

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

.. toctree::
:maxdepth: 2

nbt.rst
entity_metadata.rst
3 changes: 3 additions & 0 deletions docs/api/types/nbt.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
NBT Format
==========

This is the documentation for the NBT type used in Minecraft's network protocol.


.. automodule:: mcproto.types.nbt
:members:
:show-inheritance:
18 changes: 18 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
import sys
import datetime
from pathlib import Path
from typing import Any

from packaging.version import parse as parse_version
from typing_extensions import override

from mcproto.types.entity.metadata import _ProxyEntityMetadataEntry, _DefaultEntityMetadataEntry

if sys.version_info >= (3, 11):
from tomllib import load as toml_parse
else:
Expand Down Expand Up @@ -117,6 +120,21 @@
"exclude-members": "__dict__,__weakref__",
}


def autodoc_skip_member(app: Any, what: str, name: str, obj: Any, skip: bool, options: Any) -> bool:
"""Skip EntityMetadataEntry class fields as they are already documented in the docstring."""
if isinstance(obj, type) and (
issubclass(obj, _ProxyEntityMetadataEntry) or issubclass(obj, _DefaultEntityMetadataEntry)
):
return True
return skip


def setup(app: Any) -> None:
"""Set up the Sphinx app."""
app.connect("autodoc-skip-member", autodoc_skip_member)


# -- sphinx.ext.autosectionlabel ---------------

# Automatically generate section labels:
Expand Down
Loading

0 comments on commit 80811f7

Please sign in to comment.