dfpyre 0.4.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/__init__.py ADDED
@@ -0,0 +1 @@
1
+ from dfpyre.pyre import *
dfpyre/data/data.json ADDED
@@ -0,0 +1 @@
1
+ {"meta":{"version":"4.0.0","df_patch":"6.1","updated":"2023/12/29"},"player_action":{"GiveItems":[],"SetHotbar":[],"SetInventory":[],"SetSlotItem":[],"SetEquipment":[{"option":"Main hand","tag":"Equipment Slot","slot":26}],"SetArmor":[],"ReplaceItems":[],"RemoveItems":[],"ClearItems":[],"ClearInv":[{"option":"True","tag":"Clear Crafting and Cursor","slot":25},{"option":"Entire inventory","tag":"Clear Mode","slot":26}],"SetCursorItem":[],"SaveInv":[],"LoadInv":[],"SetItemCooldown":[],"SendMessage":[{"option":"True","tag":"Inherit Styles","slot":24},{"option":"Add spaces","tag":"Text Value Merging","slot":25},{"option":"Regular","tag":"Alignment Mode","slot":26}],"SendMessageSeq":[{"option":"Regular","tag":"Alignment Mode","slot":26}],"SendTitle":[],"ActionBar":[{"option":"True","tag":"Inherit Styles","slot":25},{"option":"No spaces","tag":"Text Value Merging","slot":26}],"OpenBook":[]," SetBossBar ":[{"option":"None","tag":"Sky Effect","slot":24},{"option":"Solid","tag":"Bar Style","slot":25},{"option":"Purple","tag":"Bar Color","slot":26}]," RemoveBossBar ":[],"SendAdvancement":[{"option":"Advancement","tag":"Toast Type","slot":26}],"SetTabListInfo":[{"option":"True","tag":"Inherit Styles","slot":24},{"option":"No spaces","tag":"Text Value Merging","slot":25},{"option":"Header","tag":"Player List Field","slot":26}],"PlaySound":[{"option":"Master","tag":"Sound Source","slot":26}],"StopSound":[{"option":"Master","tag":"Sound Source","slot":26}],"PlaySoundSeq":[{"option":"Master","tag":"Sound Source","slot":26}],"PlayEntitySound":[{"option":"True","tag":"Ignore Formatting","slot":25},{"option":"Master","tag":"Sound Source","slot":26}],"ShowInv":[],"ExpandInv":[],"SetMenuItem":[]," SetInvName ":[],"AddInvRow":[{"option":"Bottom row","tag":"New Row Position","slot":26}],"RemoveInvRow":[{"option":"Bottom row","tag":"Row to Remove","slot":26}],"CloseInv":[],"OpenBlockInv":[],"SetScoreObj":[],"SetSidebar":[{"option":"Enable","tag":"Sidebar","slot":26}],"SetScore":[],"RemoveScore":[],"ClearScoreboard":[],"Damage":[{"option":"True","tag":"Ignore Formatting","slot":26}],"Heal":[],"SetHealth":[],"SetMaxHealth":[{"option":"False","tag":"Heal Player to Max Health","slot":26}],"SetAbsorption":[],"SetFoodLevel":[],"GiveFood":[],"SetSaturation":[],"GiveSaturation":[],"GiveExp":[{"option":"Points","tag":"Give Experience","slot":26}],"SetExp":[{"option":"Level","tag":"Set Experience","slot":26}],"GivePotion":[{"option":"True","tag":"Show Icon","slot":24},{"option":"True","tag":"Overwrite Effect","slot":25},{"option":"Regular","tag":"Effect Particles","slot":26}],"RemovePotion":[],"ClearPotions":[],"SetSlot":[],"SetAtkSpeed":[],"SetFireTicks":[],"SetFreezeTicks":[{"option":"Disable","tag":"Ticking Locked","slot":26}],"SetAirTicks":[],"SetInvulTicks":[],"SetFallDistance":[],"SetSpeed":[{"option":"Ground speed","tag":"Speed Type","slot":26}],"SurvivalMode":[],"AdventureMode":[],"CreativeMode":[],"SpectatorMode":[],"SetAllowFlight":[{"option":"Enable","tag":"Allow Flight","slot":26}],"SetAllowPVP":[{"option":"Disable","tag":"PVP","slot":26}],"SetDropsEnabled":[{"option":"Enable","tag":"Spawn Death Drops","slot":26}],"SetInventoryKept":[{"option":"Enable","tag":"Inventory Kept","slot":26}],"SetCollidable":[{"option":"Disable","tag":"Collision","slot":26}],"EnableBlocks":[],"DisableBlocks":[],"InstantRespawn":[{"option":"Enable","tag":"Instant Respawn","slot":26}],"SetReducedDebug":[{"option":"True","tag":"Reduced Debug Info Enabled","slot":26}],"SetHandCrafting":[{"option":"Disable","tag":"Allow Hand Crafting","slot":26}],"Teleport":[{"option":"False","tag":"Keep Velocity","slot":25},{"option":"False","tag":"Keep Current Rotation","slot":26}],"LaunchUp":[{"option":"True","tag":"Add to Current Velocity","slot":26}],"LaunchFwd":[{"option":"True","tag":"Add to Current Velocity","slot":25},{"option":"Pitch and Yaw","tag":"Launch Axis","slot":26}],"LaunchToward":[{"option":"True","tag":"Add to Current Velocity","slot":25},{"option":"False","tag":"Ignore Distance","slot":26}],"RideEntity":[{"option":"True","tag":"Ignore Formatting","slot":26}],"SetFlying":[{"option":"Enable","tag":"Flying","slot":26}],"SetGliding":[{"option":"Enable","tag":"Gliding","slot":26}],"BoostElytra":[],"SetRotation":[],"FaceLocation":[],"SetVelocity":[{"option":"False","tag":"Add to Current Velocity","slot":26}],"SpectateTarget":[{"option":"True","tag":"Ignore Formatting","slot":26}],"SetSpawnPoint":[],"SpectatorCollision":[{"option":"Enable","tag":"Spectator Collision","slot":26}],"LaunchProj":[],"ResourcePack":[],"SetPlayerTime":[],"SetPlayerWeather":[{"option":"Downfall","tag":"Weather","slot":26}],"SetRainLevel":[],"SetCompass":[],"DisplayBlock":[],"DisplayFracture":[{"option":"True","tag":"Overwrite Previous Fracture","slot":26}],"DisplayBlockOpen":[{"option":"Open","tag":"Container State","slot":26}],"DisplayGateway":[{"option":"Initial beam","tag":"Animation Type","slot":26}],"DisplaySignText":[{"option":"Front","tag":"Sign Side","slot":24},{"option":"Black","tag":"Text Color","slot":25},{"option":"Disable","tag":"Glowing","slot":26}],"DisplayHologram":[],"SetFogDistance":[],"SetWorldBorder":[],"ShiftWorldBorder":[],"RmWorldBorder":[],"DisplayPickup":[{"option":"True","tag":"Ignore Formatting","slot":26}],"SetEntityHidden":[{"option":"True","tag":"Ignore Formatting","slot":25},{"option":"Enable","tag":"Hidden","slot":26}],"Particle":[],"ParticleLine":[],"ParticleLineA":[],"ParticleCircle":[],"ParticleCircleA":[],"ParticleCuboid":[{"option":"Wireframe","tag":"Fill Type","slot":26}],"ParticleCuboidA":[{"option":"Wireframe","tag":"Fill Type","slot":26}],"ParticleSpiral":[],"ParticleSpiralA":[],"ParticleSphere":[],"ParticleRay":[],"DisplayLightning":[],"Vibration":[],"MobDisguise":[],"PlayerDisguise":[],"BlockDisguise":[],"SetDisguiseVisible":[{"option":"Disable","tag":"Disguise Visible","slot":26}],"Undisguise":[],"SetChatTag":[],"ChatStyle":[],"SetNameColor":[{"option":"Black","tag":"Name Color","slot":26}],"SetNameVisible":[{"option":"Disable","tag":"Name Tag Visible","slot":26}],"SetNamePrefix":[{"option":"Prefix","tag":"Text Type","slot":26}],"SetArrowsStuck":[],"SetStingsStuck":[],"SetVisualFire":[{"option":"True","tag":"On Fire","slot":26}],"AttackAnimation":[{"option":"Swing main arm","tag":"Animation Arm","slot":26}],"HurtAnimation":[],"WakeUpAnimation":[],"SetStatus":[],"SetSkin":[],"SetShoulder":[{"option":"Remove","tag":"Type","slot":25},{"option":"Left","tag":"Shoulder","slot":26}],"RollbackBlocks":[],"Kick":[]},"entity_action":{"Heal":[],"SetHealth":[],"SetAbsorption":[],"SetMaxHealth":[{"option":"False","tag":"Heal Mob to Max Health","slot":26}],"Damage":[{"option":"True","tag":"Ignore Formatting","slot":26}],"SetFireTicks":[],"SetFreezeTicks":[{"option":"Disable","tag":"Ticking Locked","slot":26}],"SetInvulTicks":[],"GivePotion":[{"option":"True","tag":"Overwrite Effect","slot":25},{"option":"Regular","tag":"Effect Particles","slot":26}],"RemovePotion":[],"ClearPotions":[],"SetAge":[{"option":"Don't change","tag":"Age Lock","slot":26}],"SetFallDistance":[],"SetCreeperFuse":[],"SetCreeperPower":[],"SetCloudRadius":[],"SetVillagerExp":[],"SetWitherInvul":[],"SetHorseJump":[],"SetPickupDelay":[],"SetFishingTime":[],"SetWardenAnger":[{"option":"True","tag":"Ignore Formatting","slot":26}],"MobDisguise":[],"PlayerDisguise":[],"BlockDisguise":[],"Undisguise":[],"SetGlowing":[{"option":"Enable","tag":"Glowing","slot":26}],"SetDyeColor":[{"option":"White","tag":"Dye","slot":26}],"SetFishPattern":[{"option":"White","tag":"Pattern Color","slot":24},{"option":"White","tag":"Body Color","slot":25},{"option":"Kob","tag":"Pattern","slot":26}],"SetRabbitType":[{"option":"Brown","tag":"Skin Type","slot":26}],"SetCatType":[{"option":"Tabby","tag":"Skin Type","slot":26}],"MooshroomType":[{"option":"Red","tag":"Mooshroom Variant","slot":26}],"SetFoxType":[{"option":"Red","tag":"Fox Type","slot":26}],"SetParrotColor":[{"option":"Red","tag":"Parrot Color","slot":26}],"SetHorsePattern":[{"option":"Flaxen chestnut","tag":"Horse Color","slot":25},{"option":"Stockings and blaze","tag":"Horse Markings","slot":26}],"SetAxolotlColor":[{"option":"Pink","tag":"Axolotl Color","slot":26}],"SetLlamaColor":[{"option":"Brown","tag":"Llama Color","slot":26}],"SetFrogType":[{"option":"Temperate","tag":"Frog Type","slot":26}],"SetVillagerBiome":[{"option":"Desert","tag":"Biome","slot":26}],"SnowmanPumpkin":[{"option":"Disable","tag":"Pumpkin","slot":26}],"SetEndermanBlock":[],"SetMinecartBlock":[],"ArmorStandParts":[{"option":"Enable","tag":"Arms","slot":25},{"option":"Enable","tag":"Base Plate","slot":26}],"SetBeeNectar":[{"option":"Enable","tag":"Has Nectar","slot":26}],"ProjectileItem":[],"SetVisualFire":[{"option":"True","tag":"On Fire","slot":26}],"SendAnimation":[{"option":"Hurt animation","tag":"Animation Type","slot":26}],"AttackAnimation":[{"option":"Swing main arm","tag":"Animation Arm","slot":26}],"ArmorStandPose":[{"option":"Head","tag":"Armor Stand Part","slot":26}]," SetPose ":[{"option":"Standing","tag":"Pose","slot":26}],"SetFoxLeaping":[{"option":"Enable","tag":"Leaping","slot":26}],"SetArmsRaised":[{"option":"Enable","tag":"Arms Raised","slot":26}],"SetCatResting":[{"option":"Enable","tag":"Resting","slot":26}],"SetGlowSquidDark":[],"Teleport":[{"option":"False","tag":"Keep Current Rotation","slot":26}],"LaunchUp":[{"option":"True","tag":"Add to Current Velocity","slot":26}],"LaunchFwd":[{"option":"True","tag":"Add to Current Velocity","slot":25},{"option":"Pitch and Yaw","tag":"Launch Axis","slot":26}],"LaunchToward":[{"option":"True","tag":"Add to Current Velocity","slot":25},{"option":"False","tag":"Ignore Distance","slot":26}],"SetGliding":[{"option":"Enable","tag":"Gliding","slot":26}],"SetGravity":[{"option":"Disable","tag":"Gravity","slot":26}],"RideEntity":[{"option":"True","tag":"Ignore Formatting","slot":26}],"AttachLead":[{"option":"True","tag":"Ignore Formatting","slot":26}],"SetRotation":[],"SetVelocity":[{"option":"False","tag":"Add to Current Velocity","slot":26}],"SetName":[{"option":"False","tag":"Hide Name Tag","slot":26}],"SetNameVisible":[{"option":"Enable","tag":"Name Tag Visible","slot":26}],"SetNameColor":[{"option":"Black","tag":"Name Color","slot":26}],"SetAI":[{"option":"None","tag":"AI","slot":26}],"SetSilenced":[{"option":"Enable","tag":"Silenced","slot":26}],"SetDeathDrops":[{"option":"Enable","tag":"Has Death Drops","slot":26}],"SetCollidable":[{"option":"Disable","tag":"Collision","slot":26}],"SetInvulnerable":[{"option":"Enable","tag":"Invulnerable","slot":26}],"SetMobSitting":[{"option":"Enable","tag":"Is Sitting","slot":26}],"SetBaby":[{"option":"Enable","tag":"Baby","slot":26}],"SetSize":[],"SetSheepSheared":[{"option":"Enable","tag":"Sheared","slot":26}],"SetSaddle":[{"option":"Enable","tag":"Saddle","slot":26}],"SetCarryingChest":[{"option":"Enable","tag":"Carrying Chest","slot":26}],"ArmorStandSlots":[{"option":"Take, swap or place item","tag":"Interactions","slot":25},{"option":"All","tag":"Equipment Slot","slot":26}],"SetMarker":[{"option":"Enable","tag":"Marker","slot":26}],"SetAngry":[{"option":"Enable","tag":"Angry","slot":26}],"SetRearing":[{"option":"Enable","tag":"Rearing","slot":26}],"SetRiptiding":[{"option":"Enable","tag":"Riptiding","slot":26}],"CreeperCharged":[{"option":"Enable","tag":"Charged","slot":26}],"SetInvisible":[{"option":"Enable","tag":"Invisible","slot":26}],"SetGoatScreaming":[{"option":"Enable","tag":"Screams","slot":26}],"SetGoatHorns":[{"option":"No Change","tag":"Left Horn","slot":25},{"option":"No Change","tag":"Right Horn","slot":26}],"Tame":[],"EndCrystalBeam":[],"SetPandaGene":[{"option":"Both","tag":"Set Gene","slot":25},{"option":"Aggressive","tag":"Gene Type","slot":26}],"SetProfession":[{"option":"Armorer","tag":"Profession","slot":26}],"SetProjSource":[{"option":"True","tag":"Ignore Formatting","slot":26}],"SetPersistent":[{"option":"Enable","tag":"Persistent","slot":26}],"InteractionSize":[],"InteractResponse":[{"option":"Enable","tag":"Responsive","slot":26}],"SetCelebrating":[{"option":"Enable","tag":"Celebrate","slot":26}],"SetTarget":[{"option":"True","tag":"Ignore Formatting","slot":26}],"MoveToLoc":[],"Jump":[],"Ram":[{"option":"True","tag":"Ignore Formatting","slot":26}],"FrogEat":[{"option":"True","tag":"Ignore Formatting","slot":26}],"SheepEat":[],"IgniteCreeper":[],"Explode":[],"FoxSleeping":[{"option":"Enable","tag":"Sleeping","slot":26}],"SetDragonPhase":[{"option":"Flying","tag":"Phase","slot":26}],"SetBulletTarget":[{"option":"True","tag":"Ignore Formatting","slot":26}],"UseItem":[{"option":"Main Hand","tag":"Hand","slot":25},{"option":"Enable","tag":"Use Item","slot":26}],"SetAllayDancing":[{"option":"Enable","tag":"Dancing","slot":26}],"SnifferState":[{"option":"Idle","tag":"Behavior","slot":26}],"DisplayViewRange":[],"DisplayBillboard":[{"option":"Fixed","tag":"Billboard Type","slot":26}],"DisplayShadow":[],"DisplayBrightness":[],"DispInterpolation":[],"DisplayCullingSize":[],"TDisplayText":[{"option":"True","tag":"Inherit Styles","slot":25},{"option":"No spaces","tag":"Text Value Merging","slot":26}],"TDisplayLineWidth":[],"TDisplayOpacity":[],"TDisplayAlign":[{"option":"Center","tag":"Text Alignment","slot":26}],"TDisplayShadow":[{"option":"Enable","tag":"Text Shadow","slot":26}],"TDisplaySeeThru":[{"option":"Enable","tag":"See-through","slot":26}],"TDispBackground":[],"DisplayGlowColor":[],"IDisplayItem":[],"IDisplayModelType":[{"option":"None","tag":"Model Type","slot":26}],"BDisplayBlock":[],"DisplayMatrix":[],"DispRotationEuler":[{"option":"Left Rotation","tag":"Rotation Type","slot":26}],"DispRotAxisAngle":[{"option":"Left Rotation","tag":"Rotation Type","slot":26}],"DispTranslation":[],"DisplayScale":[],"Remove":[],"SetEquipment":[{"option":"Main hand","tag":"Equipment Slot","slot":26}],"SetArmor":[],"LaunchProj":[],"ShearSheep":[],"SetCustomTag":[],"GetCustomTag":[],"RemoveCustomTag":[],"SetItem":[],"SetDigging":[{"option":"Emerge","tag":"Digging Type","slot":26}]},"game_action":{"SpawnMob":[],"SpawnItem":[{"option":"True","tag":"Apply Item Motion","slot":26}],"SpawnVehicle":[],"SpawnExpOrb":[],"Explosion":[],"SpawnTNT":[],"SpawnFangs":[],"Firework":[{"option":"False","tag":"Instant","slot":25},{"option":"Upwards","tag":"Movement","slot":26}],"LaunchProj":[],"Lightning":[],"SpawnPotionCloud":[],"FallingBlock":[{"option":"True","tag":"Reform on Impact","slot":25},{"option":"False","tag":"Hurt Hit Entities","slot":26}],"SpawnArmorStand":[{"option":"Visible","tag":"Visibility","slot":26}],"SpawnCrystal":[{"option":"True","tag":"Show Bottom","slot":26}],"SpawnEnderEye":[{"option":"Random","tag":"End of Lifespan","slot":26}],"ShulkerBullet":[],"SpawnTextDisplay":[{"option":"True","tag":"Inherit Styles","slot":25},{"option":"No spaces","tag":"Text Value Merging","slot":26}],"SpawnItemDisp":[],"SpawnBlockDisp":[],"SpawnInteraction":[{"option":"Disable","tag":"Responsive","slot":26}]," SetBlock ":[],"SetRegion":[],"CloneRegion":[{"option":"False","tag":"Ignore Air","slot":25},{"option":"True","tag":"Clone Block Entities","slot":26}],"BreakBlock":[],"SetBlockData":[{"option":"False","tag":"Overwrite Existing Data","slot":26}],"TickBlock":[],"BoneMeal":[{"option":"True","tag":"Show Particles","slot":26}],"GenerateTree":[{"option":"Oak Tree","tag":"Tree Type","slot":26}],"SetBlockGrowth":[{"option":"Growth Stage Number","tag":"Growth Unit","slot":26}],"FillContainer":[],"SetContainer":[],"SetItemInSlot":[],"ReplaceItems":[],"RemoveItems":[],"ClearItems":[],"ClearContainer":[],"SetContainerName":[],"LockContainer":[],"ChangeSign":[{"option":"Front","tag":"Sign Side","slot":26}],"SignColor":[{"option":"Front","tag":"Sign Side","slot":24},{"option":"Black","tag":"Text Color","slot":25},{"option":"Disable","tag":"Glowing","slot":26}],"SetHead":[],"SetFurnaceSpeed":[],"SetCampfireItem":[{"option":"1","tag":"Campfire Slot","slot":26}],"SetLecternBook":[],"SetBrushableItem":[],"CancelEvent":[],"UncancelEvent":[],"SetEventDamage":[],"SetEventHeal":[],"SetEventXP":[],"SetEventProj":[],"SetEventSound":[],"BlockDropsOn":[],"BlockDropsOff":[],"WebRequest":[{"option":"Post","tag":"Request Method","slot":25},{"option":"text/plain","tag":"Content Type","slot":26}],"DiscordWebhook":[]},"set_var":{"=":[],"RandomValue":[],"PurgeVars":[{"option":"Full word(s) in name","tag":"Match Requirement","slot":25},{"option":"False","tag":"Ignore Case","slot":26}],"+":[],"-":[],"x":[],"/":[{"option":"Default","tag":"Division Mode","slot":26}],"%":[{"option":"Remainder","tag":"Remainder Mode","slot":26}],"+=":[],"-=":[],"Exponent":[],"Root":[],"Logarithm":[],"ParseNumber":[],"AbsoluteValue":[],"ClampNumber":[],"WrapNum":[],"Average":[],"RandomNumber":[{"option":"Whole number","tag":"Rounding Mode","slot":26}]," RoundNumber ":[{"option":"Nearest","tag":"Round Mode","slot":26}],"MinNumber":[],"MaxNumber":[],"NormalRandom":[{"option":"Normal","tag":"Distribution","slot":26}],"Sine":[{"option":"Sine","tag":"Sine Variant","slot":25},{"option":"Degrees","tag":"Input","slot":26}],"Cosine":[{"option":"Cosine","tag":"Cosine Variant","slot":25},{"option":"Degrees","tag":"Input","slot":26}],"Tangent":[{"option":"Tangent","tag":"Tangent Variant","slot":25},{"option":"Degrees","tag":"Input","slot":26}],"PerlinNoise":[{"option":"Brownian","tag":"Fractal Type","slot":26}],"VoronoiNoise":[{"option":"Euclidean","tag":"Cell Edge Type","slot":26}],"WorleyNoise":[{"option":"Euclidean","tag":"Cell Edge Type","slot":25},{"option":"Primary","tag":"Distance Calculation","slot":26}],"Bitwise":[{"option":"|","tag":"Operator","slot":26}],"String":[{"option":"No spaces","tag":"Text Value Merging","slot":26}],"ReplaceString":[{"option":"All occurrences","tag":"Replacement Type","slot":25},{"option":"Disable","tag":"Regular Expressions","slot":26}],"RemoveString":[{"option":"Disable","tag":"Regular Expressions","slot":26}],"TrimString":[],"SplitString":[],"JoinString":[],"SetCase":[{"option":"UPPERCASE","tag":"Capitalization Type","slot":26}],"StringLength":[],"RepeatString":[],"FormatTime":[{"option":"2020/08/17 17:20:54","tag":"Format","slot":26}],"TranslateColors":[{"option":"From & to color","tag":"Translation Type","slot":26}],"StyledText":[{"option":"True","tag":"Inherit Styles","slot":25},{"option":"No spaces","tag":"Text Value Merging","slot":26}],"ClearFormatting":[],"GetMiniMessageExpr":[],"ParseMiniMessageExpr":[{"option":"False","tag":"Parse Legacy Color Codes","slot":25},{"option":"Style Only","tag":"Allowed Tags","slot":26}],"TrimStyledText":[],"ContentLength":[],"GetCoord":[{"option":"Plot coordinate","tag":"Coordinate Type","slot":25},{"option":"X","tag":"Coordinate","slot":26}],"SetCoord":[{"option":"Plot coordinate","tag":"Coordinate Type","slot":25},{"option":"X","tag":"Coordinate","slot":26}],"SetAllCoords":[{"option":"Plot coordinate","tag":"Coordinate Type","slot":26}],"ShiftOnAxis":[{"option":"X","tag":"Coordinate","slot":26}],"ShiftAllAxes":[],"ShiftInDirection":[{"option":"Forward","tag":"Direction","slot":26}],"ShiftAllDirections":[],"ShiftToward":[],"ShiftOnVector":[{"option":"False","tag":"Add Location Rotation","slot":26}],"GetDirection":[]," SetDirection ":[],"ShiftRotation":[{"option":"Pitch","tag":"Rotation Axis","slot":26}],"FaceLocation":[{"option":"Toward location","tag":"Face Direction","slot":26}],"AlignLoc":[{"option":"Keep rotation","tag":"Rotation","slot":24},{"option":"All coordinates","tag":"Coordinates","slot":25},{"option":"Block center","tag":"Alignment Mode","slot":26}],"Distance":[{"option":"Distance 3D (X/Y/Z)","tag":"Distance Type","slot":26}],"GetCenterLoc":[],"RandomLoc":[],"GetItemType":[{"option":"Item ID (golden_apple)","tag":"Return Value Type","slot":26}],"SetItemType":[]," GetItemName ":[]," SetItemName ":[]," GetItemLore ":[],"GetLoreLine":[]," SetItemLore ":[],"GetItemAmount":[],"SetItemAmount":[],"GetMaxItemAmount":[],"GetItemDura":[{"option":"Get Damage","tag":"Durability Type","slot":26}],"SetItemDura":[{"option":"Set Damage","tag":"Durability Type","slot":26}],"SetBreakability":[{"option":"Unbreakable","tag":"Breakability","slot":26}]," GetItemEnchants ":[]," SetItemEnchants ":[],"AddItemEnchant":[],"RemItemEnchant":[],"GetHeadOwner":[{"option":"Owner Name","tag":"Text Value","slot":26}],"SetHeadTexture":[]," GetBookText ":[],"SetBookText":[],"GetItemTag":[],"GetAllItemTags":[],"SetItemTag":[],"RemoveItemTag":[],"ClearItemTag":[],"SetModelData":[],"GetItemEffects":[],"SetItemEffects":[],"SetItemFlags":[{"option":"No Change","tag":"Hide Armor Trim","slot":19},{"option":"No Change","tag":"Hide Color","slot":20},{"option":"No Change","tag":"Hide Enchantments","slot":21},{"option":"No Change","tag":"Hide Attributes","slot":22},{"option":"No Change","tag":"Hide Unbreakable","slot":23},{"option":"No Change","tag":"Hide Can Destroy","slot":24},{"option":"No Change","tag":"Hide Can Place On","slot":25},{"option":"No Change","tag":"Hide Potion Effects","slot":26}],"GetCanPlaceOn":[],"SetCanPlaceOn":[],"GetCanDestroy":[],"SetCanDestroy":[],"GetItemRarity":[],"GetLodestoneLoc":[],"SetLodestoneLoc":[{"option":"False","tag":"Require Lodestone at Location","slot":26}],"SetArmorTrim":[{"option":"None","tag":"Trim Pattern","slot":25},{"option":"Amethyst","tag":"Trim Material","slot":26}],"GetItemColor":[],"SetItemColor":[],"GetItemAttribute":[{"option":"Armor","tag":"Attribute","slot":25},{"option":"Any","tag":"Active Equipment Slot","slot":26}],"AddItemAttribute":[{"option":"Armor","tag":"Attribute","slot":24},{"option":"Add number","tag":"Operation","slot":25},{"option":"Main hand","tag":"Active Equipment Slot","slot":26}],"SetMapTexture":[],"CreateList":[],"AppendValue":[],"AppendList":[],"GetListValue":[],"PopListValue":[],"SetListValue":[],"GetValueIndex":[{"option":"Ascending (first index)","tag":"Search Order","slot":26}],"ListLength":[],"InsertListValue":[],"RemoveListValue":[],"RemoveListIndex":[],"DedupList":[],"TrimList":[],"SortList":[{"option":"Ascending","tag":"Sort Order","slot":26}],"ReverseList":[],"RandomizeList":[],"FlattenList":[],"CreateDict":[],"SetDictValue":[],"GetDictValue":[],"GetDictSize":[],"RemoveDictEntry":[],"ClearDict":[],"GetDictKeys":[],"GetDictValues":[],"AppendDict":[],"SortDict":[{"option":"Sort by Key","tag":"Sorting Type","slot":25},{"option":"Ascending","tag":"Sorting Order","slot":26}],"GetBlockType":[{"option":"Block ID (oak_log)","tag":"Return Value Type","slot":26}],"GetBlockData":[],"GetAllBlockData":[{"option":"True","tag":"Hide Default","slot":26}],"GetBlockGrowth":[{"option":"Growth stage number","tag":"Growth Unit","slot":26}],"GetBlockPower":[],"GetLight":[{"option":"Combined light","tag":"Light Type","slot":26}]," GetSignText ":[{"option":"Front","tag":"Sign Side","slot":25},{"option":"1","tag":"Sign Line","slot":26}],"ContainerName":[],"ContainerLock":[],"GetContainerItems":[{"option":"False","tag":"Ignore Empty Slots","slot":26}],"GetLecternBook":[],"GetLecternPage":[],"Raycast":[{"option":"False","tag":"Entity Collision","slot":25},{"option":"All blocks","tag":"Block Collision","slot":26}],"GetParticleType":[],"SetParticleType":[],"GetParticleAmount":[],"SetParticleAmount":[],"GetParticleSprd":[{"option":"Horizontal","tag":"Spread","slot":26}],"SetParticleSprd":[],"GetParticleSize":[],"SetParticleSize":[],"GetParticleMat":[],"SetParticleMat":[],"GetParticleColor":[],"SetParticleColor":[],"GetParticleMotion":[],"SetParticleMotion":[],"GetParticleRoll":[],"SetParticleRoll":[],"Vector":[],"VectorBetween":[],"GetVectorComp":[{"option":"X","tag":"Component","slot":26}],"SetVectorComp":[{"option":"X","tag":"Component","slot":26}],"GetVectorLength":[{"option":"Length","tag":"Length Type","slot":26}],"SetVectorLength":[],"MultiplyVector":[],"AddVectors":[],"SubtractVectors":[],"AlignVector":[],"RotateAroundAxis":[{"option":"X","tag":"Axis","slot":25},{"option":"Degrees","tag":"Angle Units","slot":26}],"RotateAroundVec":[{"option":"Degrees","tag":"Angle Units","slot":26}],"ReflectVector":[],"CrossProduct":[],"DotProduct":[],"DirectionName":[],"GetPotionType":[],"SetPotionType":[],"GetPotionAmp":[],"SetPotionAmp":[],"GetPotionDur":[],"SetPotionDur":[],"GetSoundType":[],"SetSoundType":[],"GetSoundVariant":[],"SetSoundVariant":[],"GetCustomSound":[],"SetCustomSound":[],"GetSoundPitch":[{"option":"Pitch (number)","tag":"Return Value Type","slot":26}],"SetSoundPitch":[],"GetSoundVolume":[],"SetSoundVolume":[],"BlockHardness":[],"BlockResistance":[],"RGBColor":[],"HSBColor":[],"HSLColor":[],"GetColorChannels":[{"option":"RGB","tag":"Color Channels","slot":26}]},"if_player":{"IsSneaking":[],"IsSprinting":[],"IsGliding":[],"IsFlying":[],"IsGrounded":[],"IsSwimming":[],"IsBlocking":[],"UsingPack":[],"IsLookingAt":[{"option":"Ignore fluids","tag":"Fluid Mode","slot":26}]," StandingOn ":[],"IsNear":[{"option":"Sphere","tag":"Shape","slot":26}],"InWorldBorder":[],"IsHolding":[{"option":"Either hand","tag":"Hand Slot","slot":26}],"HasItem":[{"option":"Has Any Item","tag":"Check Mode","slot":26}],"IsWearing":[{"option":"Is Wearing Some","tag":"Check Mode","slot":26}],"IsUsingItem":[],"NoItemCooldown":[],"HasSlotItem":[],"MenuSlotEquals":[],"CursorItem":[],"HasRoomForItem":[{"option":"Main inventory","tag":"Checked Slots","slot":25},{"option":"Has Room for Any Item","tag":"Check Mode","slot":26}],"NameEquals":[],"SlotEquals":[],"HasPotion":[{"option":"None","tag":"Check Properties","slot":25},{"option":"Has any effect","tag":"Check Mode","slot":26}]," IsRiding ":[{"option":"True","tag":"Ignore Formatting","slot":26}],"InvOpen":[{"option":"Any Inventory","tag":"Inventory Type","slot":26}],"HasPermission":[{"option":"Developer or builder","tag":"Permission","slot":26}]},"if_entity":{"IsType":[],"NameEquals":[{"option":"True","tag":"Ignore Formatting","slot":26}]," StandingOn ":[],"IsGrounded":[],"IsNear":[{"option":"Sphere","tag":"Shape","slot":26}]," IsRiding ":[{"option":"True","tag":"Ignore Formatting","slot":26}],"HasPotion":[{"option":"None","tag":"Check Properties","slot":25},{"option":"Has any effect","tag":"Check Mode","slot":26}],"IsMob":[],"IsProj":[],"IsVehicle":[],"IsItem":[],"Exists":[],"HasCustomTag":[],"IsSheared":[]},"if_game":{"BlockEquals":[],"BlockPowered":[{"option":"Direct power","tag":"Redstone Power Mode","slot":26}],"ContainerHas":[],"ContainerHasAll":[],"HasRoomForItem":[{"option":"Has Room for Any Item","tag":"Check Mode","slot":26}]," SignHasTxt ":[{"option":"Contains","tag":"Check Mode","slot":24},{"option":"Front","tag":"Sign Side","slot":25},{"option":"All lines","tag":"Sign Line","slot":26}],"HasPlayer":[],"EventBlockEquals":[],"EventItemEquals":[{"option":"Ignore stack size/durability","tag":"Comparison Mode","slot":26}],"CommandEquals":[{"option":"True","tag":"Ignore Case","slot":25},{"option":"Check entire command","tag":"Check Mode","slot":26}],"CmdArgEquals":[{"option":"True","tag":"Ignore Case","slot":26}],"AttackIsCrit":[],"EventCancelled":[]},"if_var":{"=":[],"!=":[],">":[],">=":[],"<":[],"<=":[]," InRange ":[{"option":"Exact","tag":"Location Handling","slot":26}],"LocIsNear":[{"option":"Sphere","tag":"Shape","slot":26}],"StringMatches":[{"option":"False","tag":"Ignore Case","slot":25},{"option":"Disable","tag":"Regular Expressions","slot":26}],"Contains":[{"option":"False","tag":"Ignore Case","slot":26}],"StartsWith":[{"option":"False","tag":"Ignore Case","slot":26}],"EndsWith":[{"option":"False","tag":"Ignore Case","slot":26}],"VarExists":[],"VarIsType":[{"option":"Number","tag":"Variable Type","slot":26}],"ItemEquals":[{"option":"Exactly equals","tag":"Comparison Mode","slot":26}],"ItemHasTag":[],"ListContains":[{"option":"Has Any Value","tag":"Check Mode","slot":26}],"ListValueEq":[],"DictHasKey":[],"DictValueEquals":[]},"repeat":{"Forever":[],"While":[],"Multiple":[]," Range ":[],"ForEach":[{"option":"True","tag":"Allow List Changes","slot":26}],"ForEachEntry":[],"Grid":[],"Adjacent":[{"option":"False","tag":"Change Location Rotation","slot":24},{"option":"False","tag":"Include Origin Block","slot":25},{"option":"Adjacent (6 blocks)","tag":"Pattern","slot":26}],"Path":[{"option":"False","tag":"Rotate Location","slot":26}],"Sphere":[{"option":"False","tag":"Point Locations Inwards","slot":26}]},"select_obj":{"EventTarget":[{"option":"Default","tag":"Event Target","slot":26}],"RandomPlayer":[],"LastEntity":[],"PlayerName":[],"EntityName":[{"option":"True","tag":"Ignore Formatting","slot":26}],"AllPlayers":[],"AllEntities":[],"PlayersCond":[],"EntitiesCond":[],"Invert":[],"FilterCondition":[],"FilterRandom":[],"FilterDistance":[{"option":"False","tag":"Ignore Y-Axis","slot":25},{"option":"Nearest","tag":"Compare Mode","slot":26}],"FilterSort":[{"option":"Ascending","tag":"Sort Order","slot":26}],"FilterRay":[{"option":"Solid blocks","tag":"Block Collision","slot":26}],"Reset":[]},"control":{"Wait":[{"option":"Ticks","tag":"Time Unit","slot":26}],"Return":[],"End":[],"Skip":[],"StopRepeat":[]},"event":{"Join":[],"Leave":[],"Command":[],"RightClick":[],"LeftClick":[],"ClickEntity":[],"ClickPlayer":[],"PlaceBlock":[],"BreakBlock":[],"SwapHands":[],"ChangeSlot":[],"TameEntity":[],"Walk":[],"Jump":[],"Sneak":[],"Unsneak":[],"StartSprint":[],"StopSprint":[],"StartFly":[],"StopFly":[],"Riptide":[],"Dismount":[],"HorseJump":[],"VehicleJump":[],"ClickMenuSlot":[],"ClickInvSlot":[],"PickUpItem":[],"DropItem":[],"Consume":[],"BreakItem":[],"CloseInv":[],"Fish":[],"PlayerTakeDmg":[],"PlayerDmgPlayer":[],"DamageEntity":[],"EntityDamagePlayer":[],"PlayerHeal":[],"ShootBow":[],"ShootProjectile":[],"ProjHit":[],"ProjDmgPlayer":[],"CloudImbuePlayer":[],"Death":[],"KillPlayer":[],"PlayerResurrect":[],"KillMob":[],"MobKillPlayer":[],"Respawn":[],"PackLoad":[],"PackDecline":[],"LoadCrossbow":[]},"entity_event":{"EntityDmgEntity":[],"EntityKillEntity":[],"EntityDmg":[],"ProjDmgEntity":[],"ProjKillEntity":[],"EntityDeath":[],"EntityExplode":[],"VehicleDamage":[],"BlockFall":[],"FallingBlockLand":[],"EntityResurrect":[],"RegrowWool":[]},"extras":{"func":[{"item":{"id":"bl_tag","data":{"option":"False","tag":"Is Hidden","action":"dynamic","block":"func"}},"slot":26}],"process":[{"item":{"id":"bl_tag","data":{"option":"False","tag":"Is Hidden","action":"dynamic","block":"process"}},"slot":26}],"start_process":[{"item":{"id":"bl_tag","data":{"option":"Don't copy","tag":"Local Variables","action":"dynamic","block":"start_process"}},"slot":25},{"item":{"id":"bl_tag","data":{"option":"With current targets","tag":"Target Mode","action":"dynamic","block":"start_process"}},"slot":26}],"call_function":[],"bracket":[]}}
dfpyre/items.py ADDED
@@ -0,0 +1,244 @@
1
+ """
2
+ Contains class definitions for code items.
3
+ """
4
+
5
+ from dfpyre.style import isAmpersandCoded, ampersandToMinimessage
6
+
7
+
8
+ class item:
9
+ def __init__(self, itemID: str, count: int=1):
10
+ self.id = itemID
11
+ self.count = count
12
+ self.type = 'item'
13
+
14
+ def format(self, slot):
15
+ return dict({
16
+ "item": {
17
+ "id": "item",
18
+ "data": {
19
+ "item": f"{{DF_NBT:2586,id:\"{self.id}\",Count:{self.count}b}}"
20
+ }
21
+ },
22
+ "slot": slot
23
+ })
24
+
25
+
26
+ class string:
27
+ def __init__(self, value: str):
28
+ self.value = value
29
+ self.type = 'txt'
30
+
31
+ def format(self, slot: int):
32
+ return {
33
+ "item": {
34
+ "id": "txt",
35
+ "data": {
36
+ "name": self.value
37
+ }
38
+ },
39
+ "slot": slot
40
+ }
41
+
42
+
43
+ class text:
44
+ def __init__(self, value: str):
45
+ if isAmpersandCoded(value):
46
+ value = ampersandToMinimessage(value)
47
+ self.value = value
48
+ self.type = 'comp'
49
+
50
+ def format(self, slot: int):
51
+ return {
52
+ "item": {
53
+ "id": "comp",
54
+ "data": {
55
+ "name": self.value
56
+ }
57
+ },
58
+ "slot": slot
59
+ }
60
+
61
+
62
+ class num:
63
+ def __init__(self, num: int|float):
64
+ self.value = num
65
+ self.type = 'num'
66
+
67
+ def format(self, slot: int):
68
+ return {
69
+ "item": {
70
+ "id": "num",
71
+ "data": {
72
+ "name": str(self.value)
73
+ }
74
+ },
75
+ "slot": slot
76
+ }
77
+
78
+
79
+ class loc:
80
+ def __init__(self, x: float=0, y: float=0, z: float=0, pitch: float=0, yaw: float=0):
81
+ self.x = float(x)
82
+ self.y = float(y)
83
+ self.z = float(z)
84
+ self.pitch = float(pitch)
85
+ self.yaw = float(yaw)
86
+ self.type = 'loc'
87
+
88
+ def format(self, slot: int):
89
+ return {
90
+ "item": {
91
+ "id": "loc",
92
+ "data": {
93
+ "isBlock": False,
94
+ "loc": {
95
+ "x": self.x,
96
+ "y": self.y,
97
+ "z": self.z,
98
+ "pitch": self.pitch,
99
+ "yaw": self.yaw
100
+ }
101
+ }
102
+ },
103
+ "slot": slot
104
+ }
105
+
106
+
107
+ class var:
108
+ def __init__(self, name: str, scope: str='unsaved'):
109
+ if scope == 'game':
110
+ scope = 'unsaved'
111
+
112
+ self.name = name
113
+ self.scope = scope
114
+ self.type = 'var'
115
+
116
+ def format(self, slot: int):
117
+ return {
118
+ "item": {
119
+ "id": "var",
120
+ "data": {
121
+ "name": self.name,
122
+ "scope": self.scope
123
+ }
124
+ },
125
+ "slot": slot
126
+ }
127
+
128
+
129
+ class sound:
130
+ def __init__(self, name: str, pitch: float=1.0, vol: float=2.0):
131
+ self.name = name
132
+ self.pitch = pitch
133
+ self.vol = vol
134
+ self.type = 'snd'
135
+
136
+ def format(self, slot: int):
137
+ return {
138
+ "item": {
139
+ "id": "snd",
140
+ "data": {
141
+ "sound": self.name,
142
+ "pitch": self.pitch,
143
+ "vol": self.vol
144
+ }
145
+ },
146
+ "slot": slot
147
+ }
148
+
149
+
150
+ class particle:
151
+ def __init__(self, name: str='Cloud', amount: int=1, horizontal: float=0.0, vertical: float=0.0,
152
+ x: float=1.0, y: float=0.0, z: float=0.0, motionVariation: float=100):
153
+ self.name = name
154
+ self.amount = amount
155
+ self.horizontal = horizontal
156
+ self.vertical = vertical
157
+ self.x = x
158
+ self.y = y
159
+ self.z = z
160
+ self.motionVariation = motionVariation
161
+ self.type = 'part'
162
+
163
+ def format(self, slot: int):
164
+ return {
165
+ "item": {
166
+ "id": "part",
167
+ "data": {
168
+ "particle": self.name,
169
+ "cluster": {
170
+ "amount": self.amount,
171
+ "horizontal": self.horizontal,
172
+ "vertical": self.vertical
173
+ },
174
+ "data": {
175
+ "x": self.x,
176
+ "y": self.y,
177
+ "z": self.z,
178
+ "motionVariation": self.motionVariation
179
+ }
180
+ }
181
+ },
182
+ "slot": slot
183
+ }
184
+
185
+
186
+ class potion:
187
+ def __init__(self, name: str, dur: int=1000000, amp: int=0):
188
+ self.name = name
189
+ self.dur = dur
190
+ self.amp = amp
191
+ self.type = 'pot'
192
+
193
+ def format(self, slot: int):
194
+ return {
195
+ "item": {
196
+ "id": "pot",
197
+ "data": {
198
+ "pot": self.name,
199
+ "dur": self.dur,
200
+ "amp": self.amp
201
+ }
202
+ },
203
+ "slot": slot
204
+ }
205
+
206
+
207
+ class gamevalue:
208
+ def __init__(self, name: str, target: str='Default'):
209
+ self.name = name
210
+ self.target = target
211
+ self.type = 'g_val'
212
+
213
+ def format(self, slot: int):
214
+ return {
215
+ "item": {
216
+ "id": "g_val",
217
+ "data": {
218
+ "type": self.name,
219
+ "target": self.target
220
+ }
221
+ },
222
+ "slot": slot
223
+ }
224
+
225
+
226
+ class vector:
227
+ def __init__(self, x: float=0.0, y: float=0.0, z: float=0.0):
228
+ self.x = float(x)
229
+ self.y = float(y)
230
+ self.z = float(z)
231
+ self.type = 'vec'
232
+
233
+ def format(self, slot: int):
234
+ return {
235
+ "item": {
236
+ "id": "vec",
237
+ "data": {
238
+ "x": self.x,
239
+ "y": self.y,
240
+ "z": self.z
241
+ }
242
+ },
243
+ "slot": slot
244
+ }
dfpyre/pyre.py ADDED
@@ -0,0 +1,407 @@
1
+ """
2
+ A package for externally creating code templates for the DiamondFire Minecraft server.
3
+
4
+ By Amp
5
+ 12/29/2023
6
+ """
7
+
8
+ import base64
9
+ import gzip
10
+ import socket
11
+ import time
12
+ import json
13
+ import os
14
+ from difflib import get_close_matches
15
+ from typing import Tuple
16
+ from mcitemlib.itemlib import Item as NbtItem
17
+ from dfpyre.items import *
18
+
19
+ COL_WARN = '\x1b[33m'
20
+ COL_RESET = '\x1b[0m'
21
+ COL_SUCCESS = '\x1b[32m'
22
+ COL_ERROR = '\x1b[31m'
23
+
24
+ CODEBLOCK_DATA_PATH = os.path.join(os.path.dirname(__file__), 'data/data.json')
25
+
26
+ VARIABLE_TYPES = {'txt', 'comp', 'num', 'item', 'loc', 'var', 'snd', 'part', 'pot', 'g_val', 'vec'}
27
+ TEMPLATE_STARTERS = {'event', 'entity_event', 'func', 'process'}
28
+
29
+ TARGETS = {'Selection', 'Default', 'Killer', 'Damager', 'Shooter', 'Victim', 'AllPlayers', 'Projectile', 'AllEntities', 'AllMobs', 'LastEntity'}
30
+ TARGET_CODEBLOCKS = {'player_action', 'entity_action', 'if_player', 'if_entity'}
31
+ DEFAULT_TARGET = 'Selection' # ironically not 'Default'
32
+
33
+
34
+ class CodeBlock:
35
+ def __init__(self, name: str, args: Tuple=(), target: str=DEFAULT_TARGET, data={}):
36
+ self.name = name
37
+ self.args = args
38
+ self.target = target
39
+ self.data = data
40
+
41
+
42
+ def _warn(message):
43
+ print(f'{COL_WARN}! WARNING ! {message}{COL_RESET}')
44
+
45
+
46
+ def _warnUnrecognizedName(codeblockType: str, codeblockName: str):
47
+ close = get_close_matches(codeblockName, TAGDATA[codeblockType].keys())
48
+ if close:
49
+ _warn(f'Code block name "{codeblockName}" not recognized. Did you mean "{close[0]}"?')
50
+ else:
51
+ _warn(f'Code block name "{codeblockName}" not recognized. Try spell checking or retyping without spaces.')
52
+
53
+
54
+ def _warnUnrecognizedTarget(target: str):
55
+ close = get_close_matches(target, TARGETS)
56
+ if close:
57
+ _warn(f'Target "{target}" not recognized. Did you mean "{close[0]}"?')
58
+ else:
59
+ _warn(f'Target "{target}" not recognized. Try spell checking or retyping without spaces.')
60
+
61
+
62
+ def _loadCodeblockData() -> Tuple:
63
+ tagData = {}
64
+ if os.path.exists(CODEBLOCK_DATA_PATH):
65
+ with open(CODEBLOCK_DATA_PATH, 'r') as f:
66
+ tagData = json.load(f)
67
+ else:
68
+ _warn('data.json not found -- Item tags and error checking will not work.')
69
+ return ({}, set(), set())
70
+
71
+ del tagData['meta']
72
+
73
+ allNames = [x for l in [d.keys() for d in tagData.values()] for x in l] # flatten list
74
+ return (
75
+ tagData,
76
+ set(tagData['extras'].keys()),
77
+ set(allNames)
78
+ )
79
+
80
+ TAGDATA, TAGDATA_EXTRAS_KEYS, ALL_CODEBLOCK_NAMES = _loadCodeblockData()
81
+
82
+ def _addInverted(data, inverted):
83
+ """
84
+ If inverted is true, add 'inverted': 'NOT' to data.
85
+ """
86
+ if inverted:
87
+ data['inverted'] = 'NOT'
88
+
89
+
90
+ def _convertDataTypes(args):
91
+ convertedArgs = []
92
+ for value in args:
93
+ if type(value) in {int, float}:
94
+ convertedArgs.append(num(value))
95
+ elif type(value) is str:
96
+ convertedArgs.append(string(value))
97
+ else:
98
+ convertedArgs.append(value)
99
+ return tuple(convertedArgs)
100
+
101
+
102
+ def _reformatCodeblockTags(tags, codeblockType: str, codeblockName: str):
103
+ """
104
+ Turns data.json tag items into DiamondFire formatted tag items
105
+ """
106
+ reformattedTags = []
107
+ for tagItem in tags:
108
+ newTagItem = {
109
+ 'item': {
110
+ 'id': 'bl_tag',
111
+ 'data': {
112
+ 'option': tagItem['option'],
113
+ 'tag': tagItem['tag'],
114
+ 'action': codeblockName,
115
+ 'block': codeblockType
116
+ }
117
+ },
118
+ 'slot': tagItem['slot']
119
+ }
120
+ reformattedTags.append(newTagItem)
121
+ return reformattedTags
122
+
123
+
124
+ def _getCodeblockTags(codeblockType: str, codeblockName: str):
125
+ """
126
+ Get tags for the specified codeblock type and name
127
+ """
128
+ tags = None
129
+ if codeblockType in TAGDATA_EXTRAS_KEYS:
130
+ tags = TAGDATA['extras'][codeblockType]
131
+ else:
132
+ tags = TAGDATA[codeblockType].get(codeblockName)
133
+ return _reformatCodeblockTags(tags, codeblockType, codeblockName)
134
+
135
+
136
+ def _buildBlock(codeblock: CodeBlock, includeTags: bool):
137
+ """
138
+ Builds a properly formatted block from a CodeBlock object.
139
+ """
140
+ finalBlock = codeblock.data.copy()
141
+ codeblockType = codeblock.data.get('block')
142
+
143
+ # add target if necessary ('Selection' is the default when 'target' is blank)
144
+ if codeblockType in TARGET_CODEBLOCKS and codeblock.target != DEFAULT_TARGET:
145
+ if codeblock.target not in TARGETS:
146
+ _warnUnrecognizedTarget(codeblock.target)
147
+ else:
148
+ finalBlock['target'] = codeblock.target
149
+
150
+ # add items into args
151
+ finalArgs = [arg.format(slot) for slot, arg in enumerate(codeblock.args) if arg.type in VARIABLE_TYPES]
152
+
153
+ # check for unrecognized name, add tags
154
+ if codeblockType is not None: # for brackets
155
+ if codeblock.name not in ALL_CODEBLOCK_NAMES:
156
+ _warnUnrecognizedName(codeblockType, codeblock.name)
157
+ elif includeTags:
158
+ tags = _getCodeblockTags(codeblockType, codeblock.name)
159
+ if len(finalArgs) + len(tags) > 27:
160
+ finalArgs = finalArgs[:(27-len(tags))] # trim list if over 27 elements
161
+ finalArgs.extend(tags) # add tags to end
162
+
163
+ finalBlock['args'] = {'items': finalArgs}
164
+ return finalBlock
165
+
166
+
167
+ def _dfEncode(jsonString: str) -> str:
168
+ """
169
+ Encodes a stringified json.
170
+ """
171
+ encodedString = gzip.compress(jsonString.encode('utf-8'))
172
+ return base64.b64encode(encodedString).decode('utf-8')
173
+
174
+
175
+ def sendToDf(templateCode: str, name: str='Unnamed Template', author: str='pyre'):
176
+ """
177
+ Sends a template to DiamondFire via recode item api.
178
+
179
+ :param str templateCode: The code for the template as a base64 string.
180
+ :param str name: The name of the template.
181
+ :param str author: The author of the template.
182
+ """
183
+ templateItem = NbtItem('yellow_shulker_box')
184
+ templateItem.set_name(f'&x&f&f&5&c&0&0>> &x&f&f&c&7&0&0{name}')
185
+ templateItem.set_lore([
186
+ '&7This template was generated by &6pyre&7.',
187
+ '&7https://github.com/Amp63/pyre'
188
+ ])
189
+ templateItem.set_tag('PublicBukkitValues', {'hypercube:codetemplatedata': f'{{"author":"{author}","name":"{name}","version": 1,"code":"{templateCode}"}}'}, raw=True)
190
+
191
+ data = {'type': 'nbt', 'source': f'pyre Template - {name}', 'data': templateItem.get_nbt()}
192
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
193
+ try:
194
+ s.connect(('127.0.0.1', 31372))
195
+ except ConnectionRefusedError:
196
+ print(f"""{COL_ERROR}Could not connect to recode item API. Possible problems:
197
+ - Minecraft is not open
198
+ - Recode is not installed (get it here: https://modrinth.com/mod/recode or join the discord here: https://discord.gg/GWxWtcwA2C){COL_RESET}""")
199
+ s.close()
200
+ return
201
+
202
+ s.send((str(data) + '\n').encode('utf-8'))
203
+ received = json.loads(s.recv(1024).decode())
204
+ status = received['status']
205
+ if status == 'success':
206
+ print(f'{COL_SUCCESS}Template sent to client successfully.{COL_RESET}')
207
+ else:
208
+ error = received['error']
209
+ print(f'{COL_ERROR}Error sending template: {error}{COL_RESET}')
210
+
211
+ s.close()
212
+ time.sleep(0.5)
213
+
214
+
215
+ class DFTemplate:
216
+ """
217
+ Represents a DiamondFire code template.
218
+ """
219
+ def __init__(self, name: str=None):
220
+ self.codeBlocks = []
221
+ self.closebracket = None
222
+ self.name = name
223
+
224
+
225
+ def _setTemplateName(self, firstBlock):
226
+ if self.name is not None:
227
+ return
228
+ if 'data' in firstBlock:
229
+ self.name = firstBlock['data']
230
+ else:
231
+ self.name = firstBlock['block'] + '_' + firstBlock['action']
232
+
233
+
234
+ def build(self, includeTags: bool=True) -> str:
235
+ """
236
+ Build this template.
237
+
238
+ :return: String containing encoded template data.
239
+ """
240
+ templateDictBlocks = [_buildBlock(codeblock, includeTags) for codeblock in self.codeBlocks]
241
+ templateDict = {'blocks': templateDictBlocks}
242
+ firstBlock = templateDictBlocks[0]
243
+ if firstBlock['block'] not in TEMPLATE_STARTERS:
244
+ _warn('Template does not start with an event, function, or process.')
245
+
246
+ self._setTemplateName(firstBlock)
247
+
248
+ print(f'{COL_SUCCESS}Template built successfully.{COL_RESET}')
249
+
250
+ jsonString = json.dumps(templateDict, separators=(',', ':'))
251
+ return _dfEncode(jsonString)
252
+
253
+
254
+ def buildAndSend(self, includeTags: bool=True):
255
+ """
256
+ Builds this template and sends it to DiamondFire automatically.
257
+ """
258
+ templateCode = self.build(includeTags)
259
+ sendToDf(templateCode, name=self.name)
260
+
261
+
262
+ def clear(self):
263
+ """
264
+ Clears this template's data.
265
+ """
266
+ self.__init__()
267
+
268
+
269
+ def _openbracket(self, btype: str='norm'):
270
+ bracket = CodeBlock('Bracket', data={'id': 'bracket', 'direct': 'open', 'type': btype})
271
+ self.codeBlocks.append(bracket)
272
+ self.closebracket = btype
273
+
274
+
275
+ # command methods
276
+ def playerEvent(self, name: str):
277
+ cmd = CodeBlock(name, data={'id': 'block', 'block': 'event', 'action': name})
278
+ self.codeBlocks.append(cmd)
279
+
280
+
281
+ def entityEvent(self, name: str):
282
+ cmd = CodeBlock(name, data={'id': 'block', 'block': 'entity_event', 'action': name})
283
+ self.codeBlocks.append(cmd)
284
+
285
+
286
+ def function(self, name: str):
287
+ cmd = CodeBlock('function', data={'id': 'block', 'block': 'func', 'data': name})
288
+ self.codeBlocks.append(cmd)
289
+
290
+
291
+ def process(self, name: str):
292
+ cmd = CodeBlock('process', data={'id': 'block', 'block': 'process', 'data': name})
293
+ self.codeBlocks.append(cmd)
294
+
295
+
296
+ def callFunction(self, name: str, parameters={}):
297
+ if parameters:
298
+ for key in parameters.keys():
299
+ self.setVariable('=', var(key, scope='local'), parameters[key])
300
+
301
+ cmd = CodeBlock('call_func', data={'id': 'block', 'block': 'call_func', 'data': name})
302
+ self.codeBlocks.append(cmd)
303
+
304
+
305
+ def startProcess(self, name: str):
306
+ cmd = CodeBlock('start_process', data={'id': 'block', 'block': 'start_process', 'data': name})
307
+ self.codeBlocks.append(cmd)
308
+
309
+
310
+ def playerAction(self, name: str, *args, target: str=DEFAULT_TARGET):
311
+ args = _convertDataTypes(args)
312
+ cmd = CodeBlock(name, args, target=target, data={'id': 'block', 'block': 'player_action', 'action': name})
313
+ self.codeBlocks.append(cmd)
314
+
315
+
316
+ def gameAction(self, name: str, *args):
317
+ args = _convertDataTypes(args)
318
+ cmd = CodeBlock(name, args, data={'id': 'block', 'block': 'game_action', 'action': name})
319
+ self.codeBlocks.append(cmd)
320
+
321
+
322
+ def entityAction(self, name: str, *args, target: str=DEFAULT_TARGET):
323
+ args = _convertDataTypes(args)
324
+ cmd = CodeBlock(name, args, target=target, data={'id': 'block', 'block': 'entity_action', 'action': name})
325
+ self.codeBlocks.append(cmd)
326
+
327
+
328
+ def ifPlayer(self, name: str, *args, target: str=DEFAULT_TARGET, inverted: bool=False):
329
+ args = _convertDataTypes(args)
330
+ data = {'id': 'block', 'block': 'if_player', 'action': name}
331
+ _addInverted(data, inverted)
332
+ cmd = CodeBlock(name, args, target=target, data=data)
333
+ self.codeBlocks.append(cmd)
334
+ self._openbracket()
335
+
336
+
337
+ def ifVariable(self, name: str, *args, inverted: bool=False):
338
+ args = _convertDataTypes(args)
339
+ data = {'id': 'block', 'block': 'if_var', 'action': name}
340
+ _addInverted(data, inverted)
341
+ cmd = CodeBlock(name, args, data=data)
342
+ self.codeBlocks.append(cmd)
343
+ self._openbracket()
344
+
345
+
346
+ def ifGame(self, name: str, *args, inverted: bool=False):
347
+ args = _convertDataTypes(args)
348
+ data = {'id': 'block', 'block': 'if_game', 'action': name}
349
+ _addInverted(data, inverted)
350
+ cmd = CodeBlock(name, args, data=data)
351
+ self.codeBlocks.append(cmd)
352
+ self._openbracket()
353
+
354
+
355
+ def ifEntity(self, name: str, *args, target: str=DEFAULT_TARGET, inverted: bool=False):
356
+ args = _convertDataTypes(args)
357
+ data = {'id': 'block', 'block': 'if_entity', 'action': name}
358
+ _addInverted(data, inverted)
359
+ cmd = CodeBlock(name, args, target=target, data=data)
360
+ self.codeBlocks.append(cmd)
361
+ self._openbracket()
362
+
363
+
364
+ def else_(self):
365
+ cmd = CodeBlock('else', data={'id': 'block', 'block': 'else'})
366
+ self.codeBlocks.append(cmd)
367
+ self._openbracket()
368
+
369
+
370
+ def repeat(self, name: str, *args, subAction: str=None):
371
+ args = _convertDataTypes(args)
372
+ data = {'id': 'block', 'block': 'repeat', 'action': name}
373
+ if subAction is not None:
374
+ data['subAction'] = subAction
375
+ cmd = CodeBlock(name, args, data=data)
376
+ self.codeBlocks.append(cmd)
377
+ self._openbracket('repeat')
378
+
379
+
380
+ def bracket(self, *args):
381
+ args = _convertDataTypes(args)
382
+ cmd = CodeBlock('Bracket', data={'id': 'bracket', 'direct': 'close', 'type': self.closebracket})
383
+ self.codeBlocks.append(cmd)
384
+
385
+
386
+ def control(self, name: str, *args):
387
+ args = _convertDataTypes(args)
388
+ cmd = CodeBlock(name, args, data={'id': 'block', 'block': 'control', 'action': name})
389
+ self.codeBlocks.append(cmd)
390
+
391
+
392
+ def selectObject(self, name: str, *args):
393
+ args = _convertDataTypes(args)
394
+ cmd = CodeBlock(name, args, data={'id': 'block', 'block': 'select_obj', 'action': name})
395
+ self.codeBlocks.append(cmd)
396
+
397
+
398
+ def setVariable(self, name: str, *args):
399
+ args = _convertDataTypes(args)
400
+ cmd = CodeBlock(name, args, data={'id': 'block', 'block': 'set_var', 'action': name})
401
+ self.codeBlocks.append(cmd)
402
+
403
+
404
+ def return_(self, returndata={}):
405
+ for key in returndata:
406
+ self.setVariable('=', var(key, scope='local'), returndata[key])
407
+ self.control('Return')
dfpyre/style.py ADDED
@@ -0,0 +1,21 @@
1
+ from mcitemlib.style import *
2
+
3
+ def isAmpersandCoded(s: str) -> bool:
4
+ return bool(re.match(STYLE_CODE_REGEX, s))
5
+
6
+
7
+ def ampersandToMinimessage(ampersand_code: str) -> str:
8
+ ampersand_code = ampersand_code.replace('&r', '<reset>') # bad but should work most of the time
9
+ styledString = StyledString.from_codes(ampersand_code)
10
+ formattedStringList = []
11
+ for substring in styledString.substrings:
12
+ formattedSubstringList = []
13
+ for styleType, value in substring.data.items():
14
+ if styleType in FORMAT_CODES.values() and value:
15
+ formattedSubstringList.append(f'<{styleType}>')
16
+ if styleType == 'color':
17
+ formattedSubstringList.append(f'<{value}>')
18
+
19
+ formattedSubstringList.append(substring.data['text'])
20
+ formattedStringList.append(''.join(formattedSubstringList))
21
+ return ''.join(formattedStringList)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Amp
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.1
2
+ Name: dfpyre
3
+ Version: 0.4.1
4
+ Summary: A package for externally creating code templates for the DiamondFire Minecraft server.
5
+ Home-page: https://github.com/Amp63/pyre
6
+ Author: Amp
7
+ License: MIT
8
+ Keywords: diamondfire,minecraft
9
+ License-File: LICENSE
10
+ Requires-Dist: mcitemlib
11
+
@@ -0,0 +1,10 @@
1
+ dfpyre/__init__.py,sha256=apPsSxJ1Tztfl71MoORoSmDfX7LyKLYlLwOGeLQUitw,25
2
+ dfpyre/items.py,sha256=O3B-lrC9-BTpYAIcnVs-_DjLZOCdm9Ee5WKgNwVI3A0,6029
3
+ dfpyre/pyre.py,sha256=LKJ0eXg8d0msPBgQFpPr_Hp71vgFOIPzpWcw-_RmglA,14314
4
+ dfpyre/style.py,sha256=cCrhhC39ob-Kze8ju0Ts-gPCTMKMXDdtFnMsdaSwWVA,921
5
+ dfpyre/data/data.json,sha256=id4Af6otc9BHO8abEQPsfRPUpeZ4NDJTd5npige5NmM,30469
6
+ dfpyre-0.4.1.dist-info/LICENSE,sha256=0-CM8JuXeqwgv7oyGD6sW2vYc_GTZse7nBEMC_p9-QE,1081
7
+ dfpyre-0.4.1.dist-info/METADATA,sha256=voUsHt5TiATPXVCTaqmsqbNI4-LV4a6sL9qMFz5ggUM,303
8
+ dfpyre-0.4.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
9
+ dfpyre-0.4.1.dist-info/top_level.txt,sha256=dZ1DRJpW80nu8PH9ax__cNrin1XxVV6UcdCkT7kHktA,7
10
+ dfpyre-0.4.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.42.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ dfpyre