dfpyre 0.8.6__tar.gz → 0.8.7__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dfpyre
3
- Version: 0.8.6
3
+ Version: 0.8.7
4
4
  Summary: A package for creating and modifying code templates for the DiamondFire Minecraft server.
5
5
  Home-page: https://github.com/Amp63/pyre
6
6
  License: MIT
@@ -42,12 +42,13 @@ class String:
42
42
  """
43
43
  type = 'txt'
44
44
 
45
- def __init__(self, value: str):
45
+ def __init__(self, value: str, slot: int|None=None):
46
46
  self.value = value
47
+ self.slot = slot
47
48
 
48
49
  def format(self, slot: int|None):
49
50
  formatted_dict = {"item": {"id": self.type, "data": {"name": self.value}}}
50
- _add_slot(formatted_dict, slot)
51
+ _add_slot(formatted_dict, self.slot or slot)
51
52
  return formatted_dict
52
53
 
53
54
  def __repr__(self) -> str:
@@ -62,14 +63,15 @@ class Text:
62
63
  """
63
64
  type = 'comp'
64
65
 
65
- def __init__(self, value: str):
66
+ def __init__(self, value: str, slot: int|None=None):
66
67
  if is_ampersand_coded(value):
67
68
  value = ampersand_to_minimessage(value)
68
69
  self.value = value
70
+ self.slot = slot
69
71
 
70
72
  def format(self, slot: int|None):
71
73
  formatted_dict = {"item": {"id": self.type, "data": {"name": self.value}}}
72
- _add_slot(formatted_dict, slot)
74
+ _add_slot(formatted_dict, self.slot or slot)
73
75
  return formatted_dict
74
76
 
75
77
  def __repr__(self) -> str:
@@ -82,12 +84,13 @@ class Number:
82
84
  """
83
85
  type = 'num'
84
86
 
85
- def __init__(self, num: int|float|str):
87
+ def __init__(self, num: int|float|str, slot: int|None=None):
86
88
  self.value = num
89
+ self.slot = slot
87
90
 
88
91
  def format(self, slot: int|None):
89
92
  formatted_dict = {"item": {"id": self.type, "data": {"name": str(self.value)}}}
90
- _add_slot(formatted_dict, slot)
93
+ _add_slot(formatted_dict, self.slot or slot)
91
94
  return formatted_dict
92
95
 
93
96
  def __repr__(self) -> str:
@@ -102,9 +105,13 @@ class Item(NbtItem):
102
105
  """
103
106
  type = 'item'
104
107
 
108
+ def __init__(self, item_id: str, count: int=1, slot: int | None=None):
109
+ super().__init__(item_id, count)
110
+ self.slot = slot
111
+
105
112
  def format(self, slot: int|None):
106
113
  formatted_dict = {"item": {"id": self.type, "data": {"item": self.get_snbt()}}}
107
- _add_slot(formatted_dict, slot)
114
+ _add_slot(formatted_dict, self.slot or slot)
108
115
  return formatted_dict
109
116
 
110
117
  def __repr__(self) -> str:
@@ -191,7 +198,7 @@ class Item(NbtItem):
191
198
  print(f'{COL_ERROR}Could not connect to CodeClient API. Possible problems:')
192
199
  print(f' - Minecraft is not open')
193
200
  print(f' - CodeClient is not installed (get it here: https://modrinth.com/mod/codeclient)')
194
- print(f' - CodeClient API is not enabled (enable it in CodeClient general settings)')
201
+ print(f' - CodeClient API is not enabled (enable it in CodeClient general settings){COL_RESET}')
195
202
  return 1
196
203
 
197
204
  print(f'Connection failed: {e}')
