dfpyre 0.7.8__py3-none-any.whl → 0.7.9__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/scriptgen.py CHANGED
@@ -4,6 +4,7 @@ from dfpyre.items import *
4
4
  from dfpyre.actiondump import get_default_tags
5
5
 
6
6
  SCRIPT_START = '''from dfpyre import *
7
+
7
8
  t = DFTemplate()
8
9
  '''
9
10
 
@@ -39,10 +40,20 @@ class GeneratorFlags:
39
40
  var_shorthand: bool
40
41
 
41
42
 
43
+ def item_to_string(class_name: str, i: item):
44
+ i.nbt.data.pop('~DF_NBT', None)
45
+ stripped_id = i.get_id().replace('minecraft:', '')
46
+ if i.nbt.key_set() == {'~id', '~count'}:
47
+ if i.get_count() == 1:
48
+ return f'{class_name}("{stripped_id}")'
49
+ return f'{class_name}("{stripped_id}", {i.get_count()})'
50
+ return f'{class_name}.from_nbt("""{i.get_nbt()}""")'
51
+
52
+
42
53
  def argument_item_to_string(flags: GeneratorFlags, arg_item: object) -> str:
43
54
  class_name = arg_item.__class__.__name__
44
55
  if isinstance(arg_item, item):
45
- return f'{class_name}.from_nbt("""{arg_item.get_nbt()}""")'
56
+ return item_to_string(class_name, arg_item)
46
57
 
47
58
  if isinstance(arg_item, string):
48
59
  value = arg_item.value.replace('\n', '\\n')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dfpyre
3
- Version: 0.7.8
3
+ Version: 0.7.9
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
@@ -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.3.2,<0.4.0)
15
+ Requires-Dist: mcitemlib (>=0.3.3,<0.4.0)
16
16
  Project-URL: Repository, https://github.com/Amp63/pyre
17
17
  Description-Content-Type: text/markdown
18
18
 
@@ -3,10 +3,10 @@ dfpyre/actiondump.py,sha256=YR5h0ZjgyqNkHUCkLLKS0ovMFZQ8WSKuJQzGncT27cA,2664
3
3
  dfpyre/data/actiondump_min.json,sha256=hFcIbG_G55FWwqRSW6X77ZrKkQiXLs4CGgJrZgyR2Gg,1938799
4
4
  dfpyre/items.py,sha256=WIiuslk6qyPUWSndDFEUqz_TNGUgIb0YgXrwh2Lokfs,11746
5
5
  dfpyre/pyre.py,sha256=swF4up0nHY0NJHLR08YrMZfot62GYaqavEVwGZdXUIw,18773
6
- dfpyre/scriptgen.py,sha256=HHWiJwuZFF3w7f-i7QVDZ_7UE6KNjHIIdAQ_2THPLI8,6027
6
+ dfpyre/scriptgen.py,sha256=Klfbsm2qgv9FOQTqpA3CSPyV3XSx4A27DZIvekkVGGw,6412
7
7
  dfpyre/style.py,sha256=YRSKEg5r8rkZH62WkRQYbTPgTWVVGVXLnx4edShs0NM,1001
8
8
  dfpyre/util.py,sha256=KThtsPQh4Ep3UXPvJGw5jrzEcM4cDqDG5IG1FXUQROI,610
9
- dfpyre-0.7.8.dist-info/LICENSE,sha256=nqCBVqcbIX-9lhVDarggfrjgNZoPlKKlyl0-hOPS2wQ,1081
10
- dfpyre-0.7.8.dist-info/METADATA,sha256=Hmws7qplMD4LOfvr1FARipRsq_HALxpC8K_et5ldpGY,11754
11
- dfpyre-0.7.8.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
12
- dfpyre-0.7.8.dist-info/RECORD,,
9
+ dfpyre-0.7.9.dist-info/LICENSE,sha256=nqCBVqcbIX-9lhVDarggfrjgNZoPlKKlyl0-hOPS2wQ,1081
10
+ dfpyre-0.7.9.dist-info/METADATA,sha256=yAm5NzCsjYopDRvk0RMpRjzr0QhNFXP5P6mi0pYR_oc,11754
11
+ dfpyre-0.7.9.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
12
+ dfpyre-0.7.9.dist-info/RECORD,,
File without changes