use crate::ir::values::*; use strum::IntoEnumIterator; #[derive(strum_macros::EnumIter, strum_macros::Display, PartialEq, Debug)] pub enum IRPlayerAction { GiveItems(Items, OptionalNumber), SetHotbarItems(Items), SetInventoryItems(Items), SetItemInSlot(OptionalItem, Number), SetEquipmentItem(OptionalItem, StringTag), SetArmorItems(Items), ReplaceItems(OptionalItems, Item, OptionalNumber), RemoveItems(Items), ClearItems(Items), ClearInventory(StringTag, StringTag), SetCursorItem(OptionalItem), SaveCurrentInventory, LoadSavedInventory, SetItemCooldown(Item, Number), SendMessage(Texts, StringTag, StringTag), SendMessageSequence(Texts, OptionalNumber), SendHoverMessage(Text, Text), ShowTitleText( Text, OptionalText, OptionalNumber, OptionalNumber, OptionalNumber, ), ShowActionBarText(Texts, StringTag), OpenBook(Item), SetBossBar( OptionalText, OptionalNumber, OptionalNumber, OptionalNumber, StringTag, StringTag, StringTag, ), RemoveBossBar(OptionalNumber), SendAdvancement(Text, Item, StringTag), SetPlayerListInfo(OptionalTexts, StringTag), PlaySound(Sounds, OptionalLocation, StringTag), StopSounds(OptionalSounds, StringTag), PlaySoundFromEntity(Sounds, Text, StringTag), ShowInventoryMenu(OptionalItems), ExpandInventoryMenu(OptionalItems), SetInventoryMenuItem(Number, OptionalItem), SetInventoryMenuName(Text), AddInventoryMenuRow(OptionalItems, StringTag), RemoveInventoryMenuRow(OptionalNumber, StringTag), CloseInventory, OpenContainerInventory(Location), SetScoreboardObjectiveName(Text), SetSidebarVisible(BoolTag), SetScoreboardScore(Text, OptionalNumber), RemoveScoreboardScore(Text), ClearScoreboard, Damage(Number, OptionalText), Heal(OptionalNumber), SetCurrentHealth(Number), SetMaximumHealth(Number, StringTag), SetAbsorptionHealth(Number), SetFoodLevel(Number), SetSaturationLevel(Number), GiveExperience(Number, StringTag), SetExperience(Number, StringTag), GivePotionEffect(Potions, StringTag, StringTag, StringTag), RemovePotionEffect(Potions), ClearPotionEffects, SetHotbarSlot(Number), SetBaseAttackSpeed(OptionalNumber), SetFireTicks(Number), SetFreezeTicks(Number), SetRemainingAir(Number), SetInvulnerabilityTicks(Number), SetFallDistance(Number), SetMovementSpeed(Number, StringTag), SetSurvivalMode, SetAdventureMode, SetCreativeMode, SetSpectatorMode, SetAllowFlight(BoolTag), SetPVPAllowed(BoolTag), SetDeathDropsEnabled(BoolTag), SetInventoryKept(BoolTag), SetCollidable(BoolTag), AllowPlaceBreakBlocks(OptionalItems), DisallowPlaceBreakBlocks(OptionalItems), SetInstantRespawn(BoolTag), SetReducedDebugInfo(BoolTag), Teleport(Location, StringTag, StringTag), LaunchUp(Number, StringTag), LaunchForward(Number, StringTag, StringTag), LaunchTowardLocation(Location, OptionalNumber, StringTag, StringTag), RideEntity(OptionalText), SetFlying(BoolTag), SetGliding(BoolTag), BoostElytra(Item), SetRotation(Number, Number), FaceLocation(Location), SetVelocity(Vector, StringTag), SpectateTarget(OptionalVector), SetSpawnPoint(OptionalLocation), LaunchProjectile( Item, OptionalLocation, OptionalText, OptionalNumber, OptionalNumber, ), SetPlayerTime(OptionalNumber), SetPlayerWeather(BoolTag), SetCompassTarget(Location), DisplayBlock(Item, Location, OptionalLocation, OptionalTexts), DisplayBlockFracture(Locations, OptionalNumber), DisplayBlockOpenedState(Location, StringTag), DisplayGatewayBeam(Location, StringTag), DisplaySignText(Location, OptionalTexts, StringTag, StringTag), DisplayHologram(Location, OptionalText), SetFogDistance(OptionalNumber), SetWorldBorder(Location, Number, OptionalNumber), ShiftWorldBorder(Number, OptionalNumber), RemoveWorldBorder, DisplayPickUpAnimation(Text, Text), SetEntityHidden(Text, StringTag), DisplayParticleEffect(Particles, Location), DisplayParticleLine(Particle, Location, Location, OptionalNumber), DisplayAnimatedParticleLine(Particle, Location, OptionalNumber, OptionalNumber), DisplayParticleCircle(Particle, Location, OptionalNumber), DisplayAnimatedParticleCircle(Particle, Location, OptionalNumber, OptionalNumber), DisplayParticleCuboid(Particle, Location, Location, OptionalNumber, StringTag), DisplayAnimatedParticleCuboid( Particle, Location, Location, OptionalNumber, OptionalNumber, StringTag, ), DisplayParticleSpiral( Particle, Location, OptionalNumber, OptionalNumber, OptionalNumber, OptionalNumber, ), DisplayAnimatedParticleSpiral( Particle, Location, OptionalNumber, OptionalNumber, OptionalNumber, OptionalNumber, OptionalNumber, ), DisplayParticleSphere(Particle, Location, OptionalNumber), DisplayParticleRay(Particle, Location, Vector, OptionalNumber), DisplayLightningBolt(Location), DisplayVibrationEffect(Location, Location, OptionalNumber), DisguiseAsMob(Item, OptionalText), DisguiseAsPlayer(Text, OptionalItem), DisguiseAsBlock(Item, OptionalText), SetOwnDisguiseVisibility(BoolTag), Undisguide, SetChatTag(OptionalTexts), SetChatColor(OptionalText), SetNameColor(OptionalText), SetArrowsStuck(OptionalNumber), SetBeeStingsStuck(OptionalNumber), SetVisualFire(BoolTag), SendPlayerAttackAnimation(StringTag), SendPlayerHurtAnimation(OptionalLocation), SendWakeUpAnimation, SetStatus(OptionalText), SetSkin(OptionalItem), RollBackBlockChanges(Number), Kick, } #[allow(dead_code)] impl IRPlayerAction { fn parse_player_action(code: &str) -> Option { if !code.starts_with("playerAction.") { return None; } let code = code.trim_start_matches("playerAction."); IRPlayerAction::iter().find(|event| event.to_string().eq_ignore_ascii_case(code)) } } #[derive(strum_macros::EnumIter, strum_macros::Display, PartialEq, Debug)] pub enum IRGameAction {} #[allow(dead_code)] impl IRGameAction { fn parse_game_action(code: &str) -> Option { if !code.starts_with("gameAction.") { return None; } let code = code.trim_start_matches("gameAction."); IRGameAction::iter().find(|event| event.to_string().eq_ignore_ascii_case(code)) } } #[derive(strum_macros::EnumIter, strum_macros::Display, PartialEq, Debug)] pub enum IREntityAction { Heal(OptionalNumber), SetCurrentHealth(Number), SetAbsorptionHealth(Number), SetMaximumHealth(Number, StringTag), Damage(Number), SetFireTicks(Number), SetFreezeTicks(OptionalNumber, StringTag), SetInvulnerabilityTicks(Number), GivePotionEffect(Potions, StringTag, StringTag), RemovePotionEffect(Potions), ClearPotionEffects, SetAnimalAge(Number, StringTag), SetFallDistance(Number), SetCreeperFuse(Number), SetCreeperExplosionPower(Number), SetPotionCloudRadius(Number, OptionalNumber), SetVillagerExperience(Number), SetWitherInvulnerabilityTicks(Number), SetHorseJumpStrength(Number), SetPickupDelay(Number), SetFishingWaitTime(Number), SetWardenAngerLevel(Text, Number), DisguiseAsMob(Item, OptionalText), DisguiseAsPlayer(Text, OptionalItem), DisguiseAsBlock(Item, OptionalText), Undisguide, SetGlowing(BoolTag), SetDyeColor(StringTag), SetTropicalFishPattern(StringTag, StringTag, StringTag), SetRabbitType(StringTag), SetCatType(StringTag), SetMooshroomType(StringTag), SetFoxType(StringTag), SetParrotColor(StringTag), SetHorsePattern(StringTag), SetAxolotlPattern(StringTag), SetLlamaColor(StringTag), SetFrogType(StringTag), SetVillagerBiome(StringTag), SetSnowGolemPumpkin(BoolTag), SetEndermanHeldBlock(Item), SetMinecartBlock(Item, OptionalNumber), SetArmorStandParts(StringTag, StringTag), SetBeeHasNectar(StringTag, StringTag), SetProjectileDisplayItem(Item), SetVisualFire(BoolTag), SendMobAnimation(StringTag), SendMobAttackAnimation(StringTag), SetArmorStandPose(Vector, StringTag), SetPose(StringTag), SetFoxLeaping(BoolTag), SetArmsRaised(BoolTag), SetCatResting(BoolTag), SetGlowSquidDarkTicks(Number), Teleport(Location, StringTag), LaunchUp(Number, StringTag), LaunchForward(Number, StringTag, StringTag), LaunchTowardLocation(Location, OptionalNumber, StringTag, StringTag), SetGliding(BoolTag), SetGravity(BoolTag), RideEntity(OptionalText), AttachLead(Text), // Not a DF command but represents the second option for AttachLead AttachLeadToFence(Location), SetRotation(Number, Number), SetVelocity(Vector, StringTag), SetCustomName(OptionalText, StringTag), SetNameVisible(StringTag), SetNameColor(OptionalText), SetAI(StringTag), SetSilenced(BoolTag), SetDeathDropsEnabled(BoolTag), SetCollidable(BoolTag), SetInvulnerable(BoolTag), SetSitting(BoolTag), SetBaby(BoolTag), SetSize(Number), SetSheepSheared(BoolTag), SetWearingSaddle(BoolTag), SetCarryingChest(BoolTag), SetArmorStandSlotInteractions(StringTag, StringTag), SetMarker(BoolTag), SetAngry(BoolTag), SetRearing(BoolTag), SetRiptiding(BoolTag), SetCreeperCharged(BoolTag), SetInvisible(BoolTag), SetGoatScreaming(BoolTag), SetGoatHorns(StringTag, StringTag), Tame(OptionalText), SetEndCrystalBeam(OptionalLocation), SetPandaGene(StringTag, StringTag), SetVillagerProfession(StringTag), SetProjectileShooter(OptionalText), SetPersistent(BoolTag), SetInteractionSize(OptionalNumber, OptionalNumber), SetInteractionResponsive(BoolTag), SetCelebrating(BoolTag), SetTarget(OptionalText), MoveToLocation(Location, OptionalNumber), Jump, RamTarget(Text), EatTarget(Text), EatGrass, IgniteCreeper, Explode, SetFoxSleeping(BoolTag), SetDragonPhase(StringTag), SetShulkerBulletTarget(OptionalText), UseItem(StringTag), SetAllayDancing(BoolTag), SetDisplayViewRange(OptionalNumber), SetDisplayBillboard(BoolTag), SetDisplayShadow(OptionalNumber, OptionalNumber), SetDisplayBrightness(OptionalNumber, OptionalNumber), SetDisplayInterpolation(OptionalNumber, OptionalNumber), SetDisplayCullingSize(OptionalNumber, OptionalNumber), SetTextDisplayText(Texts), SetTextDisplayLineWidth(OptionalNumber), SetTextDisplayTextOpacity(OptionalNumber), SetTextDisplayTextAlignment(StringTag), SetTextDisplayTextShadow(BoolTag), SetTextDisplaySeeThrough(BoolTag), SetTextDisplayBackground(OptionalText, OptionalNumber), SetDisplayGlowColor(OptionalText), SetItemDisplayItem(Item), SetItemDisplayModelType(StringTag), SetBlockDisplayBlock(Item, OptionalTexts), SetDisplayTransformationMatrix(Numbers), SetDisplayRotationFromEulerAngles(Number, Number, Number, StringTag), SetDisplayRotationFromAxisAngle(Vector, Number, StringTag), SetDisplayTranslation(Vector), SetDisplayScale(Vector), Remove, SetEquipmentItem(OptionalItem), SetArmorItems(Items), LaunchProjectile( Item, OptionalLocation, OptionalText, OptionalNumber, OptionalNumber, ), ShearSheep, SetCustomTag(Text, OptionalNumber), GetCustomTag(Variable, Text), RemoveCustomTag(Text), SetEntityItem(Item), SetWardenDigging(BoolTag), } #[allow(dead_code)] impl IREntityAction { fn parse_entity_action(code: &str) -> Option { if !code.starts_with("entityAction.") { return None; } let code = code.trim_start_matches("entityAction."); IREntityAction::iter().find(|event| event.to_string().eq_ignore_ascii_case(code)) } }