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.
Files changed (68) hide show
  1. mineflex/__init__.py +48 -0
  2. mineflex/actions/__init__.py +10 -0
  3. mineflex/actions/action.py +51 -0
  4. mineflex/auth/__init__.py +3 -0
  5. mineflex/bot.py +1011 -0
  6. mineflex/chat/__init__.py +3 -0
  7. mineflex/chat/message.py +105 -0
  8. mineflex/client/__init__.py +16 -0
  9. mineflex/client/connection.py +228 -0
  10. mineflex/client/keepalive.py +72 -0
  11. mineflex/client/packet_handler.py +613 -0
  12. mineflex/client/protocol.py +374 -0
  13. mineflex/constants.py +37 -0
  14. mineflex/crafting/__init__.py +13 -0
  15. mineflex/crafting/manager.py +133 -0
  16. mineflex/crafting/recipe.py +127 -0
  17. mineflex/data/__init__.py +3 -0
  18. mineflex/entity/__init__.py +3 -0
  19. mineflex/entity/entity.py +76 -0
  20. mineflex/entity/player.py +36 -0
  21. mineflex/entity/tracker.py +199 -0
  22. mineflex/errors.py +77 -0
  23. mineflex/events/__init__.py +3 -0
  24. mineflex/inventory/__init__.py +16 -0
  25. mineflex/inventory/inventory.py +167 -0
  26. mineflex/inventory/item.py +98 -0
  27. mineflex/inventory/slot.py +53 -0
  28. mineflex/inventory/window.py +150 -0
  29. mineflex/logging.py +43 -0
  30. mineflex/physics/__init__.py +19 -0
  31. mineflex/physics/aabb.py +165 -0
  32. mineflex/physics/bounding_box.py +127 -0
  33. mineflex/physics/collision.py +156 -0
  34. mineflex/physics/engine.py +184 -0
  35. mineflex/physics/movement.py +163 -0
  36. mineflex/physics/vec3.py +119 -0
  37. mineflex/plugins/__init__.py +10 -0
  38. mineflex/plugins/manager.py +190 -0
  39. mineflex/protocol/__init__.py +20 -0
  40. mineflex/protocol/codecs/__init__.py +57 -0
  41. mineflex/protocol/codecs/nbt.py +608 -0
  42. mineflex/protocol/codecs/position.py +63 -0
  43. mineflex/protocol/codecs/slot.py +65 -0
  44. mineflex/protocol/codecs/string.py +48 -0
  45. mineflex/protocol/codecs/varint.py +70 -0
  46. mineflex/protocol/codecs/varlong.py +70 -0
  47. mineflex/protocol/deserializer.py +7 -0
  48. mineflex/protocol/packet.py +68 -0
  49. mineflex/protocol/packets/__init__.py +3 -0
  50. mineflex/protocol/packets/configuration.py +385 -0
  51. mineflex/protocol/packets/handshake.py +42 -0
  52. mineflex/protocol/packets/login.py +305 -0
  53. mineflex/protocol/packets/play.py +1629 -0
  54. mineflex/protocol/packets/status.py +88 -0
  55. mineflex/protocol/serializer.py +253 -0
  56. mineflex/types.py +15 -0
  57. mineflex/world/__init__.py +3 -0
  58. mineflex/world/biome.py +58 -0
  59. mineflex/world/block.py +71 -0
  60. mineflex/world/chunk.py +350 -0
  61. mineflex/world/heightmap.py +90 -0
  62. mineflex/world/palette.py +69 -0
  63. mineflex/world/world.py +289 -0
  64. mineflex-0.1.0.dist-info/METADATA +147 -0
  65. mineflex-0.1.0.dist-info/RECORD +68 -0
  66. mineflex-0.1.0.dist-info/WHEEL +5 -0
  67. mineflex-0.1.0.dist-info/licenses/LICENSE +21 -0
  68. 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,10 @@
1
+ """Actions subsystem - digging, building, combat."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from mineflex.actions.action import Action, ActionType
6
+
7
+ __all__ = [
8
+ "Action",
9
+ "ActionType",
10
+ ]
@@ -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)
@@ -0,0 +1,3 @@
1
+ """Authentication subsystem - offline and Microsoft auth."""
2
+
3
+ from __future__ import annotations