@@ -204,12 +211,13 @@ class Location:
204
211
  """
205
212
  type = 'loc'
206
213
 
207
- def __init__(self, x: float=0, y: float=0, z: float=0, pitch: float=0, yaw: float=0):
214
+ def __init__(self, x: float=0, y: float=0, z: float=0, pitch: float=0, yaw: float=0, slot: int | None=None):
208
215
  self.x = float(x)
209
216
  self.y = float(y)
210
217
  self.z = float(z)
211
218
  self.pitch = float(pitch)
212
219
  self.yaw = float(yaw)
220
+ self.slot = slot
213
221
 
214
222
  def format(self, slot: int|None):
215
223
  formatted_dict = {"item": {
@@ -225,7 +233,7 @@ class Location:
225
233
  }
226
234
  }
227
235
  }}
228
- _add_slot(formatted_dict, slot)
236
+ _add_slot(formatted_dict, self.slot or slot)
229
237
  return formatted_dict
230
238
 
231
239
  def __repr__(self) -> str:
@@ -240,16 +248,18 @@ class Variable:
240
248
  """
241
249
  type = 'var'
242
250
 
243
- def __init__(self, name: str, scope: Literal['unsaved', 'game', 'saved', 'local', 'line']='unsaved'):
251
+ def __init__(self, name: str, scope: Literal['unsaved', 'game', 'saved', 'local', 'line']='unsaved', slot: int | None=None):
244
252
  self.name = name
245
253
 
246
254
  if scope == 'game':
247
255
  scope = 'unsaved'
248
256
  self.scope = scope
257
+
258
+ self.slot = slot
249
259
 
250
260
  def format(self, slot: int|None):
251
261
  formatted_dict = {"item": {"id": self.type,"data": {"name": self.name, "scope": self.scope}}}
252
- _add_slot(formatted_dict, slot)
262
+ _add_slot(formatted_dict, self.slot or slot)
253
263
  return formatted_dict
254
264
 
255
265
  def __repr__(self) -> str:
@@ -264,14 +274,15 @@ class Sound:
264
274
  """
265
275
  type = 'snd'
266
276
 
267
- def __init__(self, name: str, pitch: float=1.0, vol: float=2.0):
277
+ def __init__(self, name: str, pitch: float=1.0, vol: float=2.0, slot: int | None=None):
268
278
  self.name = name
269
279
  self.pitch = pitch
270
280
  self.vol = vol
281
+ self.slot = slot
271
282
 
272
283
  def format(self, slot: int|None):
273
284
  formatted_dict = {"item": {"id": self.type,"data": {"sound": self.name, "pitch": self.pitch, "vol": self.vol}}}
274
- _add_slot(formatted_dict, slot)
285
+ _add_slot(formatted_dict, self.slot or slot)
275
286
  return formatted_dict
276
287
 
277
288
  def __repr__(self) -> str:
@@ -285,12 +296,13 @@ class Particle:
285
296
  Represents a DiamondFire particle object.
286
297
  """
287
298
  type = 'part'
288
- def __init__(self, particle_data: dict):
299
+ def __init__(self, particle_data: dict, slot: int | None=None):
289
300
  self.particle_data = particle_data
301
+ self.slot = slot
290
302
 
291
303
  def format(self, slot: int|None):
292
304
  formatted_dict = {"item": {"id": self.type, "data": self.particle_data}}
293
- _add_slot(formatted_dict, slot)
305
+ _add_slot(formatted_dict, self.slot or slot)
294
306
  return formatted_dict
295
307
 
296
308
  def __repr__(self) -> str:
@@ -303,14 +315,15 @@ class Potion:
303
315
  """
304
316
  type = 'pot'
305
317
 
306
- def __init__(self, name: str, dur: int=1000000, amp: int=0):
318
+ def __init__(self, name: str, dur: int=1000000, amp: int=0, slot: int | None=None):
307
319
  self.name = name
308
320
  self.dur = dur
309
321
  self.amp = amp
322
+ self.slot = slot
310
323
 
311
324
  def format(self, slot: int|None):
312
325
  formatted_dict = {"item": {"id": self.type,"data": {"pot": self.name, "dur": self.dur, "amp": self.amp}}}
313
- _add_slot(formatted_dict, slot)
326
+ _add_slot(formatted_dict, self.slot or slot)
314
327
  return formatted_dict
315
328
 
316
329
  def __repr__(self) -> str:
@@ -325,13 +338,14 @@ class GameValue:
325
338
  """
