dfpyre 0.8.1__tar.gz → 0.8.3__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.
- {dfpyre-0.8.1 → dfpyre-0.8.3}/PKG-INFO +22 -5
- {dfpyre-0.8.1 → dfpyre-0.8.3}/README.md +21 -4
- dfpyre-0.8.3/dfpyre/action_literals.py +16 -0
- {dfpyre-0.8.1 → dfpyre-0.8.3}/dfpyre/pyre.py +16 -13
- {dfpyre-0.8.1 → dfpyre-0.8.3}/pyproject.toml +2 -2
- {dfpyre-0.8.1 → dfpyre-0.8.3}/LICENSE +0 -0
- {dfpyre-0.8.1 → dfpyre-0.8.3}/dfpyre/__init__.py +0 -0
- {dfpyre-0.8.1 → dfpyre-0.8.3}/dfpyre/actiondump.py +0 -0
- {dfpyre-0.8.1 → dfpyre-0.8.3}/dfpyre/data/actiondump_min.json +0 -0
- {dfpyre-0.8.1 → dfpyre-0.8.3}/dfpyre/items.py +0 -0
- {dfpyre-0.8.1 → dfpyre-0.8.3}/dfpyre/scriptgen.py +0 -0
- {dfpyre-0.8.1 → dfpyre-0.8.3}/dfpyre/style.py +0 -0
- {dfpyre-0.8.1 → dfpyre-0.8.3}/dfpyre/util.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dfpyre
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.3
|
|
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
|
|
@@ -39,8 +39,10 @@ This module works best with [CodeClient](https://modrinth.com/mod/codeclient) in
|
|
|
39
39
|
- All code item types
|
|
40
40
|
- Direct sending to DF via recode or codeclient
|
|
41
41
|
- Automatic type conversion (int to num, str to text)
|
|
42
|
+
- Auto completed action names (if your IDE supports type hints)
|
|
42
43
|
- Warnings for unrecognized actions and tags
|
|
43
|
-
-
|
|
44
|
+
- Shorthand format for variables
|
|
45
|
+
- Convert existing templates into equivalent Python code (see [Script Generation](#script-generation))
|
|
44
46
|
|
|
45
47
|
## Documentation
|
|
46
48
|
## Basics
|
|
@@ -116,7 +118,7 @@ The following program sends a message to all players and gives a player 10 apple
|
|
|
116
118
|
from dfpyre import *
|
|
117
119
|
|
|
118
120
|
player_event('Join', [
|
|
119
|
-
player_action('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
121
|
+
player_action('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS),
|
|
120
122
|
player_action('GiveItems', Item('apple', 10))
|
|
121
123
|
]).build_and_send('codeclient')
|
|
122
124
|
```
|
|
@@ -364,7 +366,7 @@ Example:
|
|
|
364
366
|
from dfpyre import *
|
|
365
367
|
|
|
366
368
|
name_parameter = parameter('name', ParameterType.TEXT)
|
|
367
|
-
function('SayHi', name_parameter codeblocks=[
|
|
369
|
+
function('SayHi', name_parameter, codeblocks=[
|
|
368
370
|
player_action('SendMessage', 'Hello, ', Variable('name', 'line'))
|
|
369
371
|
])
|
|
370
372
|
```
|
|
@@ -485,6 +487,21 @@ t.generate_script('my_template.py') # generated python script will be written
|
|
|
485
487
|
|
|
486
488
|
This feature is useful for getting a text representation of existing templates.
|
|
487
489
|
|
|
490
|
+
|
|
491
|
+
### Inserting Codeblocks
|
|
492
|
+
|
|
493
|
+
Use the `insert` method to insert additional codeblocks into an existing template. By default, codeblocks will be added to the end of the template.
|
|
494
|
+
|
|
495
|
+
```py
|
|
496
|
+
from dfpyre import *
|
|
497
|
+
|
|
498
|
+
my_template = player_event('Join', [
|
|
499
|
+
player_action('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
500
|
+
])
|
|
501
|
+
my_template.insert(player_action('SendMessage', 'Welcome!')) # Add a new codeblock to the end
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
|
|
488
505
|
### Function List
|
|
489
506
|
|
|
490
507
|
- **Events / Function / Process**
|
|
@@ -500,7 +517,7 @@ This feature is useful for getting a text representation of existing templates.
|
|
|
500
517
|
- game_action
|
|
501
518
|
- entity_action
|
|
502
519
|
|
|
503
|
-
- **
|
|
520
|
+
- **Control Flow**
|
|
504
521
|
- if_player
|
|
505
522
|
- if_variable
|
|
506
523
|
- if_game
|
|
@@ -21,8 +21,10 @@ This module works best with [CodeClient](https://modrinth.com/mod/codeclient) in
|
|
|
21
21
|
- All code item types
|
|
22
22
|
- Direct sending to DF via recode or codeclient
|
|
23
23
|
- Automatic type conversion (int to num, str to text)
|
|
24
|
+
- Auto completed action names (if your IDE supports type hints)
|
|
24
25
|
- Warnings for unrecognized actions and tags
|
|
25
|
-
-
|
|
26
|
+
- Shorthand format for variables
|
|
27
|
+
- Convert existing templates into equivalent Python code (see [Script Generation](#script-generation))
|
|
26
28
|
|
|
27
29
|
## Documentation
|
|
28
30
|
## Basics
|
|
@@ -98,7 +100,7 @@ The following program sends a message to all players and gives a player 10 apple
|
|
|
98
100
|
from dfpyre import *
|
|
99
101
|
|
|
100
102
|
player_event('Join', [
|
|
101
|
-
player_action('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
103
|
+
player_action('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS),
|
|
102
104
|
player_action('GiveItems', Item('apple', 10))
|
|
103
105
|
]).build_and_send('codeclient')
|
|
104
106
|
```
|
|
@@ -346,7 +348,7 @@ Example:
|
|
|
346
348
|
from dfpyre import *
|
|
347
349
|
|
|
348
350
|
name_parameter = parameter('name', ParameterType.TEXT)
|
|
349
|
-
function('SayHi', name_parameter codeblocks=[
|
|
351
|
+
function('SayHi', name_parameter, codeblocks=[
|
|
350
352
|
player_action('SendMessage', 'Hello, ', Variable('name', 'line'))
|
|
351
353
|
])
|
|
352
354
|
```
|
|
@@ -467,6 +469,21 @@ t.generate_script('my_template.py') # generated python script will be written
|
|
|
467
469
|
|
|
468
470
|
This feature is useful for getting a text representation of existing templates.
|
|
469
471
|
|
|
472
|
+
|
|
473
|
+
### Inserting Codeblocks
|
|
474
|
+
|
|
475
|
+
Use the `insert` method to insert additional codeblocks into an existing template. By default, codeblocks will be added to the end of the template.
|
|
476
|
+
|
|
477
|
+
```py
|
|
478
|
+
from dfpyre import *
|
|
479
|
+
|
|
480
|
+
my_template = player_event('Join', [
|
|
481
|
+
player_action('SendMessage', '%default has joined!', target=Target.ALL_PLAYERS)
|
|
482
|
+
])
|
|
483
|
+
my_template.insert(player_action('SendMessage', 'Welcome!')) # Add a new codeblock to the end
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
|
|
470
487
|
### Function List
|
|
471
488
|
|
|
472
489
|
- **Events / Function / Process**
|
|
@@ -482,7 +499,7 @@ This feature is useful for getting a text representation of existing templates.
|
|
|
482
499
|
- game_action
|
|
483
500
|
- entity_action
|
|
484
501
|
|
|
485
|
-
- **
|
|
502
|
+
- **Control Flow**
|
|
486
503
|
- if_player
|
|
487
504
|
- if_variable
|
|
488
505
|
- if_game
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
PLAYER_ACTION_ACTION = Literal['SetHotbar', 'SetReducedDebug', 'CloseInv', 'GiveItems', 'NoKeepInv', 'SetHandCrafting', 'BossBar', 'SetBossBar', 'ParticleSphere', 'SetVelocity', 'Particle', 'AddInvRow', 'NoNatRegen', 'DisplayLightning', 'Damage', 'SendAnimation', 'SetXPProg', 'SetInventory', 'TpSequence', 'Heal', 'SetSpawnPoint', 'SetInventoryKept', 'LaunchUp', 'GetTargetEntity', 'ForceFlight', 'LoadInv', 'ChatStyle', 'ChatColor', 'Kick', 'ProjColl', 'MiscAttribute', 'SpectateTarget', 'HurtAnimation', 'SurvivalMode', 'GmSurvival', 'DisplayBellRing', 'SetStatus', 'SetCursorItem', 'SetAbsorption', 'SetFireTicks', 'CombatAttribute', 'SetGamemode', 'RemoveInvRow', 'WakeUpAnimation', 'DisableBlocks', 'SetScoreObj', 'L SetHealth', 'ParticleEffect', 'ClearInv', 'SetFreezeTicks', 'SetGliding', 'SetRotation', 'ClearItems', 'SetFlying', 'DisplayBlockOpen', 'SetHandItem', 'SendAdvancement', 'ClearChat', 'SetMenuItem', 'LaunchToward', 'SetArmor', 'DisplayGateway', 'GiveSaturation', 'DisplayEquipment', 'GiveExp', 'FaceLocation', 'ClearScoreboard', 'ActionBar', 'SetChatTag', 'ShiftWorldBorder', 'DisplaySignText', 'SetSpeed', 'ExpandInv', 'LaunchProj', 'NoProjColl', 'ShowDisguise', 'ParticleCuboidA', 'PlaySound', 'SetCompass', 'MobDisguise', 'EnableBlocks', 'OpenBlockInv', 'ParticleCircleA', 'RemoveBossBar', 'ClearBars', 'SetEquipment', 'GiveRngItem', 'SetDropsEnabled', 'SendToPlot', 'RemovePotion', 'RemoveEffect', 'DisplayFracture', 'SetEntityHidden', 'SetSidebar', 'AllowDrops', 'Vibration', 'SetSlot', 'ParticleRay', 'ParticleCuboid', 'SendMessageSeq', 'SendDialogue', 'SetNamePrefix', 'ClearDispBlock', 'SetRainLevel', 'Undisguise', 'ParticleSpiralA', 'InstantRespawn', 'SetScore', 'SetNameColor', 'ReachAttribute', 'SetAtkSpeed', 'DisablePvp', 'SetTickRate', 'PlayEntitySound', 'ReplaceProj', 'SetExp', 'MiningAttribute', 'KBAttribute', 'MovementAttribute', 'ParticleSpiral', 'FallingAttribute', 'SetAllowFlight', 'SetMaxHealth', ' RemoveBossBar ', 'SetFogDistance', 'AdventureMode', 'GmAdventure', 'SpectatorMode', 'DispHeadTexture', 'ClearPotions', 'ClearEffects', 'SetTabListInfo', 'EnablePvp', 'HideDisguise', 'ScoreLineFormat', ' SetBossBar ', 'SetSkin', 'SpectatorCollision', 'SetNameVisible', 'SetInvulTicks', 'EnableFlight', 'SetStingsStuck', 'RemoveScore', 'DisallowDrops', 'SetExhaustion', 'ParticleCircle', 'DisplayBlock', 'RideEntity', 'WeatherRain', 'RmWorldBorder', 'ResourcePack', ' SetInvName ', 'GiveExhaustion', 'Teleport', 'SetAllowPVP', 'DisableFlight', 'SetVisualFire', 'SetDisguiseVisible', 'SetArrowsStuck', 'GetItemCooldown', 'SetItems', 'KeepInv', 'ReplaceItems', 'ReplaceItem', 'SendMessage', 'SetSlotItem', 'PlaySoundSeq', 'ParticleLineA', 'Respawn', 'SetInvName', 'SetItemCooldown', 'SetPlayerWeather', 'SendHover', 'SetShoulder', 'SetAirTicks', 'DisplayPickup', 'SetWorldBorder', 'SetPlayerTime', 'GiveFood', 'NatRegen', 'GivePotion', 'GiveEffect', 'RemoveItems', 'BoostElytra', 'SaveInv', 'OpenBook', 'SetHealth', 'BlockDisguise', 'RollbackBlocks', 'NoDeathDrops', 'WalkSpeed', 'SetCollidable', 'LaunchFwd', 'SetFallDistance', 'CreativeMode', 'AttackAnimation', 'DisplayHologram', ' SetAbsorption ', 'DeathDrops', 'ShowInv', 'SetFoodLevel', 'PlayerDisguise', 'SetSaturation', 'WeatherClear', 'SendTitle', 'Title', 'ScoreDefFormat', 'StopSound', 'HealthAttribute', 'ParticleLine']
|
|
4
|
+
ENTITY_ACTION_ACTION = Literal['DispRotationEuler', 'Shear', 'SetVelocity', 'SetGlowSquidDark', 'SetFrogType', 'DispRotAxisAngle', 'Damage', 'SetMobSitting', 'SendAnimation', 'DisableGlowing', 'SetWardenAnger', 'SetHorsePattern', 'Heal', 'SetPandaSadTicks', 'SetItemOwner', 'SetDyeColor', 'LaunchUp', 'SetAge', ' SetName ', 'NoGravity', 'SetArmsRaised', 'SetMoveSpeed', 'SetInvulnerable', 'SetFriction', 'ProjColl', 'ArmorStandTags', 'SetPickupDelay', 'DropItems', 'MiscAttribute', 'SetCreeperPower', 'SetMarker', 'RemoveCustomTag', 'SetAbsorption', 'CreeperCharged', 'SetFireTicks', 'CombatAttribute', 'SetName', 'Jump', 'BDisplayBlock', 'SetFreezeTicks', 'TDisplaySeeThru', 'SetGliding', 'SetRotation', 'SetPandaRolling', 'SetFishPattern', 'SetWolfType', 'DispInterpolation', 'SetHandItem', 'SetEndermanBlock', 'LaunchToward', 'SetArmor', ' SetArmor ', 'GetCustomTag', 'InteractionSize', 'FaceLocation', 'SetCatType', 'SetArrowDamage', 'DisplayScale', 'TDisplayAlign', 'LaunchProj', 'EnableAI', 'DisplayBillboard', 'NoProjColl', 'Tame', 'SetGoatScreaming', 'SetBeeStinger', 'MobDisguise', 'SetMinecartBlock', 'FoxSleeping', 'SetEquipment', 'SetSilenced', 'SetBeeNectar', 'AttachLead', 'RemovePotion', 'RemoveEffect', 'ShearSheep', 'ArmorStandSlots', 'SetAllayDancing', 'SetRabbitType', 'SetSize', 'ShowName', 'SetAngry', 'SetAngerTicks', 'Undisguise', 'SetDeathDrops', 'SetPersistent', 'ProjectileItem', 'SetNameColor', 'SetCarryingChest', 'SetParrotColor', 'DispTranslation', 'Remove', 'TDispBackground', 'DisplayCullingSize', 'HideName', 'SetAxolotlColor', 'GetAllEntityTags', 'SetAI', 'KBAttribute', 'MovementAttribute', 'SetRiptiding', 'SetArrowNoClip', 'FallingAttribute', 'SetProjSource', 'SetFoxLeaping', 'SetPandaGene', 'SetMaxHealth', 'SetFishingTime', 'EndCrystalBeam', 'FrogEat', 'DisplayBrightness', 'SetProfession', 'ClearPotions', 'ClearEffects', 'ArmorStandParts', ' SetNameVisible ', 'SetTarget', 'TDisplayShadow', 'SetNameVisible', 'SetInvulTicks', 'SetShulkerPeek', ' SetPose ', 'SetRearing', 'SetCloudRadius', 'SetGravity', 'DispTPDuration', 'SetWitherInvul', 'Silence', 'SetArrowPierce', 'DisplayShadow', 'InteractResponse', 'UseItem', 'RideEntity', 'DisplayMatrix', 'NoDrops', 'SnifferState', 'EnableGlowing', 'Teleport', 'DisplayGlowColor', 'SetVisualFire', 'SetAge/Size', 'L SetArmor', 'SetSaddle', 'SetBulletTarget', 'TDisplayLineWidth', 'SetDragonPhase', 'SetLlamaColor', 'SetVillagerBiome', 'SetCreeperFuse', 'SetBaby', 'MooshroomType', 'SetInvisible', 'SheepEat', 'SetCatResting', 'GivePotion', 'GiveEffect', 'SetGoatHorns', 'SetGlowing', 'SetPandaOnBack', 'IDisplayModelType', 'SetHealth', 'BlockDisguise', 'SetCollidable', 'ArmorStandPose', 'SetPose', 'LaunchFwd', 'SetFallDistance', 'MoveToLoc', 'TDisplayOpacity', 'IDisplayItem', 'AttackAnimation', 'SnowmanPumpkin', 'SetCustomTag', 'Gravity', 'DisplayViewRange', 'NoAI', 'PlayerDisguise', 'SetItem', 'Explode', 'ExplodeCreeper', 'SetDigging', 'MoveTo', 'SetArrowHitSound', 'SetVexCharging', 'SetVillagerExp', 'IgniteCreeper', 'SetCelebrating', 'TDisplayText', 'SetHorseJump', 'Unsilence', 'HealthAttribute', 'Ram', 'SetFoxType']
|
|
5
|
+
GAME_ACTION_ACTION = Literal['FillContainer', 'BreakBlock', 'L PFX Spiral', 'ParticleSphere', 'PFX Sphere', 'ChangeSign', 'WebRequest', 'ClearScBoard', 'HideSidebar', 'SpawnItemDisplay', 'WriteTransaction', 'ParticleSpiral', 'PFX Spiral', 'SetBlockData', 'Firework', 'SetEventDamage', 'SpawnItem', 'SignColor', 'ShulkerBullet', 'FireworkEffect', 'SetContainer', 'SpawnInteraction', 'SetItemInSlot', 'CloneRegion', 'CopyBlocks', 'UncancelEvent', 'SetLecternBook', 'SpawnArmorStand', 'SpawnBlockDisp', 'ClearContainer', 'CancelEvent', 'ParticleEffect', 'Particle FX', 'SpawnFangs', 'SetEventSound', 'SetEventXP', 'LockContainer', 'RemoveScore', 'CreateHologram', 'SetExhaustion', 'ParticleCircle', 'PFX Circle', 'PFX Line [A]', 'ClearItems', 'StartLoop', 'SetFurnaceSpeed', 'BlockDropsOn', 'BoneMeal', 'DebugStackTrace', 'FallingBlock', 'DiscordWebhook', 'TickBlock', 'ReplaceItems', 'SetEventProj', 'Explosion', 'SpawnMob', 'SetBrushableItem', 'ParticleLineA', 'SpawnEnderEye', 'ShowSidebar', 'SpawnPotionCloud', 'LaunchProj', ' SetBlock ', 'SpawnItemDisp', 'SetBlockGrowth', 'Wait', 'SetContainerName', 'SetHead', 'RemoveHologram', 'RemoveItems', 'SpawnRngItem', 'SetRegion', 'SetBlock', 'ParticleCircleA', 'PFX Circle [A]', 'SpawnTNT', 'SpawnExpOrb', 'SetBiome', 'SetEventHeal', 'PFX Path', 'ApplyTransaction', 'ParticleRay', 'PFX Ray', 'GenerateTree', 'StopLoop', 'SetScObj', 'SpawnCrystal', 'SetCampfireItem', 'SpawnTextDisplay', 'SpawnVehicle', 'Lightning', 'ParticleSpiralA', 'PFX Spiral [A]', 'SetScore', 'ParticleCluster', 'PFX Cluster', 'L PFX Cluster', 'BlockDropsOff', 'ParticleLine', 'PFX Line']
|
|
6
|
+
SET_VAR_ACTION = Literal['GetItemFood', 'String', 'Text', 'SetParticleType', 'SetItemEnchants', 'ClearItemTag', 'PurgeVars', 'ShiftAllAxes', 'ShiftLocCoord', 'GetParticleMat', 'SetParticleSprd', 'AbsoluteValue', 'AppendValue', '%', 'ShiftOnVector', 'AddVectorLoc', 'GetItemAttribute', 'ClearDict', '+', 'ShiftRotation', 'RotateLocation', '-', ' GetItemName ', 'GetItemRarity', 'MultiplyVector', '/', 'GetSignText', 'Bitwise', 'GetLecternPage', 'ParseX', 'ShiftOnAxis', 'ShiftAxis', 'ParseY', 'VectorBetween', 'ParseZ', 'GetVectorComp', '=', 'RmText', 'AddItemAttribute', 'GetCenterLoc', 'FindCenter', 'AlignLoc', 'GetSoundVolume', 'RandomNumber', 'ContainerName', 'Raycast', 'RotateAroundVec', 'SetItemFood', 'GetParticleMotion', 'SetParticleMotion', 'Average', 'WrapNumber', 'ClampLoc', 'SetY', 'SetMapTexture', 'GetBlockData', 'SetX', 'SortDict', 'GetLecternBook', 'GetCustomSound', 'CrossProduct', 'x', 'GetParticleRoll', 'ParseYaw', 'DotProduct', 'SetZ', 'SetArmorTrim', 'PopListValue', 'SetParticleOpac', 'Noise', 'MinNumber', 'MinValue', 'Min', 'GetPotionType', 'SetItemName', 'ListLength', 'Sine', 'DirectionName', 'RepeatString', 'DuplicateText', 'RepeatText', 'GetItemLore', 'JoinString', 'JoinText', 'ReverseList', 'DedupList', 'CreateDict', 'GetBlockByMCTag', 'RoundNumber', 'FaceLocation', 'GetItemLoreLine', 'SetVectorLength', 'SetPotionDur', 'BlockResistance', 'SplitString', 'SplitText', 'NormalRandom', 'SetPotionType', 'AlignVector', 'SetItemDura', 'SetBreakability', 'SetMaxAmount', ' GetSignText ', 'RaycastEntity', 'SetDictValue', 'SetAllCoords', 'RGBColor', 'SetCanDestroy', 'HSLColor', ' GetDirection ', ' GetItemLore ', 'RemoveListIndex', 'CellularNoise', 'Logarithm', 'SetItemTag', 'TrimString', 'TrimText', 'ParseMiniMessageExpr', 'GetItemAmount', 'SetPotionAmp', 'GetCanDestroy', 'RotateAroundAxis', 'GetItemName', 'GetItemDura', 'ShiftInDirection', 'WrapNum', 'ReplaceString', 'ReplaceText', 'SetItemGlowing', ' SetItemName ', 'SetLodestoneLoc', 'FlattenList', 'BlockHardness', 'GetPotionAmp', 'GetParticleAmount', 'GetDictSize', 'SetItemAmount', 'SubtractVectors', 'SetCase', 'SetParticleColor', 'GetLight', ' GetBookText ', 'GetDictValues', 'Vector', 'Distance', 'SetItemLore', 'Root', 'SquareRoot', 'SetParticleAmount', 'AddItemEnchant', 'AddItemToolRule', 'GetItemType', 'GetDirection', 'GetLoreLine', 'GetParticleType', 'SetItemMaxDura', 'RemoveString', 'RemoveText', 'GetAllBlockData', 'MaxNumber', 'MaxValue', 'Max', 'GetDictKeys', 'TrimStyledText', 'SetParticleMat', 'GetCoord', 'RemoveItemTag', 'SetParticleSize', 'GetPotionDur', 'RandomLoc', 'SetSoundType', 'GetLodestoneLoc', 'ShiftDirection', 'GetContainerName', 'GetParticleSprd', 'ReflectVector', 'GetHeadOwner', 'GetItemEnchants', 'AppendDict', 'GetMaxItemAmount', 'GetColorChannels', ' SetDirection ', 'SetListValue', ' SetItemEnchants ', 'SetBookText', 'RandomValue', 'RandomObj', ' SetItemFlags ', 'SetItemType', 'GetSoundType', 'GetListValue', 'BounceNum', 'Tangent', 'VoronoiNoise', 'SetDirection', 'FaceDirection', 'HSBColor', 'HSVColor', '+=', 'GetSoundVariant', 'GetItemColor', 'ClearFormatting', 'InsertListValue', 'InsertListIndex', 'SetSoundVolume', 'SetCoord', 'AddVectors', 'SetPitch', 'GetParticleFade', 'RaycastBlock', 'SetItemTool', ' GetItemEnchants ', 'SetHeadTexture', 'SetHeadOwner', 'PerlinNoise', 'WorleyNoise', 'SetItemColor', 'SetLeatherColor', 'GetParticleColor', 'SetSoundPitch', ' RoundNumber ', 'GetCanPlaceOn', 'SortList', 'SetCustomSound', 'RemoveDictEntry', 'FormatTime', 'SetItemFlags', 'StringLength', 'TextLength', 'GetItemEffects', 'StyledText', 'GetMiniMessageExpr', 'SetYaw', ' SetItemLore ', 'SetItemEffects', '-=', 'GetItemTag', 'CreateList', 'AppendList', 'GetContainerItems', 'ShiftToward', 'ShiftTowards', 'ShiftLocTowards', 'TrimList', 'GradientNoise', 'SetItemHideTooltip', 'GetBlockDrops', 'ClearEnchants', 'Cosine', 'GetParticleOpac', 'GetItemByMCTag', 'SetParticleFade', 'SetVectorComp', 'ParseNumber', 'Exponent', 'ShiftAllDirs', 'GetValueIndex', 'RemItemEnchant', 'AddItemLore', 'GetBookText', 'SetParticleRoll', 'SetSoundVariant', 'ShiftLocation', 'RandomizeList', 'ClampNumber', 'Round', 'GetSoundPitch', 'TranslateColors', 'GetBlockGrowth', 'GetAllItemTags', 'RemoveListValue', 'ShiftAllDirections', 'ValueNoise', 'SetCanPlaceOn', 'GetBlockType', 'ParsePitch', 'GetDictValue', 'ContainerLock', 'GetBlockPower', 'GetVectorLength', 'ContentLength', 'SetModelData', 'SetCoords', 'GetMaxAmount', 'GetParticleSize']
|
|
7
|
+
IF_PLAYER_ACTION = Literal['IsLookingAt', 'InWorldBorder', 'IsInGameMode', 'HasRoomForItem', 'PHasRoomForItem', 'IsHoldingOff', 'UsingPack', 'NoItemCooldown', 'IsUsingItem', 'HasAllItems', 'IsSwimming', 'HasItem', 'BlockEquals', 'IsWearing', 'PIsWearing', 'IsNear', 'PIsNear', 'IsRiding', 'StandingOn', 'PStandingOn', 'CmdEquals', ' StandingOn ', ' PStandingOn ', 'IsGrounded', 'CursorItem', 'SlotEquals', 'ItemEquals', 'IsHoldingMain', 'IsHolding', 'MenuSlotEquals', 'IsBlocking', 'HasPermission', ' IsRiding ', 'MainHandEquals', 'IsSneaking', 'IsFlying', 'HasPotion', 'HasEffect', 'NameEquals', 'PNameEquals', 'InvOpen', 'HasSlotItem', 'IsSprinting', 'IsGliding', 'CmdArgEquals']
|
|
8
|
+
IF_ENTITY_ACTION = Literal['IsVehicle', 'IsGrounded', 'EIsGrounded', 'IsType', 'IsProj', 'IsMob', 'HasCustomTag', 'IsSheared', 'IsItem', ' IsRiding ', 'Exists', 'IsNear', 'EIsNear', 'HasPotion', 'IsRiding', 'StandingOn', 'EStandingOn', 'NameEquals', 'ENameEquals', ' StandingOn ', ' EStandingOn ']
|
|
9
|
+
IF_GAME_ACTION = Literal['SignHasTxt', 'HasRoomForItem', 'EventBlockEquals', 'CommandEquals', 'EventItemEquals', ' SignHasTxt ', 'AttackIsCrit', 'ContainerHas', 'BlockEquals', 'GBlockEquals', 'InBlock', 'BlockPowered', 'HasPlayer', 'ContainerHasAll', 'CmdArgEquals', 'EventCancelled', 'IsChunkLoaded']
|
|
10
|
+
IF_VAR_ACTION = Literal['<=', 'ItemHasEnchant', 'ItemIsBlock', 'DictValueEquals', 'ItemHasTag', 'StringMatches', ' TextMatches ', 'ListIsEmpty', 'StartsWith', 'ListValueEq', 'VarIsType', 'TextMatches', 'EqIgnoreCase', 'IsNear', 'VIsNear', ' InRange ', 'VarExists', 'BlockIsSolid', 'ItemEquals', 'VItemEquals', 'ListContains', 'InRange', 'LocIsNear', 'Contains', '!=', '<', '=', ' = ', '>', 'EndsWith', '>=', 'DictHasKey']
|
|
11
|
+
REPEAT_ACTION = Literal['Adjacent', 'Path', 'Multiple', 'N Times', 'Grid', 'While', 'WhileCond', 'Range', 'ForEach', 'Sphere', 'Forever', ' Range ', 'ForEachEntry']
|
|
12
|
+
SELECT_OBJ_ACTION = Literal['LastMob', 'RandomPlayer', 'LastEntity', 'Shooter', 'AllMobs', 'EntityName', 'FilterRandom', 'RandomSelected', 'DefaultEntity', 'PlayerName', 'AllEntities', 'Damager', 'FilterDistance', 'FilterRay', 'Reset', 'None', 'EventTarget', 'Killer', 'Victim', 'EntitiesCond', 'AllPlayers', 'Invert', 'RandomEntity', 'FilterCondition', 'FilterSelect', 'MobsCond', 'FilterSort', 'Projectile', 'DefaultPlayer', 'PlayersCond', 'MobName']
|
|
13
|
+
CONTROL_ACTION = Literal['StopRepeat', 'Return', 'ReturnNTimes', 'Skip', 'End', 'Wait']
|
|
14
|
+
EVENT_ACTION = Literal['ClickContainerSlot', 'CloseInv', 'StartFly', 'BreakBlock', 'StartSprint', 'MobKillPlayer', 'Teleport', 'ShootBow', 'StopFly', 'TameEntity', 'LeftClick', 'PlayerTakeDmg', 'ProjHit', 'KillPlayer', 'VehicleJump', 'ClickInvSlot', 'ClickOwnInv', 'Respawn', 'SwapHands', 'PackLoad', 'DamageEntity', 'Sneak', 'PlayerHeal', 'ClickPlayer', 'Consume', 'Death', 'PlaceBlock', 'Walk', 'PickUpItem', 'PickupItem', 'Dismount', 'CloudImbuePlayer', 'Leave', 'Quit', 'DropItem', 'LeftClickPlayer', 'ChangeSlot', 'ClickEntity', 'HorseJump', 'ShootProjectile', 'Move', 'Unsneak', 'Fish', 'FishEvent', 'FallDamage', 'BreakItem', 'LoopEvent', 'PlayerResurrect', 'RightClick', 'ClickMenuSlot', 'ClickItem', 'Riptide', 'KillMob', 'Join', 'EntityDmgPlayer', 'StopSprint', 'Jump', 'LoadCrossbow', 'ProjDmgPlayer', 'Command', 'LeftClickEntity', 'Exhaustion', 'PackDecline', 'PlayerDmgPlayer']
|
|
15
|
+
ENTITY_EVENT_ACTION = Literal['EntityKillEntity', 'BlockFall', 'ProjKillEntity', 'EntityDmgEntity', 'FallingBlockLand', 'EntityResurrect', 'ItemMerge', 'EntityHeal', 'Teleport', 'ShootBow', 'EntityDmg', 'ProjDmgEntity', 'EntityExplode', 'EntityDeath', 'VehicleDamage', 'Transform', 'RegrowWool']
|
|
16
|
+
REPEAT_SUBACTION = IF_PLAYER_ACTION | IF_ENTITY_ACTION | IF_GAME_ACTION | IF_VAR_ACTION
|
|
@@ -13,6 +13,7 @@ from dfpyre.util import *
|
|
|
13
13
|
from dfpyre.items import *
|
|
14
14
|
from dfpyre.scriptgen import generate_script, GeneratorFlags
|
|
15
15
|
from dfpyre.actiondump import CODEBLOCK_DATA, get_default_tags
|
|
16
|
+
from dfpyre.action_literals import *
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
VARIABLE_TYPES = {'txt', 'comp', 'num', 'item', 'loc', 'var', 'snd', 'part', 'pot', 'g_val', 'vec', 'pn_el'}
|
|
@@ -290,6 +291,8 @@ class DFTemplate:
|
|
|
290
291
|
else:
|
|
291
292
|
self.codeblocks[index:index+len(insert_codeblocks)] = insert_codeblocks
|
|
292
293
|
elif isinstance(insert_codeblocks, CodeBlock):
|
|
294
|
+
if index == -1:
|
|
295
|
+
index = len(self.codeblocks)
|
|
293
296
|
self.codeblocks.insert(index, insert_codeblocks)
|
|
294
297
|
else:
|
|
295
298
|
raise PyreException('Expected CodeBlock or list[CodeBlock] to insert.')
|
|
@@ -349,7 +352,7 @@ def _assemble_template(starting_block: CodeBlock, codeblocks: list[CodeBlock], a
|
|
|
349
352
|
return DFTemplate(template_codeblocks, author)
|
|
350
353
|
|
|
351
354
|
|
|
352
|
-
def player_event(event_name:
|
|
355
|
+
def player_event(event_name: EVENT_ACTION, codeblocks: list[CodeBlock]=(), author: str|None=None) -> DFTemplate:
|
|
353
356
|
"""
|
|
354
357
|
Represents a Player Event codeblock.
|
|
355
358
|
|
|
@@ -361,7 +364,7 @@ def player_event(event_name: str, codeblocks: list[CodeBlock]=(), author: str|No
|
|
|
361
364
|
return _assemble_template(starting_block, codeblocks, author)
|
|
362
365
|
|
|
363
366
|
|
|
364
|
-
def entity_event(event_name:
|
|
367
|
+
def entity_event(event_name: ENTITY_EVENT_ACTION, codeblocks: list[CodeBlock]=[], author: str|None=None) -> DFTemplate:
|
|
365
368
|
"""
|
|
366
369
|
Represents an Entity Event codeblock.
|
|
367
370
|
|
|
@@ -421,7 +424,7 @@ def start_process(process_name: str, *args, tags: dict[str, str]={}) -> CodeBloc
|
|
|
421
424
|
return CodeBlock.new_data('start_process', process_name, args, tags)
|
|
422
425
|
|
|
423
426
|
|
|
424
|
-
def player_action(action_name:
|
|
427
|
+
def player_action(action_name: PLAYER_ACTION_ACTION, *args, target: Target=DEFAULT_TARGET, tags: dict[str, str]={}) -> CodeBlock:
|
|
425
428
|
"""
|
|
426
429
|
Represents a Player Action codeblock.
|
|
427
430
|
|
|
@@ -433,7 +436,7 @@ def player_action(action_name: str, *args, target: Target=DEFAULT_TARGET, tags:
|
|
|
433
436
|
return CodeBlock.new_action('player_action', action_name, args, tags, target=target)
|
|
434
437
|
|
|
435
438
|
|
|
436
|
-
def entity_action(action_name:
|
|
439
|
+
def entity_action(action_name: ENTITY_ACTION_ACTION, *args, target: Target=DEFAULT_TARGET, tags: dict[str, str]={}) -> CodeBlock:
|
|
437
440
|
"""
|
|
438
441
|
Represents an Entity Action codeblock.
|
|
439
442
|
|
|
@@ -445,7 +448,7 @@ def entity_action(action_name: str, *args, target: Target=DEFAULT_TARGET, tags:
|
|
|
445
448
|
return CodeBlock.new_action('entity_action', action_name, args, tags, target=target)
|
|
446
449
|
|
|
447
450
|
|
|
448
|
-
def game_action(action_name:
|
|
451
|
+
def game_action(action_name: GAME_ACTION_ACTION, *args, tags: dict[str, str]={}) -> CodeBlock:
|
|
449
452
|
"""
|
|
450
453
|
Represents a Game Action codeblock.
|
|
451
454
|
|
|
@@ -456,7 +459,7 @@ def game_action(action_name: str, *args, tags: dict[str, str]={}) -> CodeBlock:
|
|
|
456
459
|
return CodeBlock.new_action('game_action', action_name, args, tags)
|
|
457
460
|
|
|
458
461
|
|
|
459
|
-
def if_player(action_name:
|
|
462
|
+
def if_player(action_name: IF_PLAYER_ACTION, *args, target: Target=DEFAULT_TARGET, tags: dict[str, str]={}, inverted: bool=False, codeblocks: list[CodeBlock]=[]) -> list[CodeBlock]:
|
|
460
463
|
"""
|
|
461
464
|
Represents an If Player codeblock.
|
|
462
465
|
|
|
@@ -474,7 +477,7 @@ def if_player(action_name: str, *args, target: Target=DEFAULT_TARGET, tags: dict
|
|
|
474
477
|
CodeBlock.new_bracket('close', 'norm')
|
|
475
478
|
]
|
|
476
479
|
|
|
477
|
-
def if_entity(action_name:
|
|
480
|
+
def if_entity(action_name: IF_ENTITY_ACTION, *args, target: Target=DEFAULT_TARGET, tags: dict[str, str]={}, inverted: bool=False, codeblocks: list[CodeBlock]=[]) -> list[CodeBlock]:
|
|
478
481
|
"""
|
|
479
482
|
Represents an If Entity codeblock.
|
|
480
483
|
|
|
@@ -493,7 +496,7 @@ def if_entity(action_name: str, *args, target: Target=DEFAULT_TARGET, tags: dict
|
|
|
493
496
|
]
|
|
494
497
|
|
|
495
498
|
|
|
496
|
-
def if_game(action_name:
|
|
499
|
+
def if_game(action_name: IF_GAME_ACTION, *args, tags: dict[str, str]={}, inverted: bool=False, codeblocks: list[CodeBlock]=[]) -> list[CodeBlock]:
|
|
497
500
|
"""
|
|
498
501
|
Represents an If Game codeblock.
|
|
499
502
|
|
|
@@ -511,7 +514,7 @@ def if_game(action_name: str, *args, tags: dict[str, str]={}, inverted: bool=Fal
|
|
|
511
514
|
]
|
|
512
515
|
|
|
513
516
|
|
|
514
|
-
def if_variable(action_name:
|
|
517
|
+
def if_variable(action_name: IF_VAR_ACTION, *args, tags: dict[str, str]={}, inverted: bool=False, codeblocks: list[CodeBlock]=[]) -> list[CodeBlock]:
|
|
515
518
|
"""
|
|
516
519
|
Represents an If Variable codeblock.
|
|
517
520
|
|
|
@@ -543,7 +546,7 @@ def else_(codeblocks: list[CodeBlock]=[]) -> list[CodeBlock]:
|
|
|
543
546
|
]
|
|
544
547
|
|
|
545
548
|
|
|
546
|
-
def repeat(action_name:
|
|
549
|
+
def repeat(action_name: REPEAT_ACTION, *args, tags: dict[str, str]={}, sub_action: REPEAT_SUBACTION|None=None, inverted: bool=False, codeblocks: list[CodeBlock]=[]) -> CodeBlock:
|
|
547
550
|
"""
|
|
548
551
|
Represents a Repeat codeblock.
|
|
549
552
|
|
|
@@ -562,7 +565,7 @@ def repeat(action_name: str, *args, tags: dict[str, str]={}, sub_action: str|Non
|
|
|
562
565
|
]
|
|
563
566
|
|
|
564
567
|
|
|
565
|
-
def control(action_name:
|
|
568
|
+
def control(action_name: CONTROL_ACTION, *args, tags: dict[str, str]={}) -> CodeBlock:
|
|
566
569
|
"""
|
|
567
570
|
Represents a Control codeblock.
|
|
568
571
|
|
|
@@ -573,7 +576,7 @@ def control(action_name: str, *args, tags: dict[str, str]={}) -> CodeBlock:
|
|
|
573
576
|
return CodeBlock.new_action('control', action_name, args, tags)
|
|
574
577
|
|
|
575
578
|
|
|
576
|
-
def select_object(action_name:
|
|
579
|
+
def select_object(action_name: SELECT_OBJ_ACTION, *args, tags: dict[str, str]={}) -> CodeBlock:
|
|
577
580
|
"""
|
|
578
581
|
Represents a Select Object codeblock.
|
|
579
582
|
|
|
@@ -584,7 +587,7 @@ def select_object(action_name: str, *args, tags: dict[str, str]={}) -> CodeBlock
|
|
|
584
587
|
return CodeBlock.new_action('select_obj', action_name, args, tags)
|
|
585
588
|
|
|
586
589
|
|
|
587
|
-
def set_variable(action_name:
|
|
590
|
+
def set_variable(action_name: SET_VAR_ACTION, *args, tags: dict[str, str]={}) -> CodeBlock:
|
|
588
591
|
"""
|
|
589
592
|
Represents a Set Variable codeblock.
|
|
590
593
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "dfpyre"
|
|
3
|
-
version = "0.8.
|
|
3
|
+
version = "0.8.3"
|
|
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"
|
|
7
7
|
license = "MIT"
|
|
8
8
|
repository = "https://github.com/Amp63/pyre"
|
|
9
9
|
keywords = ["diamondfire", "minecraft", "template", "item"]
|
|
10
|
-
exclude = ['examples']
|
|
10
|
+
exclude = ['examples', 'extra']
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
[tool.poetry.dependencies]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|