You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,9 @@ Due to the use of the new type annotations **Python 3.10+** is required!
14
14
After getting a [server](https://papermc.io/) and [compatible plugin](https://github.com/mcpq/mcpq-plugin?tab=readme-ov-file#versions) setup and running, the only thing left to do is to install the python library:
15
15
16
16
```bash
17
-
pip3 install mcpq
17
+
pip install mcpq
18
18
```
19
+
> Some of the extra features in `mcpq.tools` need additional dependencies, if you want to use them install with: `pip install mcpq[tools]`
19
20
20
21
Get coding and checkout [the docs](https://mcpq.github.io/mcpq-python/) for more examples!
21
22
@@ -78,7 +79,7 @@ TLDR; make sure the first 2 numbers (`major.minor`) of the library version are t
78
79
79
80
## Build Instructions
80
81
81
-
The library is currently [published on PyPI](https://pypi.org/project/mcpq/). The package can be downloaded from there with `pip3 install mcpq`.
82
+
The library is currently [published on PyPI](https://pypi.org/project/mcpq/). The package can be downloaded from there with `pip install mcpq`.
82
83
83
84
You can also install this package directly by using `pip install git+https://github.com/mcpq/mcpq-python.git@<tag/branch>` to install it directly from Github (`git` is required for this).
84
85
If you cloned the repository already then `pip install .` can be used.
<spanclass="sig-name descname"><spanclass="pre">getNbt</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><spanclass="sig-return"><spanclass="sig-return-icon">→</span><spanclass="sig-return-typehint"><aclass="reference internal" href="nbt.html#mcpq.nbt.NbtCompound" title="mcpq.nbt._types.NbtCompound"><spanclass="pre">NbtCompound</span></a><spanclass="w"></span><spanclass="p"><spanclass="pre">|</span></span><spanclass="w"></span><spanclass="pre">None</span></span></span><aclass="headerlink" href="#mcpq.entity.Entity.getNbt" title="Link to this definition">¶</a></dt>
161
+
<dd><p>Get the entity’s NBT data as <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">NBT</span></code> or None if the entity is not loaded. The data is not cached NBT data is always queried on call.</p>
162
+
<divclass="admonition caution">
163
+
<pclass="admonition-title">Caution</p>
164
+
<p>This function requires command output captuing.
165
+
The plugin that is built against the <codeclass="docutils literal notranslate"><spanclass="pre">spigot-Bukkit</span><spanclass="pre">API</span></code> does <em>not</em> fully support the return of command output.</p>
<spanclass="sig-name descname"><spanclass="pre">giveEffect</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">effect</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">str</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">seconds</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">int</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">0</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">amplifier</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">int</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">0</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">particles</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">bool</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">True</span></span></em><spanclass="sig-paren">)</span><spanclass="sig-return"><spanclass="sig-return-icon">→</span><spanclass="sig-return-typehint"><spanclass="pre">None</span></span></span><aclass="headerlink" href="#mcpq.entity.Entity.giveEffect" title="Link to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">MaterialFilter</span></span><aclass="headerlink" href="#mcpq.material.MaterialFilter" title="Link to this definition">¶</a></dt>
47
-
<dd><p>The <aclass="reference internal" href="#mcpq.material.MaterialFilter" title="mcpq.material.MaterialFilter"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">MaterialFilter</span></code></a>filteres materials, which includes types of blocks, items and other materials, by querying the server.
47
+
<dd><p>The <aclass="reference internal" href="#mcpq.material.MaterialFilter" title="mcpq.material.MaterialFilter"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">MaterialFilter</span></code></a>filters materials, which includes types of blocks, items and other materials, by querying the server.
48
48
The exact materials that are available depend on the Minecraft version and plugins/mods that are installed on the <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Minecraft</span></code> instance.</p>
49
49
<p>Typically, we would like to get a certain subtype of material, which can be filtered directly on this class. Once we have done this, we can iterate over it, return a list of applied filters or choose a random block from the filtered materials:</p>
<p>Most filteres can be inverted, either directly, e.g., <codeclass="docutils literal notranslate"><spanclass="pre">mc.materials.item(False)</span></code> to get all non-item materials, or by using the inverted keyword for string filters, e.g., <codeclass="docutils literal notranslate"><spanclass="pre">mc.materials.contains("yellow",</span><spanclass="pre">"orange",</span><spanclass="pre">negate=True)</span></code> to get all materials that do not contain the words yellow or orange.</p>
79
+
<p>Most filters can be inverted, either directly, e.g., <codeclass="docutils literal notranslate"><spanclass="pre">mc.materials.item(False)</span></code> to get all non-item materials, or by using the inverted keyword for string filters, e.g., <codeclass="docutils literal notranslate"><spanclass="pre">mc.materials.contains("yellow",</span><spanclass="pre">"orange",</span><spanclass="pre">negate=True)</span></code> to get all materials that do not contain the words yellow or orange.</p>
80
80
<p>Additionally, filters can be combined in a number of ways.
81
81
Let’s say we want to get all block types that contain the words “wool” or “concrete” but NOT the word “yellow”. There are multiple ways how we could filter the material list:</p>
@@ -253,8 +253,8 @@ <h1>Materials and Entity-Types<a class="headerlink" href="#materials-and-entity-
253
253
<dd><p>Works the same as <aclass="reference internal" href="#mcpq.material.MaterialFilter" title="mcpq.material.MaterialFilter"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">MaterialFilter</span></code></a> only for entity-types instead.</p>
254
254
<divclass="admonition note">
255
255
<pclass="admonition-title">Note</p>
256
-
<p>The interface and functions for entities is very similar to blocks, such that we are aliasing <aclass="reference internal" href="block.html#mcpq.nbt.EntityType" title="mcpq.nbt.EntityType"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">EntityType</span></code></a> to <aclass="reference internal" href="block.html#mcpq.nbt.Block" title="mcpq.nbt.Block"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Block</span></code></a> at the moment.
257
-
If at a later point the functionality between the two diverges then we will split the classes as well.</p>
256
+
<p>The interface and functions for entities is very similar to blocks, such that <aclass="reference internal" href="block.html#mcpq.nbt.EntityType" title="mcpq.nbt.EntityType"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">EntityType</span></code></a> is aliased to <aclass="reference internal" href="block.html#mcpq.nbt.Block" title="mcpq.nbt.Block"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Block</span></code></a> at the moment.
257
+
If at a later point the functionality between the two diverges then the classes will split up.</p>
0 commit comments