326
339
  type = 'g_val'
327
340
 
328
- def __init__(self, name: str, target: str='Default'):
341
+ def __init__(self, name: str, target: str='Default', slot: int | None=None):
329
342
  self.name = name
330
343
  self.target = target
344
+ self.slot = slot
331
345
 
332
346
  def format(self, slot: int|None):
333
347
  formatted_dict = {"item": {"id": self.type, "data": {"type": self.name, "target": self.target}}}
334
- _add_slot(formatted_dict, slot)
348
+ _add_slot(formatted_dict, self.slot or slot)
335
349
  return formatted_dict
336
350
 
337
351
  def __repr__(self) -> str:
@@ -344,14 +358,15 @@ class Vector:
344
358
  """
345
359
  type = 'vec'
346
360
 
347
- def __init__(self, x: float=0.0, y: float=0.0, z: float=0.0):
361
+ def __init__(self, x: float=0.0, y: float=0.0, z: float=0.0, slot: int | None=None):
348
362
  self.x = float(x)
349
363
  self.y = float(y)
350
364
  self.z = float(z)
365
+ self.slot = slot
351
366
 
352
367
  def format(self, slot: int|None):
353
368
  formatted_dict = {"item": {"id": self.type, "data": {"x": self.x, "y": self.y, "z": self.z}}}
354
- _add_slot(formatted_dict, slot)
369
+ _add_slot(formatted_dict, self.slot or slot)
355
370
  return formatted_dict
356
371
 
357
372
  def __repr__(self) -> str:
@@ -360,6 +375,7 @@ class Vector:
360
375
  Vec = Vector # Vector alias
361
376
 
362
377
 
378
+
363
379
  PARAMETER_TYPE_LOOKUP = ['txt', 'comp', 'num', 'loc', 'vec', 'snd', 'part', 'pot', 'item', 'any', 'var', 'list', 'dict']
364
380
 
365
381
  class ParameterType(Enum):
@@ -386,7 +402,8 @@ class Parameter:
386
402
  """
387
403
  type = 'pn_el'
388
404
 
389
- def __init__(self, name: str, param_type: ParameterType, plural: bool=False, optional: bool=False, description: str="", note: str="", default_value=None):
405
+ def __init__(self, name: str, param_type: ParameterType, plural: bool=False, optional: bool=False,
406
+ description: str="", note: str="", default_value=None, slot: int | None=None):
390
407
  self.name = name
391
408
  self.param_type = param_type
392
409
  self.plural = plural
@@ -394,7 +411,7 @@ class Parameter:
394
411
  self.description = description
395
412
  self.note = note
396
413
  self.default_value = convert_argument(default_value)
397
-
414
+ self.slot = slot
398
415
 
399
416
  def format(self, slot: int):
400
417
  formatted_dict = {"item": {
@@ -404,9 +421,10 @@ class Parameter:
404
421
  "type": self.param_type.get_string_value(),
405
422
  "plural": self.plural,
406
423
  "optional": self.optional,
407
- }},
408
- "slot": slot
424
+ }}
409
425
  }
426
+ _add_slot(formatted_dict, self.slot or slot)
427
+
410
428
  if self.description:
411
429
  formatted_dict['item']['data']['description'] = self.description
412
430
  if self.note:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "dfpyre"
3
- version = "0.8.6"
3
+ version = "0.8.7"
4
4
  description = "A package for creating and modifying code templates for the DiamondFire Minecraft server."
5
5
  authors = ["Amp"]
6
6
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes