mineflex 0.1.0__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.
- mineflex/__init__.py +48 -0
- mineflex/actions/__init__.py +10 -0
- mineflex/actions/action.py +51 -0
- mineflex/auth/__init__.py +3 -0
- mineflex/bot.py +1011 -0
- mineflex/chat/__init__.py +3 -0
- mineflex/chat/message.py +105 -0
- mineflex/client/__init__.py +16 -0
- mineflex/client/connection.py +228 -0
- mineflex/client/keepalive.py +72 -0
- mineflex/client/packet_handler.py +613 -0
- mineflex/client/protocol.py +374 -0
- mineflex/constants.py +37 -0
- mineflex/crafting/__init__.py +13 -0
- mineflex/crafting/manager.py +133 -0
- mineflex/crafting/recipe.py +127 -0
- mineflex/data/__init__.py +3 -0
- mineflex/entity/__init__.py +3 -0
- mineflex/entity/entity.py +76 -0
- mineflex/entity/player.py +36 -0
- mineflex/entity/tracker.py +199 -0
- mineflex/errors.py +77 -0
- mineflex/events/__init__.py +3 -0
- mineflex/inventory/__init__.py +16 -0
- mineflex/inventory/inventory.py +167 -0
- mineflex/inventory/item.py +98 -0
- mineflex/inventory/slot.py +53 -0
- mineflex/inventory/window.py +150 -0
- mineflex/logging.py +43 -0
- mineflex/physics/__init__.py +19 -0
- mineflex/physics/aabb.py +165 -0
- mineflex/physics/bounding_box.py +127 -0
- mineflex/physics/collision.py +156 -0
- mineflex/physics/engine.py +184 -0
- mineflex/physics/movement.py +163 -0
- mineflex/physics/vec3.py +119 -0
- mineflex/plugins/__init__.py +10 -0
- mineflex/plugins/manager.py +190 -0
- mineflex/protocol/__init__.py +20 -0
- mineflex/protocol/codecs/__init__.py +57 -0
- mineflex/protocol/codecs/nbt.py +608 -0
- mineflex/protocol/codecs/position.py +63 -0
- mineflex/protocol/codecs/slot.py +65 -0
- mineflex/protocol/codecs/string.py +48 -0
- mineflex/protocol/codecs/varint.py +70 -0
- mineflex/protocol/codecs/varlong.py +70 -0
- mineflex/protocol/deserializer.py +7 -0
- mineflex/protocol/packet.py +68 -0
- mineflex/protocol/packets/__init__.py +3 -0
- mineflex/protocol/packets/configuration.py +385 -0
- mineflex/protocol/packets/handshake.py +42 -0
- mineflex/protocol/packets/login.py +305 -0
- mineflex/protocol/packets/play.py +1629 -0
- mineflex/protocol/packets/status.py +88 -0
- mineflex/protocol/serializer.py +253 -0
- mineflex/types.py +15 -0
- mineflex/world/__init__.py +3 -0
- mineflex/world/biome.py +58 -0
- mineflex/world/block.py +71 -0
- mineflex/world/chunk.py +350 -0
- mineflex/world/heightmap.py +90 -0
- mineflex/world/palette.py +69 -0
- mineflex/world/world.py +289 -0
- mineflex-0.1.0.dist-info/METADATA +147 -0
- mineflex-0.1.0.dist-info/RECORD +68 -0
- mineflex-0.1.0.dist-info/WHEEL +5 -0
- mineflex-0.1.0.dist-info/licenses/LICENSE +21 -0
- mineflex-0.1.0.dist-info/top_level.txt +1 -0
mineflex/__init__.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Mineflex - A native Python Minecraft bot framework.
|
|
3
|
+
|
|
4
|
+
This package provides a Pythonic API for creating Minecraft bots
|
|
5
|
+
with asyncio support, inspired by Mineflayer.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
__version__ = "0.1.0"
|
|
11
|
+
|
|
12
|
+
# Public API
|
|
13
|
+
from mineflex.bot import Bot, create_bot
|
|
14
|
+
from mineflex.errors import (
|
|
15
|
+
MineflexError,
|
|
16
|
+
ConnectionError,
|
|
17
|
+
AuthenticationError,
|
|
18
|
+
ProtocolError,
|
|
19
|
+
PacketError,
|
|
20
|
+
UnsupportedVersionError,
|
|
21
|
+
TimeoutError,
|
|
22
|
+
InvalidStateError,
|
|
23
|
+
InteractionError,
|
|
24
|
+
DiggingError,
|
|
25
|
+
InventoryError,
|
|
26
|
+
CraftingError,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
__all__ = [
|
|
30
|
+
# Version
|
|
31
|
+
"__version__",
|
|
32
|
+
# Main API
|
|
33
|
+
"Bot",
|
|
34
|
+
"create_bot",
|
|
35
|
+
# Exceptions
|
|
36
|
+
"MineflexError",
|
|
37
|
+
"ConnectionError",
|
|
38
|
+
"AuthenticationError",
|
|
39
|
+
"ProtocolError",
|
|
40
|
+
"PacketError",
|
|
41
|
+
"UnsupportedVersionError",
|
|
42
|
+
"TimeoutError",
|
|
43
|
+
"InvalidStateError",
|
|
44
|
+
"InteractionError",
|
|
45
|
+
"DiggingError",
|
|
46
|
+
"InventoryError",
|
|
47
|
+
"CraftingError",
|
|
48
|
+
]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""Interaction actions (digging, building, item use)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from enum import Enum
|
|
7
|
+
from typing import Optional
|
|
8
|
+
|
|
9
|
+
from mineflex.physics.vec3 import Vec3
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ActionType(Enum):
|
|
13
|
+
"""Types of actions."""
|
|
14
|
+
|
|
15
|
+
DIG = "dig"
|
|
16
|
+
BUILD = "build"
|
|
17
|
+
USE_ITEM = "use_item"
|
|
18
|
+
ATTACK = "attack"
|
|
19
|
+
INTERACT = "interact"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass
|
|
23
|
+
class Action:
|
|
24
|
+
"""
|
|
25
|
+
Represents an action to perform on a block or entity.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
action_type: ActionType
|
|
29
|
+
position: Vec3
|
|
30
|
+
face: Optional[int] = None # Block face (0-5) for building
|
|
31
|
+
block_id: Optional[int] = None # Block ID for building
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def dig(cls, position: Vec3) -> "Action":
|
|
35
|
+
"""Create a dig action."""
|
|
36
|
+
return cls(ActionType.DIG, position)
|
|
37
|
+
|
|
38
|
+
@classmethod
|
|
39
|
+
def build(cls, position: Vec3, block_id: int, face: int) -> "Action":
|
|
40
|
+
"""Create a build action."""
|
|
41
|
+
return cls(ActionType.BUILD, position, face, block_id)
|
|
42
|
+
|
|
43
|
+
@classmethod
|
|
44
|
+
def use_item(cls, position: Vec3) -> "Action":
|
|
45
|
+
"""Create a use item action."""
|
|
46
|
+
return cls(ActionType.USE_ITEM, position)
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def attack(cls, position: Vec3) -> "Action":
|
|
50
|
+
"""Create an attack action."""
|
|
51
|
+
return cls(ActionType.ATTACK, position)
|