pumpkin-api-py 0.1.0.dev0__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 (75) hide show
  1. pumpkin_api/__init__.py +139 -0
  2. pumpkin_api/app.py +8 -0
  3. pumpkin_api/build.py +35 -0
  4. pumpkin_api/wit/componentize_py_async_support/__init__.py +529 -0
  5. pumpkin_api/wit/componentize_py_async_support/futures.py +93 -0
  6. pumpkin_api/wit/componentize_py_async_support/streams.py +189 -0
  7. pumpkin_api/wit/componentize_py_runtime.pyi +34 -0
  8. pumpkin_api/wit/componentize_py_types.py +19 -0
  9. pumpkin_api/wit/poll_loop.py +440 -0
  10. pumpkin_api/wit/wit_world/__init__.py +70 -0
  11. pumpkin_api/wit/wit_world/exports/__init__.py +19 -0
  12. pumpkin_api/wit/wit_world/exports/metadata.py +22 -0
  13. pumpkin_api/wit/wit_world/imports/__init__.py +0 -0
  14. pumpkin_api/wit/wit_world/imports/command.py +539 -0
  15. pumpkin_api/wit/wit_world/imports/common.py +213 -0
  16. pumpkin_api/wit/wit_world/imports/context.py +70 -0
  17. pumpkin_api/wit/wit_world/imports/entity.py +84 -0
  18. pumpkin_api/wit/wit_world/imports/event.py +434 -0
  19. pumpkin_api/wit/wit_world/imports/gui.py +61 -0
  20. pumpkin_api/wit/wit_world/imports/i18n.py +35 -0
  21. pumpkin_api/wit/wit_world/imports/logging.py +30 -0
  22. pumpkin_api/wit/wit_world/imports/permission.py +71 -0
  23. pumpkin_api/wit/wit_world/imports/player.py +350 -0
  24. pumpkin_api/wit/wit_world/imports/scheduler.py +44 -0
  25. pumpkin_api/wit/wit_world/imports/scoreboard.py +95 -0
  26. pumpkin_api/wit/wit_world/imports/server.py +75 -0
  27. pumpkin_api/wit/wit_world/imports/text.py +89 -0
  28. pumpkin_api/wit/wit_world/imports/world.py +215 -0
  29. pumpkin_api/wit_files/command.wit +189 -0
  30. pumpkin_api/wit_files/common.wit +201 -0
  31. pumpkin_api/wit_files/componentize_py_async_support/__init__.py +529 -0
  32. pumpkin_api/wit_files/componentize_py_async_support/futures.py +93 -0
  33. pumpkin_api/wit_files/componentize_py_async_support/streams.py +189 -0
  34. pumpkin_api/wit_files/componentize_py_runtime.pyi +34 -0
  35. pumpkin_api/wit_files/componentize_py_types.py +19 -0
  36. pumpkin_api/wit_files/context.wit +33 -0
  37. pumpkin_api/wit_files/entity.wit +36 -0
  38. pumpkin_api/wit_files/event.wit +311 -0
  39. pumpkin_api/wit_files/gui.wit +38 -0
  40. pumpkin_api/wit_files/i18n.wit +21 -0
  41. pumpkin_api/wit_files/log.wit +14 -0
  42. pumpkin_api/wit_files/metadata.wit +15 -0
  43. pumpkin_api/wit_files/permission.wit +46 -0
  44. pumpkin_api/wit_files/player.wit +172 -0
  45. pumpkin_api/wit_files/plugin.wit +61 -0
  46. pumpkin_api/wit_files/poll_loop.py +440 -0
  47. pumpkin_api/wit_files/scheduler.wit +24 -0
  48. pumpkin_api/wit_files/scoreboard.wit +72 -0
  49. pumpkin_api/wit_files/server.wit +41 -0
  50. pumpkin_api/wit_files/text.wit +41 -0
  51. pumpkin_api/wit_files/wit_world/__init__.py +70 -0
  52. pumpkin_api/wit_files/wit_world/exports/__init__.py +19 -0
  53. pumpkin_api/wit_files/wit_world/exports/metadata.py +22 -0
  54. pumpkin_api/wit_files/wit_world/imports/__init__.py +0 -0
  55. pumpkin_api/wit_files/wit_world/imports/command.py +539 -0
  56. pumpkin_api/wit_files/wit_world/imports/common.py +213 -0
  57. pumpkin_api/wit_files/wit_world/imports/context.py +70 -0
  58. pumpkin_api/wit_files/wit_world/imports/entity.py +84 -0
  59. pumpkin_api/wit_files/wit_world/imports/event.py +434 -0
  60. pumpkin_api/wit_files/wit_world/imports/gui.py +61 -0
  61. pumpkin_api/wit_files/wit_world/imports/i18n.py +35 -0
  62. pumpkin_api/wit_files/wit_world/imports/logging.py +30 -0
  63. pumpkin_api/wit_files/wit_world/imports/permission.py +71 -0
  64. pumpkin_api/wit_files/wit_world/imports/player.py +350 -0
  65. pumpkin_api/wit_files/wit_world/imports/scheduler.py +44 -0
  66. pumpkin_api/wit_files/wit_world/imports/scoreboard.py +95 -0
  67. pumpkin_api/wit_files/wit_world/imports/server.py +75 -0
  68. pumpkin_api/wit_files/wit_world/imports/text.py +89 -0
  69. pumpkin_api/wit_files/wit_world/imports/world.py +215 -0
  70. pumpkin_api/wit_files/world.wit +169 -0
  71. pumpkin_api_py-0.1.0.dev0.dist-info/METADATA +58 -0
  72. pumpkin_api_py-0.1.0.dev0.dist-info/RECORD +75 -0
  73. pumpkin_api_py-0.1.0.dev0.dist-info/WHEEL +4 -0
  74. pumpkin_api_py-0.1.0.dev0.dist-info/entry_points.txt +2 -0
  75. pumpkin_api_py-0.1.0.dev0.dist-info/licenses/LICENSE +677 -0
