dfpyre 0.4.5__py3-none-any.whl → 0.8.1__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/actiondump.py +77 -0
- dfpyre/data/actiondump_min.json +1 -0
- dfpyre/items.py +396 -361
- dfpyre/pyre.py +595 -433
- dfpyre/scriptgen.py +193 -0
- dfpyre/style.py +22 -22
- dfpyre/util.py +39 -0
- {dfpyre-0.4.5.dist-info → dfpyre-0.8.1.dist-info}/LICENSE +21 -21
- dfpyre-0.8.1.dist-info/METADATA +514 -0
- dfpyre-0.8.1.dist-info/RECORD +12 -0
- dfpyre/data/data.json +0 -1
- dfpyre-0.4.5.dist-info/METADATA +0 -448
- dfpyre-0.4.5.dist-info/RECORD +0 -9
- {dfpyre-0.4.5.dist-info → dfpyre-0.8.1.dist-info}/WHEEL +0 -0
dfpyre-0.4.5.dist-info/METADATA
DELETED
|
@@ -1,448 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: dfpyre
|
|
3
|
-
Version: 0.4.5
|
|
4
|
-
Summary: A package for external creation of code templates for the DiamondFire Minecraft server.
|
|
5
|
-
Home-page: https://github.com/Amp63/pyre
|
|
6
|
-
License: MIT
|
|
7
|
-
Keywords: diamondfire,minecraft
|
|
8
|
-
Author: Amp
|
|
9
|
-
Requires-Python: >=3.12,<4.0
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
-
Requires-Dist: mcitemlib (>=0.1.0,<0.2.0)
|
|
14
|
-
Project-URL: Repository, https://github.com/Amp63/pyre
|
|
15
|
-
Description-Content-Type: text/markdown
|
|
16
|
-
|
|
17
|
-
# pyre
|
|
18
|
-
|
|
19
|
-
A package for external creation of code templates for the DiamondFire Minecraft server (mcdiamondfire.com).
|
|
20
|
-
|
|
21
|
-
PyPi Link: https://pypi.org/project/dfpyre/
|
|
22
|
-
|
|
23
|
-
## Features
|
|
24
|
-
- All code block types
|
|
25
|
-
- All code item types
|
|
26
|
-
- Direct sending to DF via recode
|
|
27
|
-
- Automatic type conversion (int to num, str to text)
|
|
28
|
-
- Name checking ("did you mean ___?" for close matches)
|
|
29
|
-
- Default tag values
|
|
30
|
-
|
|
31
|
-
## Documentation
|
|
32
|
-
## Basics
|
|
33
|
-
|
|
34
|
-
- [Setting up a program](#setup)
|
|
35
|
-
- [Events and Actions](#eventsactions)
|
|
36
|
-
- [Building](#building)
|
|
37
|
-
|
|
38
|
-
## Var Items
|
|
39
|
-
|
|
40
|
-
- [Text](#text)
|
|
41
|
-
- [Number](#number)
|
|
42
|
-
- [Variable](#variable)
|
|
43
|
-
- [Location](#location)
|
|
44
|
-
- [Item](#item)
|
|
45
|
-
- [Sound](#sound)
|
|
46
|
-
- [Particle](#particle)
|
|
47
|
-
- [Potion](#potion)
|
|
48
|
-
- [Game Value](#game-value)
|
|
49
|
-
- [Vector](#vector)
|
|
50
|
-
|
|
51
|
-
## Conditionals and Loops
|
|
52
|
-
|
|
53
|
-
- [Conditionals and Brackets](#conditionalsbrackets)
|
|
54
|
-
- [Loops](#loops)
|
|
55
|
-
|
|
56
|
-
## Functions and Procedures
|
|
57
|
-
|
|
58
|
-
- [Creating Functions and Procedures](#create-functionsprocedures)
|
|
59
|
-
- [Calling Functions and Procedures](#call-functionsprocedures)
|
|
60
|
-
|
|
61
|
-
## Extras
|
|
62
|
-
|
|
63
|
-
- [Method List](#method-list)
|
|
64
|
-
|
|
65
|
-
___
|
|
66
|
-
|
|
67
|
-
### Setup
|
|
68
|
-
|
|
69
|
-
To start creating in pyre, you have to create a DFTemplate object like so:
|
|
70
|
-
|
|
71
|
-
```py
|
|
72
|
-
from dfpyre import *
|
|
73
|
-
t = DFTemplate()
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Basically everything stems from this template object.
|
|
77
|
-
|
|
78
|
-
This is the basic layout of a file:
|
|
79
|
-
|
|
80
|
-
```py
|
|
81
|
-
from dfpyre import *
|
|
82
|
-
t = DFTemplate()
|
|
83
|
-
# [Event, Function, or Process]
|
|
84
|
-
# [Your code here]
|
|
85
|
-
t.build()
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
The commented lines represent where you will insert calls to methods in the template object.
|
|
89
|
-
|
|
90
|
-
Here's a complete program that prints a message to every player when a player joins:
|
|
91
|
-
|
|
92
|
-
```py
|
|
93
|
-
from dfpyre import *
|
|
94
|
-
t = DFTemplate()
|
|
95
|
-
t.playerEvent('Join')
|
|
96
|
-
t.playerAction('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
97
|
-
t.buildAndSend()
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Events/Actions
|
|
101
|
-
|
|
102
|
-
You can find a list of events and actions [here](#commands)
|
|
103
|
-
|
|
104
|
-
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
|
-
|
|
106
|
-
The following program sends a message to all players and gives a player 10 apples upon joining:
|
|
107
|
-
|
|
108
|
-
```py
|
|
109
|
-
from dfpyre import *
|
|
110
|
-
t = DFTemplate()
|
|
111
|
-
t.playerEvent('Join')
|
|
112
|
-
t.playerAction('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
113
|
-
t.playerAction('GiveItems', item('apple', 10))
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### Building
|
|
117
|
-
|
|
118
|
-
You basically have 2 different options for building your code line.
|
|
119
|
-
You can either:
|
|
120
|
-
|
|
121
|
-
1. Save the compressed template code to a variable and send it to minecraft later
|
|
122
|
-
2. Build and send directly to your minecraft client (recommended)
|
|
123
|
-
|
|
124
|
-
If you choose the first option, the code would look something like this:
|
|
125
|
-
|
|
126
|
-
```py
|
|
127
|
-
from dfpyre import *
|
|
128
|
-
t = DFTemplate()
|
|
129
|
-
t.playerEvent('Join')
|
|
130
|
-
t.playerAction('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
131
|
-
templateCode = t.build()
|
|
132
|
-
|
|
133
|
-
sendToDf(code, name='myJoinTemplate') # Send to minecraft client via recode item api
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
If you choose the second option, you can do this:
|
|
137
|
-
|
|
138
|
-
```py
|
|
139
|
-
from dfpyre import *
|
|
140
|
-
t = DFTemplate()
|
|
141
|
-
t.playerEvent('Join')
|
|
142
|
-
t.playerAction('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
143
|
-
t.buildAndSend() # builds and sends automatically to minecraft
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### Variable Items
|
|
147
|
-
|
|
148
|
-
### Text
|
|
149
|
-
|
|
150
|
-
Represents a diamondfire text item:
|
|
151
|
-
|
|
152
|
-
```py
|
|
153
|
-
text('hello %default.')
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
If a regular string is passed to a method as a chest parameter, it will automatically be converted to a text object:
|
|
157
|
-
|
|
158
|
-
```py
|
|
159
|
-
# These do the same thing:
|
|
160
|
-
t.playerAction('SendMessage', text('%default joined.'))
|
|
161
|
-
t.playerAction('SendMessage', '%default joined.')
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
### Number
|
|
165
|
-
|
|
166
|
-
Represents a diamondfire number item:
|
|
167
|
-
|
|
168
|
-
```py
|
|
169
|
-
num(5)
|
|
170
|
-
num(3.14)
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
If a regular integer or float is passed to a method as a chest parameter, it will automatically be converted to a num object:
|
|
174
|
-
|
|
175
|
-
```py
|
|
176
|
-
# These do the same thing:
|
|
177
|
-
t.setVariable('=', var('number'), num(10))
|
|
178
|
-
t.setVariable('=', var('number'), 10)
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### Variable
|
|
182
|
-
|
|
183
|
-
Represents a diamondfire variable item:
|
|
184
|
-
|
|
185
|
-
```py
|
|
186
|
-
var('num')
|
|
187
|
-
var('text1')
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
You can set variable values by using the `setVariable` method:
|
|
191
|
-
|
|
192
|
-
```py
|
|
193
|
-
t.setVariable('=', var('num'), 12) # sets 'num' to 12
|
|
194
|
-
t.setVariable('x', var('doubled'), var('num'), 2) # sets 'doubled' to 24
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
You can set the scope of the variable by using the `scope` keyword:
|
|
198
|
-
|
|
199
|
-
```py
|
|
200
|
-
t.setVariable('=', var(num1, scope='game'), 12) # both 'game' or 'unsaved' can be passed for the scope here
|
|
201
|
-
t.setVariable('=', var(num1, scope='saved'), 12)
|
|
202
|
-
t.setVariable('=', var(num1, scope='local'), 12)
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### Location
|
|
206
|
-
|
|
207
|
-
Represents a diamondfire location item:
|
|
208
|
-
|
|
209
|
-
```py
|
|
210
|
-
# (var= is not required if numbers are in order, but is more readable)
|
|
211
|
-
loc(x=25.5, y=50, z=25.5, pitch=0, yaw=-90)
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
Example:
|
|
215
|
-
|
|
216
|
-
```py
|
|
217
|
-
# teleport player on join
|
|
218
|
-
from dfpyre import *
|
|
219
|
-
t = DFTemplate()
|
|
220
|
-
t.playerEvent('Join')
|
|
221
|
-
t.playerAction('Teleport', loc(10, 50, 10))
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
### Item
|
|
225
|
-
|
|
226
|
-
Represents a minecraft item:
|
|
227
|
-
|
|
228
|
-
```py
|
|
229
|
-
item('stick', count=5)
|
|
230
|
-
item('stone', 64)
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
Extra nbt (enchants, lore, etc.) is not supported right now.
|
|
234
|
-
|
|
235
|
-
### Sound
|
|
236
|
-
|
|
237
|
-
Represents a diamondfire sound item:
|
|
238
|
-
|
|
239
|
-
```py
|
|
240
|
-
sound('Wood Break', pitch=1.5, vol=2.0)
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
Example:
|
|
244
|
-
|
|
245
|
-
```py
|
|
246
|
-
# plays 'Grass Place' sound on join
|
|
247
|
-
from dfpyre import *
|
|
248
|
-
t = DFTemplate()
|
|
249
|
-
t.playerEvent('Join')
|
|
250
|
-
t.playerAction('PlaySound', sound('Grass Place'))
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
### Particle
|
|
254
|
-
|
|
255
|
-
Represents a diamondfire particle item:
|
|
256
|
-
|
|
257
|
-
```py
|
|
258
|
-
particle(name='Cloud', amount=10, horizontal=1.0, vertical=0.5, x=1.0, y=0.0, z=0.0, motionVariation=100)
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
Example:
|
|
262
|
-
|
|
263
|
-
```py
|
|
264
|
-
# plays a white cloud particle effect at 5, 50, 5
|
|
265
|
-
from dfpyre import *
|
|
266
|
-
t = DFTemplate()
|
|
267
|
-
t.playerEvent('Join')
|
|
268
|
-
t.playerAction('Particle', particle('Cloud'), loc(5, 50, 5))
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
Currently, the particle object does not support colors.
|
|
272
|
-
|
|
273
|
-
### Potion
|
|
274
|
-
|
|
275
|
-
Represents a diamondfire potion item:
|
|
276
|
-
|
|
277
|
-
```py
|
|
278
|
-
# gives speed 1 for 1 minute
|
|
279
|
-
potion('Speed', dur=1200, amp=0)
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
Example:
|
|
283
|
-
|
|
284
|
-
```py
|
|
285
|
-
# gives the player infinite saturation 255
|
|
286
|
-
from dfpyre import *
|
|
287
|
-
t = DFTemplate()
|
|
288
|
-
t.playerEvent('Join')
|
|
289
|
-
t.playerAction('GivePotion', potion('Saturation', amp=254))
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
### Game Value
|
|
293
|
-
|
|
294
|
-
Represents a diamondfire game value item:
|
|
295
|
-
|
|
296
|
-
```py
|
|
297
|
-
gamevalue('Player Count')
|
|
298
|
-
gamevalue('Location' target='Selection')
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
Example:
|
|
302
|
-
|
|
303
|
-
```py
|
|
304
|
-
# function that prints player count and cpu
|
|
305
|
-
from dfpyre import *
|
|
306
|
-
t = DFTemplate()
|
|
307
|
-
t.function('printData')
|
|
308
|
-
t.playerAction('SendMessage', gamevalue('Player Count'), gamevalue('CPU Usage'))
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
### Vector
|
|
312
|
-
|
|
313
|
-
Represents a diamondfire vector item:
|
|
314
|
-
|
|
315
|
-
```py
|
|
316
|
-
vector(x=1.1, y=0.0, z=0.5)
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
Example:
|
|
320
|
-
|
|
321
|
-
```py
|
|
322
|
-
# sets the player's x velocity to 1.0 on join
|
|
323
|
-
from dfpyre import *
|
|
324
|
-
t = DFTemplate()
|
|
325
|
-
t.playerEvent('Join')
|
|
326
|
-
t.playerAction('SetVelocity', vector(x=1.0, y=0.0, z=0.0))
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
### Parameter
|
|
330
|
-
|
|
331
|
-
Represents a diamondfire parameter item:
|
|
332
|
-
|
|
333
|
-
```py
|
|
334
|
-
parameter('text', ParameterType.STRING)
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
Example:
|
|
338
|
-
|
|
339
|
-
```py
|
|
340
|
-
# builds a function that says "Hello, [name]" where `name` is the inputted parameter.
|
|
341
|
-
from dfpyre import *
|
|
342
|
-
t = DFTemplate()
|
|
343
|
-
nameParameter = parameter('name', ParameterType.TEXT)
|
|
344
|
-
t.function('SayHi', nameParameter)
|
|
345
|
-
t.playerAction('SendMessage', 'Hello, ', var('name', 'line'))
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
### Conditionals/Brackets
|
|
349
|
-
|
|
350
|
-
A list of conditionals and loops can be found [here](#commands).
|
|
351
|
-
|
|
352
|
-
A specific syntax must be followed when creating conditionals and loops. Each conditional statement must be followed by a `bracket()` method, which will contain code. Here's an example:
|
|
353
|
-
|
|
354
|
-
```py
|
|
355
|
-
# prints 'clicked' when a player right clicks with a stick in their hand
|
|
356
|
-
from dfpyre import *
|
|
357
|
-
t = DFTemplate()
|
|
358
|
-
t.playerEvent('RightClick')
|
|
359
|
-
t.ifPlayer('IsHolding', item('stick'))
|
|
360
|
-
t.bracket(
|
|
361
|
-
t.playerAction('SendMessage', 'clicked')
|
|
362
|
-
)
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
To create an `else` statement, use the `else_` method:
|
|
366
|
-
|
|
367
|
-
```py
|
|
368
|
-
# says the player is 'on the ground' when grounded and 'in the air' otherwise.
|
|
369
|
-
from dfpyre import *
|
|
370
|
-
t = DFTemplate()
|
|
371
|
-
t.function('grounded')
|
|
372
|
-
t.ifPlayer('IsGrounded')
|
|
373
|
-
t.bracket(
|
|
374
|
-
t.playerAction('ActionBar', 'on the ground')
|
|
375
|
-
)
|
|
376
|
-
t.else_()
|
|
377
|
-
t.bracket(
|
|
378
|
-
t.playerAction('ActionBar', 'in the air')
|
|
379
|
-
)
|
|
380
|
-
t.build()
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
### Loops
|
|
384
|
-
|
|
385
|
-
As for loops, the bracket syntax is the same and will automatically change to "repeat-type" brackets:
|
|
386
|
-
|
|
387
|
-
```py
|
|
388
|
-
# prints numbers 1-5
|
|
389
|
-
from dfpyre import *
|
|
390
|
-
t = DFTemplate()
|
|
391
|
-
t.playerEvent('Join')
|
|
392
|
-
t.repeat('Multiple', var('i'), 5)
|
|
393
|
-
t.bracket(
|
|
394
|
-
t.playerAction('SendMessage', var('i'))
|
|
395
|
-
)
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
### Creating Functions/Processes
|
|
399
|
-
|
|
400
|
-
To create a function or process, just start the template with a `function` or `process` method:
|
|
401
|
-
|
|
402
|
-
```py
|
|
403
|
-
# function that gives a player 64 golden apples
|
|
404
|
-
from dfpyre import *
|
|
405
|
-
t = DFTemplate()
|
|
406
|
-
t.function('doStuff')
|
|
407
|
-
t.playerAction('GiveItems', item('golden_apple', 64))
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
### Calling Functions/Processes
|
|
411
|
-
|
|
412
|
-
Calling Functions and processes is also simple:
|
|
413
|
-
|
|
414
|
-
```py
|
|
415
|
-
from dfpyre import *
|
|
416
|
-
t = DFTemplate()
|
|
417
|
-
t.playerEvent('Join')
|
|
418
|
-
t.callFunction('doStuff')
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
### Method List
|
|
422
|
-
|
|
423
|
-
- Events / Function / Process
|
|
424
|
-
- playerEvent
|
|
425
|
-
- entityEvent
|
|
426
|
-
- function
|
|
427
|
-
- process
|
|
428
|
-
- callFunction
|
|
429
|
-
- startProcess
|
|
430
|
-
|
|
431
|
-
- Actions
|
|
432
|
-
- playerAction
|
|
433
|
-
- gameAction
|
|
434
|
-
- entityAction
|
|
435
|
-
|
|
436
|
-
- Conditionals / Loops
|
|
437
|
-
- ifPlayer
|
|
438
|
-
- ifVariable
|
|
439
|
-
- ifGame
|
|
440
|
-
- ifEntity
|
|
441
|
-
- else_ (don't forget underscore)
|
|
442
|
-
- repeat
|
|
443
|
-
- bracket
|
|
444
|
-
|
|
445
|
-
- Other
|
|
446
|
-
- control
|
|
447
|
-
- selectObject
|
|
448
|
-
- setVariable
|
dfpyre-0.4.5.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
dfpyre/__init__.py,sha256=apPsSxJ1Tztfl71MoORoSmDfX7LyKLYlLwOGeLQUitw,25
|
|
2
|
-
dfpyre/data/data.json,sha256=fKQ2GaOVVOu5ZQovBNG_xbWtcjFGPTnYVo4Vcbn67ck,30264
|
|
3
|
-
dfpyre/items.py,sha256=1Cr0j7-PZLeEKh0bfa87YjN8nejxkWx2YDCYfoAhAXY,9222
|
|
4
|
-
dfpyre/pyre.py,sha256=d38VuHhjDhhhI9nDSSP-gjJwZe7Hoc5J3QvEtL38M0c,15052
|
|
5
|
-
dfpyre/style.py,sha256=RKaZUQ3e_7v4jBmofQ0RyT374syaZnbqCTmEOJZkXVo,975
|
|
6
|
-
dfpyre-0.4.5.dist-info/LICENSE,sha256=0-CM8JuXeqwgv7oyGD6sW2vYc_GTZse7nBEMC_p9-QE,1081
|
|
7
|
-
dfpyre-0.4.5.dist-info/METADATA,sha256=Bo3MfrygH6BW6i1Qs0uwDGsOFQdAB2nBpDjLRITcDD8,9509
|
|
8
|
-
dfpyre-0.4.5.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
9
|
-
dfpyre-0.4.5.dist-info/RECORD,,
|
|
File without changes
|