dfpyre 0.4.6__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.

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