@@ -0,0 +1,215 @@
1
+ # This file is automatically generated by componentize-py
2
+ # It is not intended for manual editing.
3
+ from typing import TypeVar, Generic, Union, Optional, Protocol, Tuple, List, Any, Self, Callable
4
+ from types import TracebackType
5
+ from enum import Flag, Enum, auto
6
+ from dataclasses import dataclass
7
+ from abc import abstractmethod
8
+ import weakref
9
+
10
+ from componentize_py_types import Result, Ok, Err, Some
11
+ from ..imports import text
12
+ from ..imports import scoreboard
13
+
14
+ class PistonBehavior(Enum):
15
+ """
16
+ Defines how a block reacts when pushed by a piston.
17
+ """
18
+ NORMAL = 0
19
+ DESTROY = 1
20
+ BLOCK = 2
21
+ IGNORE = 3
22
+ PUSH_ONLY = 4
23
+
24
+ class SoundCategory(Enum):
25
+ """
26
+ Categories for sounds to control their volume independently.
27
+ """
28
+ MASTER = 0
29
+ MUSIC = 1
30
+ RECORDS = 2
31
+ WEATHER = 3
32
+ BLOCKS = 4
33
+ HOSTILE = 5
34
+ NEUTRAL = 6
35
+ PLAYERS = 7
36
+ AMBIENT = 8
37
+ VOICE = 9
38
+
39
+ class ExplosionInteraction(Enum):
40
+ """
41
+ Defines how an explosion interacts with blocks in the world.
42
+ """
43
+ NONE = 0
44
+ BLOCK = 1
45
+ MOB = 2
46
+ TNT = 3
47
+ TRIGGER = 4
48
+
49
+ class BlockFlags(Flag):
50
+ """
51
+ Flags used to control block updates and notifications.
52
+ """
53
+ NOTIFY_NEIGHBORS = auto()
54
+ NOTIFY_LISTENERS = auto()
55
+ FORCE_STATE = auto()
56
+ SKIP_DROPS = auto()
57
+ MOVED = auto()
58
+ SKIP_REDSTONE_WIRE_STATE_REPLACEMENT = auto()
59
+ SKIP_BLOCK_ENTITY_REPLACED_CALLBACK = auto()
60
+ SKIP_BLOCK_ADDED_CALLBACK = auto()
61
+
62
+ @dataclass
63
+ class BlockState:
64
+ """
65
+ Detailed information about a block's state.
66
+ """
67
+ id: int
68
+ luminance: int
69
+ opacity: int
70
+ hardness: float
71
+ is_air: bool
72
+ is_liquid: bool
73
+ is_solid: bool
74
+ is_full_cube: bool
75
+ piston_behavior: PistonBehavior
76
+ has_random_ticks: bool
77
+
78
+ @dataclass
79
+ class BlockStateId:
80
+ """
81
+ A simple wrapper for a block state ID.
82
+ """
83
+ id: int
84
+
85
+ @dataclass
86
+ class BlockPos:
87
+ """
88
+ A position in the world grid.
89
+ """
90
+ x: int
91
+ y: int
92
+ z: int
93
+
94
+ class World:
95
+ """
96
+ Represents a Minecraft world (dimension).
97
+ """
98
+
99
+ def get_id(self) -> str:
100
+ """
101
+ Returns the unique identifier of this world.
102
+ """
103
+ raise NotImplementedError
104
+ def get_block_state_id(self, pos: BlockPos) -> int:
105
+ """
106
+ Gets the block state ID at the specified position.
107
+ """
108
+ raise NotImplementedError
109
+ def get_block_state(self, pos: BlockPos) -> BlockState:
110
+ """
111
+ Gets detailed block state information at the specified position.
112
+ """
113
+ raise NotImplementedError
114
+ def set_block_state(self, pos: BlockPos, state: int, update_flags: BlockFlags) -> None:
115
+ """
116
+ Sets the block state at the specified position.
117
+ """
118
+ raise NotImplementedError
119
+ def get_time_of_day(self) -> int:
120
+ """
121
+ Returns the current time of day in ticks.
122
+ """
123
+ raise NotImplementedError
124
+ def set_time_of_day(self, time: int) -> None:
125
+ """
126
+ Sets the current time of day in ticks.
127
+ """
128
+ raise NotImplementedError
129
+ def get_world_age(self) -> int:
130
+ """
131
+ Returns the total age of the world in ticks.
132
+ """
133
+ raise NotImplementedError
134
+ def get_dimension(self) -> str:
135
+ """
136
+ Returns the dimension type (e.g., "minecraft:overworld").
137
+ """
138
+ raise NotImplementedError
139
+ def get_top_block_y(self, x: int, z: int) -> int:
140
+ """
141
+ Gets the highest non-air block Y coordinate at the specified X and Z.
142
+ """
143
+ raise NotImplementedError
144
+ def get_motion_blocking_height(self, x: int, z: int) -> int:
145
+ """
146
+ Gets the highest motion-blocking block Y coordinate.
147
+ """
148
+ raise NotImplementedError
149
+ def is_raining(self) -> bool:
150
+ """
151
+ Returns whether it is currently raining or snowing.
152
+ """
153
+ raise NotImplementedError
154
+ def set_raining(self, raining: bool) -> None:
155
+ """
156
+ Sets whether it should be raining or snowing.
157
+ """
158
+ raise NotImplementedError
159
+ def is_thundering(self) -> bool:
160
+ """
161
+ Returns whether there is currently a thunderstorm.
162
+ """
163
+ raise NotImplementedError
164
+ def set_thundering(self, thundering: bool) -> None:
165
+ """
166
+ Sets whether there should be a thunderstorm.
167
+ """
168
+ raise NotImplementedError
169
+ def broadcast_system_message(self, message: text.TextComponent, overlay: bool) -> None:
170
+ """
171
+ Broadcasts a system message to all players in this world.
172
+ """
173
+ raise NotImplementedError
174
+ def get_scoreboard(self) -> scoreboard.Scoreboard:
175
+ """
176
+ Returns the scoreboard associated with this world.
177
+ """
178
+ raise NotImplementedError
179
+ def play_sound(self, sound: str, category: SoundCategory, pos: Tuple[float, float, float], volume: float, pitch: float) -> None:
180
+ """
181
+ Plays a sound at the specified position for all players in the world.
182
+ """
183
+ raise NotImplementedError
184
+ def spawn_particle(self, particle: str, pos: Tuple[float, float, float], offset: Tuple[float, float, float], max_speed: float, count: int) -> None:
185
+ """
186
+ Spawns particles at the specified position.
187
+ """
188
+ raise NotImplementedError
189
+ def create_explosion(self, pos: Tuple[float, float, float], power: float, create_fire: bool, interaction: ExplosionInteraction) -> None:
190
+ """
191
+ Creates an explosion at the specified position.
192
+ """
193
+ raise NotImplementedError
194
+ def get_sea_level(self) -> int:
195
+ """
196
+ Returns the sea level of this world.
197
+ """
198
+ raise NotImplementedError
199
+ def get_min_y(self) -> int:
200
+ """
201
+ Returns the minimum Y coordinate (bottom of the world).
202
+ """
203
+ raise NotImplementedError
204
+ def __enter__(self) -> Self:
205
+ """Returns self"""
206
+ return self
207
+
208
+ def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
209
+ """
210
+ Release this resource.
211
+ """
212
+ raise NotImplementedError
213
+
214
+
215
+
@@ -0,0 +1,189 @@
1
+ interface command {
2
+ use player.{player};
3
+ use %world.{%world};
4
+ use entity.{command-block-entity, entity};
5
+ use common.{position, block-position, locale};
6
+ use server.{server, difficulty};
7
+ use text.{text-component};
8
+
9
+ enum gamemode {
10
+ survival,
11
+ creative,
12
+ adventure,
13
+ spectator,
14
+ }
15
+
16
+ enum bossbar-color {
17
+ pink,
18
+ blue,
19
+ red,
20
+ green,
21
+ yellow,
22
+ purple,
23
+ white,
24
+ }
25
+
26
+ enum bossbar-style {
27
+ no-division,
28
+ notches6,
29
+ notches10,
30
+ notches12,
31
+ notches20,
32
+ }
33
+
34
+ enum sound-category {
35
+ master,
36
+ music,
37
+ records,
38
+ weather,
39
+ blocks,
40
+ hostile,
41
+ neutral,
42
+ players,
43
+ ambient,
44
+ voice,
45
+ ui,
46
+ }
47
+
48
+ enum entity-anchor {
49
+ feet,
50
+ eyes,
51
+ }
52
+
53
+ variant number {
54
+ float64(f64),
55
+ float32(f32),
56
+ int32(s32),
57
+ int64(s64),
58
+ }
59
+
60
+ variant not-in-bounds {
61
+ lower-bound(tuple<number, number>),
62
+ upper-bound(tuple<number, number>),
63
+ }
64
+
65
+ variant arg {
66
+ entities(list<entity>),
67
+ entity(entity),
68
+ players(list<player>),
69
+ block-pos(block-position),
70
+ pos3d(position),
71
+ pos2d(tuple<f64, f64>),
72
+ rotation(tuple<f32, bool, f32, bool>),
73
+ game-mode(gamemode),
74
+ difficulty(difficulty),
75
+ item(string),
76
+ item-predicate(string),
77
+ resource-location(string),
78
+ block(string),
79
+ block-predicate(string),
80
+ bossbar-color(bossbar-color),
81
+ bossbar-style(bossbar-style),
82
+ particle(string),
83
+ msg(string),
84
+ text-component(text-component),
85
+ time(s32),
86
+ num(result<number, not-in-bounds>),
87
+ %bool(bool),
88
+ simple(string),
89
+ sound-category(sound-category),
90
+ damage-type(string),
91
+ effect(string),
92
+ enchantment(string),
93
+ entity-anchor(entity-anchor),
94
+ }
95
+
96
+ resource consumed-args {
97
+ get-value: func(key: string) -> arg;
98
+ }
99
+
100
+ variant command-sender-type {
101
+ rcon,
102
+ console,
103
+ player(player),
104
+ command-block(tuple<command-block-entity, %world>),
105
+ dummy,
106
+ }
107
+
108
+ enum permission-level {
109
+ zero,
110
+ one,
111
+ two,
112
+ three,
113
+ four,
114
+ }
115
+
116
+ resource command-sender {
117
+ get-command-sender-type: func() -> command-sender-type;
118
+ send-message: func(text: text-component);
119
+ set-success-count: func(count: s32);
120
+ is-player: func() -> bool;
121
+ is-console: func() -> bool;
122
+ as-player: func() -> option<player>;
123
+ permission-level: func() -> permission-level;
124
+ has-permission-level: func(level: permission-level) -> bool;
125
+ has-permission: func(server: borrow<server>, node: string) -> bool;
126
+ position: func() -> option<position>;
127
+ %world: func() -> option<%world>;
128
+ get-locale: func() -> locale;
129
+ should-receive-feedback: func() -> bool;
130
+ should-broadcast-console-to-ops: func() -> bool;
131
+ should-track-output: func() -> bool;
132
+ }
133
+
134
+ enum string-type {
135
+ single-word,
136
+ quotable,
137
+ greedy,
138
+ }
139
+
140
+ variant argument-type {
141
+ %bool,
142
+ float(tuple<option<f32>, option<f32>>),
143
+ double(tuple<option<f64>, option<f64>>),
144
+ integer(tuple<option<s32>, option<s32>>),
145
+ long(tuple<option<s64>, option<s64>>),
146
+ %string(string-type),
147
+ entities,
148
+ entity,
149
+ %players,
150
+ game-profile,
151
+ block-pos,
152
+ position3d,
153
+ position2d,
154
+ block-state,
155
+ block-predicate,
156
+ item,
157
+ item-predicate,
158
+ component,
159
+ rotation,
160
+ %resource-location,
161
+ entity-anchor,
162
+ gamemode,
163
+ difficulty,
164
+ time(s32),
165
+ %resource(string),
166
+ }
167
+
168
+ variant command-error {
169
+ invalid-consumption(option<string>),
170
+ invalid-requirement,
171
+ permission-denied,
172
+ command-failed(text-component),
173
+ }
174
+
175
+ resource command-node {
176
+ literal: static func(name: string) -> command-node;
177
+ argument: static func(name: string, arg-type: argument-type) -> command-node;
178
+ then: func(node: command-node);
179
+ execute-with-handler-id: func(handler-id: u32);
180
+ require-with-handler-id: func(handler-id: u32);
181
+ }
182
+
183
+ resource command {
184
+ /// First name is primary, rest are aliases
185
+ constructor(names: list<string>, description: string);
186
+ then: func(node: command-node);
187
+ execute-with-handler-id: func(handler-id: u32);
188
+ }
189
+ }
@@ -0,0 +1,201 @@
1
+ /// Provides common types and utilities used across the entire plugin API.
2
+ interface common {
3
+ /// Serialized text component as a postcard byte array.
4
+ /// @deprecated Use the text-component resource from the text interface instead.
5
+ type raw-text-component = list<u8>;
6
+
7
+ /// A position in the world grid (integers).
8
+ type block-position = tuple<s32, s32, s32>;
9
+
10
+ /// A precise coordinate in the world (floats).
11
+ type position = tuple<f64, f64, f64>;
12
+
13
+ /// Represents the hands of a player.
14
+ enum hand {
15
+ left,
16
+ right,
17
+ }
18
+
19
+ /// Represents the game modes available in Minecraft.
20
+ enum game-mode {
21
+ survival,
22
+ creative,
23
+ adventure,
24
+ spectator,
25
+ }
26
+
27
+ /// The 16 base Minecraft colors.
28
+ enum named-color {
29
+ black,
30
+ dark-blue,
31
+ dark-green,
32
+ dark-aqua,
33
+ dark-red,
34
+ dark-purple,
35
+ gold,
36
+ gray,
37
+ dark-gray,
38
+ blue,
39
+ green,
40
+ aqua,
41
+ red,
42
+ light-purple,
43
+ yellow,
44
+ white,
45
+ }
46
+
47
+ /// An RGB color represented by its red, green, and blue components.
48
+ record rgb-color {
49
+ r: u8,
50
+ g: u8,
51
+ b: u8,
52
+ }
53
+
54
+ /// An ARGB color with alpha (transparency) channel.
55
+ record argb-color {
56
+ a: u8,
57
+ r: u8,
58
+ g: u8,
59
+ b: u8,
60
+ }
61
+
62
+ /// Represents a stack of items with its type and count.
63
+ record item-stack {
64
+ /// The unique registry key (e.g., "minecraft:diamond").
65
+ registry-key: string,
66
+ /// The number of items in the stack.
67
+ count: u8,
68
+ }
69
+
70
+ /// All Minecraft-supported locales.
71
+ enum locale {
72
+ af-za,
73
+ ar-sa,
74
+ ast-es,
75
+ az-az,
76
+ ba-ru,
77
+ bar,
78
+ be-by,
79
+ bg-bg,
80
+ br-fr,
81
+ brb,
82
+ bs-ba,
83
+ ca-es,
84
+ cs-cz,
85
+ cy-gb,
86
+ da-dk,
87
+ de-at,
88
+ de-ch,
89
+ de-de,
90
+ el-gr,
91
+ en-au,
92
+ en-ca,
93
+ en-gb,
94
+ en-nz,
95
+ en-pt,
96
+ en-ud,
97
+ en-us,
98
+ enp,
99
+ enws,
100
+ eo-uy,
101
+ es-ar,
102
+ es-cl,
103
+ es-ec,
104
+ es-es,
105
+ es-mx,
106
+ es-uy,
107
+ es-ve,
108
+ esan,
109
+ et-ee,
110
+ eu-es,
111
+ fa-ir,
112
+ fi-fi,
113
+ fil-ph,
114
+ fo-fo,
115
+ fr-ca,
116
+ fr-fr,
117
+ fra-de,
118
+ fur-it,
119
+ fy-nl,
120
+ ga-ie,
121
+ gd-gb,
122
+ gl-es,
123
+ haw-us,
124
+ he-il,
125
+ hi-in,
126
+ hr-hr,
127
+ hu-hu,
128
+ hy-am,
129
+ id-id,
130
+ ig-ng,
131
+ io-en,
132
+ is-is,
133
+ isv,
134
+ it-it,
135
+ ja-jp,
136
+ jbo-en,
137
+ ka-ge,
138
+ kk-kz,
139
+ kn-in,
140
+ ko-kr,
141
+ ksh,
142
+ kw-gb,
143
+ la-la,
144
+ lb-lu,
145
+ li-li,
146
+ lmo,
147
+ lo-la,
148
+ lol-us,
149
+ lt-lt,
150
+ lv-lv,
151
+ lzh,
152
+ mk-mk,
153
+ mn-mn,
154
+ ms-my,
155
+ mt-mt,
156
+ nah,
157
+ nds-de,
158
+ nl-be,
159
+ nl-nl,
160
+ nn-no,
161
+ no-no,
162
+ oc-fr,
163
+ ovd,
164
+ pl-pl,
165
+ pt-br,
166
+ pt-pt,
167
+ qya-aa,
168
+ ro-ro,
169
+ rpr,
170
+ ru-ru,
171
+ ry-ua,
172
+ sah-sah,
173
+ se-no,
174
+ sk-sk,
175
+ sl-si,
176
+ so-so,
177
+ sq-al,
178
+ sr-cs,
179
+ sr-sp,
180
+ sv-se,
181
+ sxu,
182
+ szl,
183
+ ta-in,
184
+ th-th,
185
+ tl-ph,
186
+ tlh-aa,
187
+ tok,
188
+ tr-tr,
189
+ tt-ru,
190
+ uk-ua,
191
+ val-es,
192
+ vec-it,
193
+ vi-vn,
194
+ yi-de,
195
+ yo-ng,
196
+ zh-cn,
197
+ zh-hk,
198
+ zh-tw,
199
+ zlm-arab,
200
+ }
201
+ }