dfpyre 0.4.5__tar.gz → 0.5.0__tar.gz
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.
Potentially problematic release.
This version of dfpyre might be problematic. Click here for more details.
- {dfpyre-0.4.5 → dfpyre-0.5.0}/LICENSE +21 -21
- {dfpyre-0.4.5 → dfpyre-0.5.0}/PKG-INFO +105 -81
- {dfpyre-0.4.5 → dfpyre-0.5.0}/README.md +454 -432
- dfpyre-0.5.0/dfpyre/data/data.json +1 -0
- dfpyre-0.5.0/dfpyre/items.py +279 -0
- dfpyre-0.5.0/dfpyre/pyre.py +405 -0
- dfpyre-0.5.0/dfpyre/style.py +22 -0
- {dfpyre-0.4.5 → dfpyre-0.5.0}/pyproject.toml +20 -20
- dfpyre-0.4.5/dfpyre/data/data.json +0 -1
- dfpyre-0.4.5/dfpyre/items.py +0 -361
- dfpyre-0.4.5/dfpyre/pyre.py +0 -433
- dfpyre-0.4.5/dfpyre/style.py +0 -22
- {dfpyre-0.4.5 → dfpyre-0.5.0}/dfpyre/__init__.py +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 Amp
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Amp
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dfpyre
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: A package for external creation of code templates for the DiamondFire Minecraft server.
|
|
5
5
|
Home-page: https://github.com/Amp63/pyre
|
|
6
6
|
License: MIT
|
|
7
|
-
Keywords: diamondfire,minecraft
|
|
7
|
+
Keywords: diamondfire,minecraft,template,item
|
|
8
8
|
Author: Amp
|
|
9
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.10,<4.0
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
-
Requires-Dist: mcitemlib (>=0.1.
|
|
15
|
+
Requires-Dist: mcitemlib (>=0.1.2,<0.2.0)
|
|
14
16
|
Project-URL: Repository, https://github.com/Amp63/pyre
|
|
15
17
|
Description-Content-Type: text/markdown
|
|
16
18
|
|
|
@@ -20,10 +22,17 @@ A package for external creation of code templates for the DiamondFire Minecraft
|
|
|
20
22
|
|
|
21
23
|
PyPi Link: https://pypi.org/project/dfpyre/
|
|
22
24
|
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
Run the following command in a terminal:
|
|
28
|
+
```
|
|
29
|
+
pip install dfpyre
|
|
30
|
+
```
|
|
31
|
+
|
|
23
32
|
## Features
|
|
24
33
|
- All code block types
|
|
25
34
|
- All code item types
|
|
26
|
-
- Direct sending to DF via recode
|
|
35
|
+
- Direct sending to DF via recode or codeclient
|
|
27
36
|
- Automatic type conversion (int to num, str to text)
|
|
28
37
|
- Name checking ("did you mean ___?" for close matches)
|
|
29
38
|
- Default tag values
|
|
@@ -32,7 +41,7 @@ PyPi Link: https://pypi.org/project/dfpyre/
|
|
|
32
41
|
## Basics
|
|
33
42
|
|
|
34
43
|
- [Setting up a program](#setup)
|
|
35
|
-
- [Events and Actions](#
|
|
44
|
+
- [Events and Actions](#events-and-actions)
|
|
36
45
|
- [Building](#building)
|
|
37
46
|
|
|
38
47
|
## Var Items
|
|
@@ -47,16 +56,17 @@ PyPi Link: https://pypi.org/project/dfpyre/
|
|
|
47
56
|
- [Potion](#potion)
|
|
48
57
|
- [Game Value](#game-value)
|
|
49
58
|
- [Vector](#vector)
|
|
59
|
+
- [Parameter](#parameter)
|
|
50
60
|
|
|
51
61
|
## Conditionals and Loops
|
|
52
62
|
|
|
53
|
-
- [Conditionals and Brackets](#
|
|
63
|
+
- [Conditionals and Brackets](#conditionals-and-brackets)
|
|
54
64
|
- [Loops](#loops)
|
|
55
65
|
|
|
56
66
|
## Functions and Procedures
|
|
57
67
|
|
|
58
|
-
- [Creating Functions and
|
|
59
|
-
- [Calling Functions and
|
|
68
|
+
- [Creating Functions and Processes](#creating-functions-and-processes)
|
|
69
|
+
- [Calling Functions and Processes](#calling-functions-and-processes)
|
|
60
70
|
|
|
61
71
|
## Extras
|
|
62
72
|
|
|
@@ -92,14 +102,14 @@ Here's a complete program that prints a message to every player when a player jo
|
|
|
92
102
|
```py
|
|
93
103
|
from dfpyre import *
|
|
94
104
|
t = DFTemplate()
|
|
95
|
-
t.
|
|
96
|
-
t.
|
|
97
|
-
t.
|
|
105
|
+
t.player_event('Join')
|
|
106
|
+
t.player_action('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
107
|
+
t.build_and_send('codeclient')
|
|
98
108
|
```
|
|
99
109
|
|
|
100
|
-
### Events
|
|
110
|
+
### Events and Actions
|
|
101
111
|
|
|
102
|
-
You can find a list of events and actions [here](#
|
|
112
|
+
You can find a list of events and actions [here](#method-list)
|
|
103
113
|
|
|
104
114
|
As shown in [setup](#setup), every code line must start with an event, function, or process. After that, you're free to put anything you want.
|
|
105
115
|
|
|
@@ -108,14 +118,14 @@ The following program sends a message to all players and gives a player 10 apple
|
|
|
108
118
|
```py
|
|
109
119
|
from dfpyre import *
|
|
110
120
|
t = DFTemplate()
|
|
111
|
-
t.
|
|
112
|
-
t.
|
|
113
|
-
t.
|
|
121
|
+
t.player_event('Join')
|
|
122
|
+
t.player_action('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
123
|
+
t.player_action('GiveItems', item('apple', 10))
|
|
114
124
|
```
|
|
115
125
|
|
|
116
126
|
### Building
|
|
117
127
|
|
|
118
|
-
You
|
|
128
|
+
You have 2 different options for building your code line.
|
|
119
129
|
You can either:
|
|
120
130
|
|
|
121
131
|
1. Save the compressed template code to a variable and send it to minecraft later
|
|
@@ -126,11 +136,9 @@ If you choose the first option, the code would look something like this:
|
|
|
126
136
|
```py
|
|
127
137
|
from dfpyre import *
|
|
128
138
|
t = DFTemplate()
|
|
129
|
-
t.
|
|
130
|
-
t.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
sendToDf(code, name='myJoinTemplate') # Send to minecraft client via recode item api
|
|
139
|
+
t.player_event('Join')
|
|
140
|
+
t.player_action('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
141
|
+
template_code = t.build() # do whatever you want with this
|
|
134
142
|
```
|
|
135
143
|
|
|
136
144
|
If you choose the second option, you can do this:
|
|
@@ -138,9 +146,9 @@ If you choose the second option, you can do this:
|
|
|
138
146
|
```py
|
|
139
147
|
from dfpyre import *
|
|
140
148
|
t = DFTemplate()
|
|
141
|
-
t.
|
|
142
|
-
t.
|
|
143
|
-
t.
|
|
149
|
+
t.player_event('Join')
|
|
150
|
+
t.player_action('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
151
|
+
t.build_and_send('codeclient') # builds and sends automatically to minecraft
|
|
144
152
|
```
|
|
145
153
|
|
|
146
154
|
### Variable Items
|
|
@@ -157,8 +165,8 @@ If a regular string is passed to a method as a chest parameter, it will automati
|
|
|
157
165
|
|
|
158
166
|
```py
|
|
159
167
|
# These do the same thing:
|
|
160
|
-
t.
|
|
161
|
-
t.
|
|
168
|
+
t.player_action('SendMessage', text('%default joined.'))
|
|
169
|
+
t.player_action('SendMessage', '%default joined.')
|
|
162
170
|
```
|
|
163
171
|
|
|
164
172
|
### Number
|
|
@@ -174,8 +182,8 @@ If a regular integer or float is passed to a method as a chest parameter, it wil
|
|
|
174
182
|
|
|
175
183
|
```py
|
|
176
184
|
# These do the same thing:
|
|
177
|
-
t.
|
|
178
|
-
t.
|
|
185
|
+
t.set_variable('=', var('number'), num(10))
|
|
186
|
+
t.set_variable('=', var('number'), 10)
|
|
179
187
|
```
|
|
180
188
|
|
|
181
189
|
### Variable
|
|
@@ -187,27 +195,43 @@ var('num')
|
|
|
187
195
|
var('text1')
|
|
188
196
|
```
|
|
189
197
|
|
|
190
|
-
You can set variable values by using the `
|
|
198
|
+
You can set variable values by using the `set_variable` method:
|
|
199
|
+
|
|
200
|
+
```py
|
|
201
|
+
t.set_variable('=', var('num'), 12) # sets 'num' to 12
|
|
202
|
+
t.set_variable('x', var('doubled'), var('num'), 2) # sets 'doubled' to 24
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
You can set the scope of the variable by using the `scope` argument:
|
|
191
206
|
|
|
192
207
|
```py
|
|
193
|
-
t.
|
|
194
|
-
t.
|
|
208
|
+
t.set_variable('=', var(num1, scope='unsaved'), 12) # `unsaved` is the same as a game variable.
|
|
209
|
+
t.set_variable('=', var(num1, scope='saved'), 12)
|
|
210
|
+
t.set_variable('=', var(num1, scope='local'), 12)
|
|
195
211
|
```
|
|
196
212
|
|
|
197
|
-
|
|
213
|
+
#### Shorthand Variables
|
|
198
214
|
|
|
215
|
+
You can also use the variable shorthand format like this:
|
|
199
216
|
```py
|
|
200
|
-
|
|
201
|
-
t.
|
|
202
|
-
t.
|
|
217
|
+
# These do the same thing:
|
|
218
|
+
t.set_variable('=', var('lineVar', scope='line'), 5)
|
|
219
|
+
t.set_variable('=', '$ilineVar', 5)
|
|
203
220
|
```
|
|
204
221
|
|
|
222
|
+
Shorthand vars should be formatted like this: `$[scope id][var name]`
|
|
223
|
+
|
|
224
|
+
Here's a list of the scope IDs:
|
|
225
|
+
- `g` = Game (unsaved)
|
|
226
|
+
- `s` = Saved
|
|
227
|
+
- `l` = Local
|
|
228
|
+
- `i` = Line
|
|
229
|
+
|
|
205
230
|
### Location
|
|
206
231
|
|
|
207
232
|
Represents a diamondfire location item:
|
|
208
233
|
|
|
209
234
|
```py
|
|
210
|
-
# (var= is not required if numbers are in order, but is more readable)
|
|
211
235
|
loc(x=25.5, y=50, z=25.5, pitch=0, yaw=-90)
|
|
212
236
|
```
|
|
213
237
|
|
|
@@ -217,8 +241,8 @@ Example:
|
|
|
217
241
|
# teleport player on join
|
|
218
242
|
from dfpyre import *
|
|
219
243
|
t = DFTemplate()
|
|
220
|
-
t.
|
|
221
|
-
t.
|
|
244
|
+
t.player_event('Join')
|
|
245
|
+
t.player_action('Teleport', loc(10, 50, 10))
|
|
222
246
|
```
|
|
223
247
|
|
|
224
248
|
### Item
|
|
@@ -230,7 +254,7 @@ item('stick', count=5)
|
|
|
230
254
|
item('stone', 64)
|
|
231
255
|
```
|
|
232
256
|
|
|
233
|
-
|
|
257
|
+
To add extra data to an item, you can use any methods from the [mcitemlib](https://github.com/Amp63/mcitemlib) library
|
|
234
258
|
|
|
235
259
|
### Sound
|
|
236
260
|
|
|
@@ -246,8 +270,8 @@ Example:
|
|
|
246
270
|
# plays 'Grass Place' sound on join
|
|
247
271
|
from dfpyre import *
|
|
248
272
|
t = DFTemplate()
|
|
249
|
-
t.
|
|
250
|
-
t.
|
|
273
|
+
t.player_event('Join')
|
|
274
|
+
t.player_action('PlaySound', sound('Grass Place'))
|
|
251
275
|
```
|
|
252
276
|
|
|
253
277
|
### Particle
|
|
@@ -264,8 +288,8 @@ Example:
|
|
|
264
288
|
# plays a white cloud particle effect at 5, 50, 5
|
|
265
289
|
from dfpyre import *
|
|
266
290
|
t = DFTemplate()
|
|
267
|
-
t.
|
|
268
|
-
t.
|
|
291
|
+
t.player_event('Join')
|
|
292
|
+
t.player_action('Particle', particle('Cloud'), loc(5, 50, 5))
|
|
269
293
|
```
|
|
270
294
|
|
|
271
295
|
Currently, the particle object does not support colors.
|
|
@@ -285,8 +309,8 @@ Example:
|
|
|
285
309
|
# gives the player infinite saturation 255
|
|
286
310
|
from dfpyre import *
|
|
287
311
|
t = DFTemplate()
|
|
288
|
-
t.
|
|
289
|
-
t.
|
|
312
|
+
t.player_event('Join')
|
|
313
|
+
t.player_action('GivePotion', potion('Saturation', amp=254))
|
|
290
314
|
```
|
|
291
315
|
|
|
292
316
|
### Game Value
|
|
@@ -305,7 +329,7 @@ Example:
|
|
|
305
329
|
from dfpyre import *
|
|
306
330
|
t = DFTemplate()
|
|
307
331
|
t.function('printData')
|
|
308
|
-
t.
|
|
332
|
+
t.player_action('SendMessage', gamevalue('Player Count'), gamevalue('CPU Usage'))
|
|
309
333
|
```
|
|
310
334
|
|
|
311
335
|
### Vector
|
|
@@ -322,8 +346,8 @@ Example:
|
|
|
322
346
|
# sets the player's x velocity to 1.0 on join
|
|
323
347
|
from dfpyre import *
|
|
324
348
|
t = DFTemplate()
|
|
325
|
-
t.
|
|
326
|
-
t.
|
|
349
|
+
t.player_event('Join')
|
|
350
|
+
t.player_action('SetVelocity', vector(x=1.0, y=0.0, z=0.0))
|
|
327
351
|
```
|
|
328
352
|
|
|
329
353
|
### Parameter
|
|
@@ -340,12 +364,12 @@ Example:
|
|
|
340
364
|
# builds a function that says "Hello, [name]" where `name` is the inputted parameter.
|
|
341
365
|
from dfpyre import *
|
|
342
366
|
t = DFTemplate()
|
|
343
|
-
|
|
344
|
-
t.function('SayHi',
|
|
345
|
-
t.
|
|
367
|
+
name_parameter = parameter('name', ParameterType.TEXT)
|
|
368
|
+
t.function('SayHi', name_parameter)
|
|
369
|
+
t.player_action('SendMessage', 'Hello, ', var('name', 'line'))
|
|
346
370
|
```
|
|
347
371
|
|
|
348
|
-
### Conditionals
|
|
372
|
+
### Conditionals and Brackets
|
|
349
373
|
|
|
350
374
|
A list of conditionals and loops can be found [here](#commands).
|
|
351
375
|
|
|
@@ -355,10 +379,10 @@ A specific syntax must be followed when creating conditionals and loops. Each co
|
|
|
355
379
|
# prints 'clicked' when a player right clicks with a stick in their hand
|
|
356
380
|
from dfpyre import *
|
|
357
381
|
t = DFTemplate()
|
|
358
|
-
t.
|
|
359
|
-
t.
|
|
382
|
+
t.player_event('RightClick')
|
|
383
|
+
t.if_player('IsHolding', item('stick'))
|
|
360
384
|
t.bracket(
|
|
361
|
-
t.
|
|
385
|
+
t.player_action('SendMessage', 'clicked')
|
|
362
386
|
)
|
|
363
387
|
```
|
|
364
388
|
|
|
@@ -369,13 +393,13 @@ To create an `else` statement, use the `else_` method:
|
|
|
369
393
|
from dfpyre import *
|
|
370
394
|
t = DFTemplate()
|
|
371
395
|
t.function('grounded')
|
|
372
|
-
t.
|
|
396
|
+
t.if_player('IsGrounded')
|
|
373
397
|
t.bracket(
|
|
374
|
-
t.
|
|
398
|
+
t.player_action('ActionBar', 'on the ground')
|
|
375
399
|
)
|
|
376
400
|
t.else_()
|
|
377
401
|
t.bracket(
|
|
378
|
-
t.
|
|
402
|
+
t.player_action('ActionBar', 'in the air')
|
|
379
403
|
)
|
|
380
404
|
t.build()
|
|
381
405
|
```
|
|
@@ -388,14 +412,14 @@ As for loops, the bracket syntax is the same and will automatically change to "r
|
|
|
388
412
|
# prints numbers 1-5
|
|
389
413
|
from dfpyre import *
|
|
390
414
|
t = DFTemplate()
|
|
391
|
-
t.
|
|
415
|
+
t.player_event('Join')
|
|
392
416
|
t.repeat('Multiple', var('i'), 5)
|
|
393
417
|
t.bracket(
|
|
394
|
-
t.
|
|
418
|
+
t.player_action('SendMessage', var('i'))
|
|
395
419
|
)
|
|
396
420
|
```
|
|
397
421
|
|
|
398
|
-
### Creating Functions
|
|
422
|
+
### Creating Functions and Processes
|
|
399
423
|
|
|
400
424
|
To create a function or process, just start the template with a `function` or `process` method:
|
|
401
425
|
|
|
@@ -404,45 +428,45 @@ To create a function or process, just start the template with a `function` or `p
|
|
|
404
428
|
from dfpyre import *
|
|
405
429
|
t = DFTemplate()
|
|
406
430
|
t.function('doStuff')
|
|
407
|
-
t.
|
|
431
|
+
t.player_action('GiveItems', item('golden_apple', 64))
|
|
408
432
|
```
|
|
409
433
|
|
|
410
|
-
### Calling Functions
|
|
434
|
+
### Calling Functions and Processes
|
|
411
435
|
|
|
412
436
|
Calling Functions and processes is also simple:
|
|
413
437
|
|
|
414
438
|
```py
|
|
415
439
|
from dfpyre import *
|
|
416
440
|
t = DFTemplate()
|
|
417
|
-
t.
|
|
418
|
-
t.
|
|
441
|
+
t.player_event('Join')
|
|
442
|
+
t.call_function('doStuff')
|
|
419
443
|
```
|
|
420
444
|
|
|
421
445
|
### Method List
|
|
422
446
|
|
|
423
447
|
- Events / Function / Process
|
|
424
|
-
-
|
|
425
|
-
-
|
|
448
|
+
- player_event
|
|
449
|
+
- entity_event
|
|
426
450
|
- function
|
|
427
451
|
- process
|
|
428
|
-
-
|
|
429
|
-
-
|
|
452
|
+
- call_function
|
|
453
|
+
- start_process
|
|
430
454
|
|
|
431
455
|
- Actions
|
|
432
|
-
-
|
|
433
|
-
-
|
|
434
|
-
-
|
|
456
|
+
- player_action
|
|
457
|
+
- game_action
|
|
458
|
+
- entity_action
|
|
435
459
|
|
|
436
460
|
- Conditionals / Loops
|
|
437
|
-
-
|
|
438
|
-
-
|
|
439
|
-
-
|
|
440
|
-
-
|
|
441
|
-
- else_
|
|
461
|
+
- if_player
|
|
462
|
+
- if_variable
|
|
463
|
+
- if_game
|
|
464
|
+
- if_entity
|
|
465
|
+
- else_
|
|
442
466
|
- repeat
|
|
443
467
|
- bracket
|
|
444
468
|
|
|
445
469
|
- Other
|
|
446
470
|
- control
|
|
447
|
-
-
|
|
448
|
-
-
|
|
471
|
+
- select_object
|
|
472
|
+
- set_variable
|