mcapibridge 0.1.1__py3-none-any.whl → 0.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mc/minecraft.py +15 -2
- {mcapibridge-0.1.1.dist-info → mcapibridge-0.1.3.dist-info}/METADATA +22 -4
- mcapibridge-0.1.3.dist-info/RECORD +7 -0
- mcapibridge-0.1.1.dist-info/RECORD +0 -7
- {mcapibridge-0.1.1.dist-info → mcapibridge-0.1.3.dist-info}/WHEEL +0 -0
- {mcapibridge-0.1.1.dist-info → mcapibridge-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {mcapibridge-0.1.1.dist-info → mcapibridge-0.1.3.dist-info}/top_level.txt +0 -0
mc/minecraft.py
CHANGED
|
@@ -41,8 +41,10 @@ class BlockHit:
|
|
|
41
41
|
self.pos = Vec3(x, y, z)
|
|
42
42
|
self.face = face
|
|
43
43
|
self.entityId = entityId
|
|
44
|
-
self.action = action # 1=Left,2=Right
|
|
45
|
-
|
|
44
|
+
self.action = action # 1=Left,2=Right,101-105:Keyboard Action
|
|
45
|
+
if action == 1: self.type = "LEFT_CLICK"
|
|
46
|
+
elif action == 2: self.type = "RIGHT_CLICK"
|
|
47
|
+
elif action > 100: self.type = f"KEY_MACRO_{action - 100}"
|
|
46
48
|
|
|
47
49
|
class Minecraft:
|
|
48
50
|
def __init__(self, host="localhost", port=4711):
|
|
@@ -340,3 +342,14 @@ class Minecraft:
|
|
|
340
342
|
cmd = f"world.setSign({int(x)},{int(y)},{int(z)},{l1},{l2},{l3},{l4})"
|
|
341
343
|
if dimension: cmd += f",{dimension}"
|
|
342
344
|
self._send(cmd)
|
|
345
|
+
|
|
346
|
+
def lookAt(self, target, x, y, z):
|
|
347
|
+
self._send(f"player.lookAt({target},{x},{y},{z})")
|
|
348
|
+
|
|
349
|
+
def setEntityNbt(self, entity_id, nbt_string):
|
|
350
|
+
self._send(f"entity.setNbt({entity_id},{nbt_string})")
|
|
351
|
+
|
|
352
|
+
def setBlockNbt(self, x, y, z, nbt_string, dimension=None):
|
|
353
|
+
cmd = f"block.setNbt({int(x)},{int(y)},{int(z)},{nbt_string})"
|
|
354
|
+
if dimension: cmd += f",{dimension}"
|
|
355
|
+
self._send(cmd)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mcapibridge
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Python libary for MCAPIBridge
|
|
5
5
|
Author: TaotianZhufang
|
|
6
6
|
License: MIT License
|
|
@@ -127,13 +127,31 @@ Sets the text on a sign block.
|
|
|
127
127
|
|
|
128
128
|
**The block at the position must already be a sign.**
|
|
129
129
|
|
|
130
|
+
#### `lookAt(target, x, y, z)`
|
|
131
|
+
Forces a player or entity to look at a specific coordinate.
|
|
132
|
+
* **target**: String player name or Entity ID.
|
|
133
|
+
* **x, y, z**: The coordinate to look at.
|
|
134
|
+
* *Example*: `mc.lookAt("Steve", 0, 100, 0)` forces Steve to look up.
|
|
135
|
+
|
|
136
|
+
#### `setEntityNbt(entity_id, nbt_string)`
|
|
137
|
+
Modifies the NBT data of an entity directly using JSON format.
|
|
138
|
+
* **entity_id**: Integer Entity ID.
|
|
139
|
+
* **nbt_string**: Valid SNBT string (e.g., `"{NoAI:1b, Glowing:1b}"`).
|
|
140
|
+
* *Note*: Useful for setting attributes like Scale in 1.20.6 (`{Attributes:[{Name:"generic.scale",Base:2.0d}]}`).
|
|
141
|
+
|
|
142
|
+
#### `setBlockNbt(x, y, z, nbt_string, dimension=None)`
|
|
143
|
+
Modifies the NBT data of a block entity (Tile Entity).
|
|
144
|
+
* **x, y, z**: Integer coordinates.
|
|
145
|
+
* **nbt_string**: Valid SNBT string.
|
|
146
|
+
|
|
147
|
+
|
|
130
148
|
---
|
|
131
149
|
|
|
132
150
|
### Info
|
|
133
151
|
|
|
134
152
|
#### `getOnlinePlayers()`
|
|
135
153
|
Get players' name online.
|
|
136
|
-
* **return**: Dict: `[{'name': 'Steve', 'id': 123}, ...]
|
|
154
|
+
* **return**: Dict: `[{'name': 'Steve', 'id': 123}, ...]`.
|
|
137
155
|
|
|
138
156
|
#### `getPlayerPos(target="")`
|
|
139
157
|
Get player's position and yaw and pitch.
|
|
@@ -245,7 +263,7 @@ Get click events.
|
|
|
245
263
|
* Double z
|
|
246
264
|
* **face**: Int click face.
|
|
247
265
|
* **entityId**: Int ID of clicking on entity.
|
|
248
|
-
* **action**: Int action type:1--left click,2--right click.(
|
|
266
|
+
* **action**: Int action type:1--left click,2--right click,101-105--Keyboard pressed.(Bind keys at Minecraft settings)
|
|
249
267
|
* **type**: String action:"LEFT_CLICK" or "RIGHT_CLICK"
|
|
250
268
|
|
|
251
269
|
#### `pollChatPosts()`
|
|
@@ -274,7 +292,7 @@ Represents a 3D vector/coordinate.
|
|
|
274
292
|
* **length()**: Returns vector length.
|
|
275
293
|
|
|
276
294
|
#### `PlayerPos`
|
|
277
|
-
**Inherits Vec3
|
|
295
|
+
**Inherits Vec3** Represents player position with rotation.
|
|
278
296
|
* **properties**: `x`,`y`,`z`,`yaw`,`pitch`.
|
|
279
297
|
* **Methods**:
|
|
280
298
|
* **forward(distance=1.0)**: Returns a new `Vec3` position at `distance` blocks ahead of the player's view.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
mc/__init__.py,sha256=6TuAOkHXMgtW0yNeyMAcVxiqRR8BTMekzrkDnNqQ93k,172
|
|
2
|
+
mc/minecraft.py,sha256=YVGKatw6nfTYfK9anqPj385XjIVE9M1I1hvwThVZK3E,12573
|
|
3
|
+
mcapibridge-0.1.3.dist-info/licenses/LICENSE,sha256=tg_NYNbCG6JoE2a-Y6UDqKyr7eRAVOwSsSY8IzO9Cqw,1092
|
|
4
|
+
mcapibridge-0.1.3.dist-info/METADATA,sha256=3TWaffHF1zSTrup1cIMAazUyN4mhHIGQeNYkyhOQWow,9686
|
|
5
|
+
mcapibridge-0.1.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
6
|
+
mcapibridge-0.1.3.dist-info/top_level.txt,sha256=mNvdbMTKH8yVJh_OZ544RPTdOb3iE8wpsosgMq2V_cM,3
|
|
7
|
+
mcapibridge-0.1.3.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
mc/__init__.py,sha256=6TuAOkHXMgtW0yNeyMAcVxiqRR8BTMekzrkDnNqQ93k,172
|
|
2
|
-
mc/minecraft.py,sha256=04hoiMjnYTjRCr9511fjiV4RoX0nuTHV05Gh3-OzlXE,12008
|
|
3
|
-
mcapibridge-0.1.1.dist-info/licenses/LICENSE,sha256=tg_NYNbCG6JoE2a-Y6UDqKyr7eRAVOwSsSY8IzO9Cqw,1092
|
|
4
|
-
mcapibridge-0.1.1.dist-info/METADATA,sha256=m4uSCW0K8gZRAhavBYNSUcABMawAzCaNNk8zZEkuWfc,8906
|
|
5
|
-
mcapibridge-0.1.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
6
|
-
mcapibridge-0.1.1.dist-info/top_level.txt,sha256=mNvdbMTKH8yVJh_OZ544RPTdOb3iE8wpsosgMq2V_cM,3
|
|
7
|
-
mcapibridge-0.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|