dfpyre 0.4.6__py3-none-any.whl → 0.5.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.
Potentially problematic release.
This version of dfpyre might be problematic. Click here for more details.
- dfpyre/items.py +70 -152
- dfpyre/pyre.py +135 -209
- dfpyre/style.py +14 -14
- {dfpyre-0.4.6.dist-info → dfpyre-0.5.0.dist-info}/METADATA +77 -79
- dfpyre-0.5.0.dist-info/RECORD +9 -0
- dfpyre-0.4.6.dist-info/RECORD +0 -9
- {dfpyre-0.4.6.dist-info → dfpyre-0.5.0.dist-info}/LICENSE +0 -0
- {dfpyre-0.4.6.dist-info → dfpyre-0.5.0.dist-info}/WHEEL +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
-
Requires-Dist: mcitemlib (>=0.1.
|
|
15
|
+
Requires-Dist: mcitemlib (>=0.1.2,<0.2.0)
|
|
16
16
|
Project-URL: Repository, https://github.com/Amp63/pyre
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
|
|
@@ -32,7 +32,7 @@ pip install dfpyre
|
|
|
32
32
|
## Features
|
|
33
33
|
- All code block types
|
|
34
34
|
- All code item types
|
|
35
|
-
- Direct sending to DF via recode
|
|
35
|
+
- Direct sending to DF via recode or codeclient
|
|
36
36
|
- Automatic type conversion (int to num, str to text)
|
|
37
37
|
- Name checking ("did you mean ___?" for close matches)
|
|
38
38
|
- Default tag values
|
|
@@ -41,7 +41,7 @@ pip install dfpyre
|
|
|
41
41
|
## Basics
|
|
42
42
|
|
|
43
43
|
- [Setting up a program](#setup)
|
|
44
|
-
- [Events and Actions](#
|
|
44
|
+
- [Events and Actions](#events-and-actions)
|
|
45
45
|
- [Building](#building)
|
|
46
46
|
|
|
47
47
|
## Var Items
|
|
@@ -56,16 +56,17 @@ pip install dfpyre
|
|
|
56
56
|
- [Potion](#potion)
|
|
57
57
|
- [Game Value](#game-value)
|
|
58
58
|
- [Vector](#vector)
|
|
59
|
+
- [Parameter](#parameter)
|
|
59
60
|
|
|
60
61
|
## Conditionals and Loops
|
|
61
62
|
|
|
62
|
-
- [Conditionals and Brackets](#
|
|
63
|
+
- [Conditionals and Brackets](#conditionals-and-brackets)
|
|
63
64
|
- [Loops](#loops)
|
|
64
65
|
|
|
65
66
|
## Functions and Procedures
|
|
66
67
|
|
|
67
|
-
- [Creating Functions and
|
|
68
|
-
- [Calling Functions and
|
|
68
|
+
- [Creating Functions and Processes](#creating-functions-and-processes)
|
|
69
|
+
- [Calling Functions and Processes](#calling-functions-and-processes)
|
|
69
70
|
|
|
70
71
|
## Extras
|
|
71
72
|
|
|
@@ -101,12 +102,12 @@ Here's a complete program that prints a message to every player when a player jo
|
|
|
101
102
|
```py
|
|
102
103
|
from dfpyre import *
|
|
103
104
|
t = DFTemplate()
|
|
104
|
-
t.
|
|
105
|
-
t.
|
|
106
|
-
t.
|
|
105
|
+
t.player_event('Join')
|
|
106
|
+
t.player_action('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
107
|
+
t.build_and_send('codeclient')
|
|
107
108
|
```
|
|
108
109
|
|
|
109
|
-
### Events
|
|
110
|
+
### Events and Actions
|
|
110
111
|
|
|
111
112
|
You can find a list of events and actions [here](#method-list)
|
|
112
113
|
|
|
@@ -117,14 +118,14 @@ The following program sends a message to all players and gives a player 10 apple
|
|
|
117
118
|
```py
|
|
118
119
|
from dfpyre import *
|
|
119
120
|
t = DFTemplate()
|
|
120
|
-
t.
|
|
121
|
-
t.
|
|
122
|
-
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))
|
|
123
124
|
```
|
|
124
125
|
|
|
125
126
|
### Building
|
|
126
127
|
|
|
127
|
-
You
|
|
128
|
+
You have 2 different options for building your code line.
|
|
128
129
|
You can either:
|
|
129
130
|
|
|
130
131
|
1. Save the compressed template code to a variable and send it to minecraft later
|
|
@@ -135,11 +136,9 @@ If you choose the first option, the code would look something like this:
|
|
|
135
136
|
```py
|
|
136
137
|
from dfpyre import *
|
|
137
138
|
t = DFTemplate()
|
|
138
|
-
t.
|
|
139
|
-
t.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
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
|
|
143
142
|
```
|
|
144
143
|
|
|
145
144
|
If you choose the second option, you can do this:
|
|
@@ -147,9 +146,9 @@ If you choose the second option, you can do this:
|
|
|
147
146
|
```py
|
|
148
147
|
from dfpyre import *
|
|
149
148
|
t = DFTemplate()
|
|
150
|
-
t.
|
|
151
|
-
t.
|
|
152
|
-
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
|
|
153
152
|
```
|
|
154
153
|
|
|
155
154
|
### Variable Items
|
|
@@ -166,8 +165,8 @@ If a regular string is passed to a method as a chest parameter, it will automati
|
|
|
166
165
|
|
|
167
166
|
```py
|
|
168
167
|
# These do the same thing:
|
|
169
|
-
t.
|
|
170
|
-
t.
|
|
168
|
+
t.player_action('SendMessage', text('%default joined.'))
|
|
169
|
+
t.player_action('SendMessage', '%default joined.')
|
|
171
170
|
```
|
|
172
171
|
|
|
173
172
|
### Number
|
|
@@ -183,8 +182,8 @@ If a regular integer or float is passed to a method as a chest parameter, it wil
|
|
|
183
182
|
|
|
184
183
|
```py
|
|
185
184
|
# These do the same thing:
|
|
186
|
-
t.
|
|
187
|
-
t.
|
|
185
|
+
t.set_variable('=', var('number'), num(10))
|
|
186
|
+
t.set_variable('=', var('number'), 10)
|
|
188
187
|
```
|
|
189
188
|
|
|
190
189
|
### Variable
|
|
@@ -196,19 +195,19 @@ var('num')
|
|
|
196
195
|
var('text1')
|
|
197
196
|
```
|
|
198
197
|
|
|
199
|
-
You can set variable values by using the `
|
|
198
|
+
You can set variable values by using the `set_variable` method:
|
|
200
199
|
|
|
201
200
|
```py
|
|
202
|
-
t.
|
|
203
|
-
t.
|
|
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
|
|
204
203
|
```
|
|
205
204
|
|
|
206
205
|
You can set the scope of the variable by using the `scope` argument:
|
|
207
206
|
|
|
208
207
|
```py
|
|
209
|
-
t.
|
|
210
|
-
t.
|
|
211
|
-
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)
|
|
212
211
|
```
|
|
213
212
|
|
|
214
213
|
#### Shorthand Variables
|
|
@@ -216,8 +215,8 @@ t.setVariable('=', var(num1, scope='local'), 12)
|
|
|
216
215
|
You can also use the variable shorthand format like this:
|
|
217
216
|
```py
|
|
218
217
|
# These do the same thing:
|
|
219
|
-
t.
|
|
220
|
-
t.
|
|
218
|
+
t.set_variable('=', var('lineVar', scope='line'), 5)
|
|
219
|
+
t.set_variable('=', '$ilineVar', 5)
|
|
221
220
|
```
|
|
222
221
|
|
|
223
222
|
Shorthand vars should be formatted like this: `$[scope id][var name]`
|
|
@@ -233,7 +232,6 @@ Here's a list of the scope IDs:
|
|
|
233
232
|
Represents a diamondfire location item:
|
|
234
233
|
|
|
235
234
|
```py
|
|
236
|
-
# (var= is not required if numbers are in order, but is more readable)
|
|
237
235
|
loc(x=25.5, y=50, z=25.5, pitch=0, yaw=-90)
|
|
238
236
|
```
|
|
239
237
|
|
|
@@ -243,8 +241,8 @@ Example:
|
|
|
243
241
|
# teleport player on join
|
|
244
242
|
from dfpyre import *
|
|
245
243
|
t = DFTemplate()
|
|
246
|
-
t.
|
|
247
|
-
t.
|
|
244
|
+
t.player_event('Join')
|
|
245
|
+
t.player_action('Teleport', loc(10, 50, 10))
|
|
248
246
|
```
|
|
249
247
|
|
|
250
248
|
### Item
|
|
@@ -256,7 +254,7 @@ item('stick', count=5)
|
|
|
256
254
|
item('stone', 64)
|
|
257
255
|
```
|
|
258
256
|
|
|
259
|
-
|
|
257
|
+
To add extra data to an item, you can use any methods from the [mcitemlib](https://github.com/Amp63/mcitemlib) library
|
|
260
258
|
|
|
261
259
|
### Sound
|
|
262
260
|
|
|
@@ -272,8 +270,8 @@ Example:
|
|
|
272
270
|
# plays 'Grass Place' sound on join
|
|
273
271
|
from dfpyre import *
|
|
274
272
|
t = DFTemplate()
|
|
275
|
-
t.
|
|
276
|
-
t.
|
|
273
|
+
t.player_event('Join')
|
|
274
|
+
t.player_action('PlaySound', sound('Grass Place'))
|
|
277
275
|
```
|
|
278
276
|
|
|
279
277
|
### Particle
|
|
@@ -290,8 +288,8 @@ Example:
|
|
|
290
288
|
# plays a white cloud particle effect at 5, 50, 5
|
|
291
289
|
from dfpyre import *
|
|
292
290
|
t = DFTemplate()
|
|
293
|
-
t.
|
|
294
|
-
t.
|
|
291
|
+
t.player_event('Join')
|
|
292
|
+
t.player_action('Particle', particle('Cloud'), loc(5, 50, 5))
|
|
295
293
|
```
|
|
296
294
|
|
|
297
295
|
Currently, the particle object does not support colors.
|
|
@@ -311,8 +309,8 @@ Example:
|
|
|
311
309
|
# gives the player infinite saturation 255
|
|
312
310
|
from dfpyre import *
|
|
313
311
|
t = DFTemplate()
|
|
314
|
-
t.
|
|
315
|
-
t.
|
|
312
|
+
t.player_event('Join')
|
|
313
|
+
t.player_action('GivePotion', potion('Saturation', amp=254))
|
|
316
314
|
```
|
|
317
315
|
|
|
318
316
|
### Game Value
|
|
@@ -331,7 +329,7 @@ Example:
|
|
|
331
329
|
from dfpyre import *
|
|
332
330
|
t = DFTemplate()
|
|
333
331
|
t.function('printData')
|
|
334
|
-
t.
|
|
332
|
+
t.player_action('SendMessage', gamevalue('Player Count'), gamevalue('CPU Usage'))
|
|
335
333
|
```
|
|
336
334
|
|
|
337
335
|
### Vector
|
|
@@ -348,8 +346,8 @@ Example:
|
|
|
348
346
|
# sets the player's x velocity to 1.0 on join
|
|
349
347
|
from dfpyre import *
|
|
350
348
|
t = DFTemplate()
|
|
351
|
-
t.
|
|
352
|
-
t.
|
|
349
|
+
t.player_event('Join')
|
|
350
|
+
t.player_action('SetVelocity', vector(x=1.0, y=0.0, z=0.0))
|
|
353
351
|
```
|
|
354
352
|
|
|
355
353
|
### Parameter
|
|
@@ -366,12 +364,12 @@ Example:
|
|
|
366
364
|
# builds a function that says "Hello, [name]" where `name` is the inputted parameter.
|
|
367
365
|
from dfpyre import *
|
|
368
366
|
t = DFTemplate()
|
|
369
|
-
|
|
370
|
-
t.function('SayHi',
|
|
371
|
-
t.
|
|
367
|
+
name_parameter = parameter('name', ParameterType.TEXT)
|
|
368
|
+
t.function('SayHi', name_parameter)
|
|
369
|
+
t.player_action('SendMessage', 'Hello, ', var('name', 'line'))
|
|
372
370
|
```
|
|
373
371
|
|
|
374
|
-
### Conditionals
|
|
372
|
+
### Conditionals and Brackets
|
|
375
373
|
|
|
376
374
|
A list of conditionals and loops can be found [here](#commands).
|
|
377
375
|
|
|
@@ -381,10 +379,10 @@ A specific syntax must be followed when creating conditionals and loops. Each co
|
|
|
381
379
|
# prints 'clicked' when a player right clicks with a stick in their hand
|
|
382
380
|
from dfpyre import *
|
|
383
381
|
t = DFTemplate()
|
|
384
|
-
t.
|
|
385
|
-
t.
|
|
382
|
+
t.player_event('RightClick')
|
|
383
|
+
t.if_player('IsHolding', item('stick'))
|
|
386
384
|
t.bracket(
|
|
387
|
-
t.
|
|
385
|
+
t.player_action('SendMessage', 'clicked')
|
|
388
386
|
)
|
|
389
387
|
```
|
|
390
388
|
|
|
@@ -395,13 +393,13 @@ To create an `else` statement, use the `else_` method:
|
|
|
395
393
|
from dfpyre import *
|
|
396
394
|
t = DFTemplate()
|
|
397
395
|
t.function('grounded')
|
|
398
|
-
t.
|
|
396
|
+
t.if_player('IsGrounded')
|
|
399
397
|
t.bracket(
|
|
400
|
-
t.
|
|
398
|
+
t.player_action('ActionBar', 'on the ground')
|
|
401
399
|
)
|
|
402
400
|
t.else_()
|
|
403
401
|
t.bracket(
|
|
404
|
-
t.
|
|
402
|
+
t.player_action('ActionBar', 'in the air')
|
|
405
403
|
)
|
|
406
404
|
t.build()
|
|
407
405
|
```
|
|
@@ -414,14 +412,14 @@ As for loops, the bracket syntax is the same and will automatically change to "r
|
|
|
414
412
|
# prints numbers 1-5
|
|
415
413
|
from dfpyre import *
|
|
416
414
|
t = DFTemplate()
|
|
417
|
-
t.
|
|
415
|
+
t.player_event('Join')
|
|
418
416
|
t.repeat('Multiple', var('i'), 5)
|
|
419
417
|
t.bracket(
|
|
420
|
-
t.
|
|
418
|
+
t.player_action('SendMessage', var('i'))
|
|
421
419
|
)
|
|
422
420
|
```
|
|
423
421
|
|
|
424
|
-
### Creating Functions
|
|
422
|
+
### Creating Functions and Processes
|
|
425
423
|
|
|
426
424
|
To create a function or process, just start the template with a `function` or `process` method:
|
|
427
425
|
|
|
@@ -430,45 +428,45 @@ To create a function or process, just start the template with a `function` or `p
|
|
|
430
428
|
from dfpyre import *
|
|
431
429
|
t = DFTemplate()
|
|
432
430
|
t.function('doStuff')
|
|
433
|
-
t.
|
|
431
|
+
t.player_action('GiveItems', item('golden_apple', 64))
|
|
434
432
|
```
|
|
435
433
|
|
|
436
|
-
### Calling Functions
|
|
434
|
+
### Calling Functions and Processes
|
|
437
435
|
|
|
438
436
|
Calling Functions and processes is also simple:
|
|
439
437
|
|
|
440
438
|
```py
|
|
441
439
|
from dfpyre import *
|
|
442
440
|
t = DFTemplate()
|
|
443
|
-
t.
|
|
444
|
-
t.
|
|
441
|
+
t.player_event('Join')
|
|
442
|
+
t.call_function('doStuff')
|
|
445
443
|
```
|
|
446
444
|
|
|
447
445
|
### Method List
|
|
448
446
|
|
|
449
447
|
- Events / Function / Process
|
|
450
|
-
-
|
|
451
|
-
-
|
|
448
|
+
- player_event
|
|
449
|
+
- entity_event
|
|
452
450
|
- function
|
|
453
451
|
- process
|
|
454
|
-
-
|
|
455
|
-
-
|
|
452
|
+
- call_function
|
|
453
|
+
- start_process
|
|
456
454
|
|
|
457
455
|
- Actions
|
|
458
|
-
-
|
|
459
|
-
-
|
|
460
|
-
-
|
|
456
|
+
- player_action
|
|
457
|
+
- game_action
|
|
458
|
+
- entity_action
|
|
461
459
|
|
|
462
460
|
- Conditionals / Loops
|
|
463
|
-
-
|
|
464
|
-
-
|
|
465
|
-
-
|
|
466
|
-
-
|
|
467
|
-
- else_
|
|
461
|
+
- if_player
|
|
462
|
+
- if_variable
|
|
463
|
+
- if_game
|
|
464
|
+
- if_entity
|
|
465
|
+
- else_
|
|
468
466
|
- repeat
|
|
469
467
|
- bracket
|
|
470
468
|
|
|
471
469
|
- Other
|
|
472
470
|
- control
|
|
473
|
-
-
|
|
474
|
-
-
|
|
471
|
+
- select_object
|
|
472
|
+
- set_variable
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
dfpyre/__init__.py,sha256=apPsSxJ1Tztfl71MoORoSmDfX7LyKLYlLwOGeLQUitw,25
|
|
2
|
+
dfpyre/data/data.json,sha256=M4EHXKkh7Cx7y3BQ6c3csvmNmSqP2oE4txLI9MZcDDA,30347
|
|
3
|
+
dfpyre/items.py,sha256=L2e9b9BZQrI7AIBw46puENReDQRlWgHnw7T9NBG1Vcs,7688
|
|
4
|
+
dfpyre/pyre.py,sha256=5UryjtwsNRxl6mGknsKm8iM2DP49-B-tqwkr9LdoRJ8,13805
|
|
5
|
+
dfpyre/style.py,sha256=mLW1CFvvi8_9fk8JaH10I5S4WI0YBdQIXHtI3G_4sR8,980
|
|
6
|
+
dfpyre-0.5.0.dist-info/LICENSE,sha256=atkly29RNUY2evLoPyurzCJeQnhP-VCAD-JZEbq3mno,1060
|
|
7
|
+
dfpyre-0.5.0.dist-info/METADATA,sha256=RpuPps-V4FruPh1p0L7wroEDwZfC5lP6ITgl14334Cs,10142
|
|
8
|
+
dfpyre-0.5.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
9
|
+
dfpyre-0.5.0.dist-info/RECORD,,
|
dfpyre-0.4.6.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
dfpyre/__init__.py,sha256=apPsSxJ1Tztfl71MoORoSmDfX7LyKLYlLwOGeLQUitw,25
|
|
2
|
-
dfpyre/data/data.json,sha256=M4EHXKkh7Cx7y3BQ6c3csvmNmSqP2oE4txLI9MZcDDA,30347
|
|
3
|
-
dfpyre/items.py,sha256=2cinNNMBgpGA8cU25RsLyp_TllBUfR2k7vXGjUi5Xjs,8862
|
|
4
|
-
dfpyre/pyre.py,sha256=p-3k8AHJNvCH2g9FNYslaWMD4TNB0X51vkZzuAUlIv8,16363
|
|
5
|
-
dfpyre/style.py,sha256=8ueN_l94oKWnqKJRLMgC3cOWhj7hfmlHhGuZHm7Rzjg,954
|
|
6
|
-
dfpyre-0.4.6.dist-info/LICENSE,sha256=atkly29RNUY2evLoPyurzCJeQnhP-VCAD-JZEbq3mno,1060
|
|
7
|
-
dfpyre-0.4.6.dist-info/METADATA,sha256=BPp1Fh0PvNFpy1RITc-hnoRrOT3LG_RZV4WZnDnedUs,10079
|
|
8
|
-
dfpyre-0.4.6.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
9
|
-
dfpyre-0.4.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|