diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 2e236e0..e23659b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -248,11 +248,37 @@ jobs: dependencies: | mr_spawn_animationscompats(optional){modrinth:ofDka6PS} + pehkui(optional){modrinth:t5W7Jfwy} loaders: | datapack files: | ./${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ env.MC_HUMAN_VERSION_RANGE }}-datapack.zip - + + - name: Upload Forge mod version to Modrinth # Forge mod version is uploaded separately atm due to it not being compatible with Minecraft 1.21.6 or above + id: upload_forge_modrinth_mod + uses: Kir-Antipov/mc-publish@v3.3 + if: steps.check_mod_folder.outputs.files_exists == 'true' && github.event.inputs.dry_run == 'false' + with: + modrinth-id: zrzYrlm0 + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + game-versions: | + >=1.17 <=1.21.5 + game-version-filter: any + fail-mode: skip + + name: "[Mod] Release v${{ github.event.inputs.tag }}" + version: ${{ github.event.inputs.tag }}+mod + changelog-file: CHANGES.md + + dependencies: | + mr_spawn_animationscompats(optional){modrinth:ofDka6PS} + midnightlib(optional){modrinth:codAaoxh} + pehkui(optional){modrinth:t5W7Jfwy} + loaders: | + forge + files: | + ./${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ env.MC_HUMAN_VERSION_RANGE }}-mod.jar + - name: Upload mod version to Modrinth id: upload_modrinth_mod uses: Kir-Antipov/mc-publish@v3.3 @@ -275,10 +301,10 @@ jobs: modmenu(optional){modrinth:mOgUt4GM} modmenu-badges-lib(optional){modrinth:eUw8l2Vi} midnightlib(optional){modrinth:codAaoxh} + pehkui(optional){modrinth:t5W7Jfwy} loaders: | fabric quilt - forge neoforge files: | ./${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ env.MC_HUMAN_VERSION_RANGE }}-mod.jar @@ -298,11 +324,41 @@ jobs: version: ${{ github.event.inputs.tag }} changelog-file: CHANGES.md + dependencies: | + pehkui(optional){curseforge:319596} loaders: | datapack files: | ./${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ env.MC_HUMAN_VERSION_RANGE }}-datapack.zip + - name: Upload Forge mod version to CurseForge # Same reason as above + id: upload_forge_curseforge_mod + uses: Kir-Antipov/mc-publish@v3.3 + if: steps.check_mod_folder.outputs.files_exists == 'true' && github.event.inputs.dry_run == 'false' + with: + curseforge-id: 1223719 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + game-versions: | + >=1.17 <=1.21.5 + game-version-filter: any + fail-mode: skip + + name: "Release v${{ github.event.inputs.tag }}" + version: ${{ github.event.inputs.tag }}+mod + changelog-file: CHANGES.md + + dependencies: | + catalogue(optional){curseforge:459701} + midnightlib(optional){curseforge:488090} + pehkui(optional){curseforge:319596} + java: | + Java 21 + Java 17 + loaders: | + forge + files: | + ./${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ env.MC_HUMAN_VERSION_RANGE }}-mod.jar + - name: Upload mod version to CurseForge id: upload_curseforge_mod uses: Kir-Antipov/mc-publish@v3.3 @@ -321,13 +377,13 @@ jobs: dependencies: | catalogue(optional){curseforge:459701} midnightlib(optional){curseforge:488090} + pehkui(optional){curseforge:319596} java: | Java 21 Java 17 loaders: | fabric quilt - forge neoforge files: | ./${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ env.MC_HUMAN_VERSION_RANGE }}-mod.jar @@ -358,47 +414,48 @@ jobs: run: | echo "Building summary..." if [ "${{ job.status }}" == "success" ]; then - SUMMARY_CONTENT=" - - \"✅ -
+ SUMMARY_CONTENT=" + + \"✅ +
- **${{ github.event.repository.name }} v${{ github.event.inputs.tag }}** for **Minecraft ${{ env.MC_HUMAN_VERSION_RANGE }}** published successfully! + **${{ github.event.repository.name }} v${{ github.event.inputs.tag }}** for **Minecraft ${{ env.MC_HUMAN_VERSION_RANGE }}** published successfully! - [View Changelog](https://github.com/${{ github.repository }}/blob/v${{ github.event.inputs.tag }}/CHANGES.md) + [View Changelog](https://github.com/${{ github.repository }}/blob/v${{ github.event.inputs.tag }}/CHANGES.md) - **Downloads:** - " + **Downloads:** + " - if [ -n "${{ steps.upload_modrinth_dp.outputs.modrinth-url }}" ]; then - SUMMARY_CONTENT+="- [Modrinth (Data Pack)](${{ steps.upload_modrinth_dp.outputs.modrinth-url }}) - " - fi - if [ -n "${{ steps.upload_modrinth_mod.outputs.modrinth-url }}" ]; then - SUMMARY_CONTENT+="- [Modrinth (Mod)](${{ steps.upload_modrinth_mod.outputs.modrinth-url }}) - " - fi - if [ -n "${{ steps.upload_curseforge_dp.outputs.curseforge-url }}" ]; then - SUMMARY_CONTENT+="- [CurseForge (Data Pack)](${{ steps.upload_curseforge_dp.outputs.curseforge-url }}) - " - fi - if [ -n "${{ steps.upload_curseforge_mod.outputs.curseforge-url }}" ]; then - SUMMARY_CONTENT+="- [CurseForge (Mod)](${{ steps.upload_curseforge_mod.outputs.curseforge-url }}) - " - fi - if [ -n "${{ steps.upload_github.outputs.github-url }}" ]; then - SUMMARY_CONTENT+="- [GitHub Releases](${{ steps.upload_github.outputs.github-url }}) - " - fi + if [ -n "${{ steps.upload_modrinth_dp.outputs.modrinth-url }}" ]; then + SUMMARY_CONTENT+="- [Modrinth (Data Pack)](${{ steps.upload_modrinth_dp.outputs.modrinth-url }}) + " + fi + if [ -n "${{ steps.upload_modrinth_mod.outputs.modrinth-url }}" ]; then + SUMMARY_CONTENT+="- [Modrinth (Mod)](${{ steps.upload_modrinth_mod.outputs.modrinth-url }}) + " + fi + if [ -n "${{ steps.upload_curseforge_dp.outputs.curseforge-url }}" ]; then + SUMMARY_CONTENT+="- [CurseForge (Data Pack)](${{ steps.upload_curseforge_dp.outputs.curseforge-url }}) + " + fi + if [ -n "${{ steps.upload_curseforge_mod.outputs.curseforge-url }}" ]; then + SUMMARY_CONTENT+="- [CurseForge (Mod)](${{ steps.upload_curseforge_mod.outputs.curseforge-url }}) + " + fi + if [ -n "${{ steps.upload_github.outputs.github-url }}" ]; then + SUMMARY_CONTENT+="- [GitHub Releases](${{ steps.upload_github.outputs.github-url }}) + " + fi + + echo -e "$SUMMARY_CONTENT" >> $GITHUB_STEP_SUMMARY - echo -e "$SUMMARY_CONTENT" >> $GITHUB_STEP_SUMMARY else - cat << EOF >> $GITHUB_STEP_SUMMARY + cat << EOF >> $GITHUB_STEP_SUMMARY ❌ Error
- The publish job for v${{ github.event.inputs.tag }} (mc${{ env.MC_HUMAN_VERSION_RANGE }}) failed! Please check the action logs for details. + The publish job for **v${{ github.event.inputs.tag }}** (Minecraft ${{ env.MC_HUMAN_VERSION_RANGE }}) failed! Please check the action logs for details. EOF fi diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b25aec1..cedc506 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,13 +17,13 @@ on: description: 'Set to true to skip command validation' required: false type: boolean - default: false + default: true env: # Fallback Lower: when Spyglass API is unreachable FALLBACK_MC_LOWER: "1.17" # Fallback Upper: when Spyglass API and Mojang API are unreachable - FALLBACK_MC_UPPER: "1.21.5" + FALLBACK_MC_UPPER: "1.21.8" jobs: deploy: @@ -189,9 +189,9 @@ jobs: echo " NeoForge range: $MACHINE_RANGE_NEOFORGE" echo " Validator version: $CMD_VALIDATOR_MC" - # Optionally validate commands + # Optionally validate commands (disabled by default upon push due to unrecognized Pehkui commands) - name: Validate commands - if: ${{ github.event.inputs.skip_check != 'true' }} + if: ${{ github.event.inputs.skip_check == 'false' }} uses: mcbeet/check-commands@v1 with: source: . @@ -310,6 +310,6 @@ jobs: ❌ Error
- The build v${{ env.TAG }} for mc${{ env.MC_HUMAN_VERSION_RANGE }} failed! Please check the action logs for details. + The build **v${{ env.TAG }}** for **Minecraft ${{ env.MC_HUMAN_VERSION_RANGE }}** failed! Please check the action logs for details. EOF fi diff --git a/CHANGES.md b/CHANGES.md index 1d14339..a99c8fb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1 +1,12 @@ -- **Added support for Minecraft 1.21.7** 💿 +- **Entities with emissive layers are now properly hidden** 👻 (Endermen, Spiders, and Cave Spiders) (closes [#25](https://github.com/Tschipcraft/spawnanimations/issues/25)) + - For this feature to work in Minecraft 1.20.4 and below, [Pehkui](https://modrinth.com/project/t5W7Jfwy) must be installed. Pehkui can still be installed in newer versions for smoother poof animations +- Added config options to enable/disable the poof animation ([#40](https://github.com/Tschipcraft/spawnanimations/issues/40)), animation sounds (closes [#39](https://github.com/Tschipcraft/spawnanimations/issues/39)), reducing the number of particles emitted by hidden Endermen, and hiding emissive mob layers ([#25](https://github.com/Tschipcraft/spawnanimations/issues/25)) +- Improved performance by refactoring entity activation distance calculations to bundle and cache position data retrieval calls and by updating batch activation logic. The whole project is now up to 45% faster per tick! +- Modified the attack predicate of the secondary dig-up requirements so that it disregards the Y-distance. This allows mobs to, for example, appear at the bottom of pillars if a player decides to build up during the night +- Added an activation distance recommendation message when using the Vanilla activation mode +- Removed the Hoglin from the dig up animation +- Fixed most compatibility issues with [Hostile Mobs Improve Over Time](https://modrinth.com/project/ku4JD9TH) by adding missing tag recovery logic when preparing an entity for hiding. This should generally improve compatibility with other packs that override entity tags (closes [#26](https://github.com/Tschipcraft/spawnanimations/issues/26)) +- Fixed poof animation playing multiple times when "Play Animation on Unsupported Blocks" is off +- Fixed possibility of hidden falling mobs losing their fall distance NBT when appearing +- Fixed v0 save format not correctly upgrading to v1 in 1.20.5 and 1.20.6 (precisely from 24w11a to 24w20a) +- Changed exclude tag from `exclude` to `ts.sa.exclude` diff --git a/META-INF/mods.toml b/META-INF/mods.toml index 4ec05ef..ad236c8 100644 --- a/META-INF/mods.toml +++ b/META-INF/mods.toml @@ -27,7 +27,7 @@ features={ java_version = "[17,)" } [[dependencies.spawnanimations]] modId="minecraft" mandatory=true - versionRange="${mc_version_range_forge}" + versionRange="[1.17,1.21.5]" ordering="NONE" side="BOTH" @@ -44,8 +44,16 @@ features={ java_version = "[17,)" } mandatory=false versionRange="[1.0,)" ordering="NONE" - side="BOTH" + side="SERVER" referralUrl="https://modrinth.com/mod/ofDka6PS/versions?l=forge" +[[dependencies.spawnanimations]] + modId="pehkui" + mandatory=false + versionRange="[3.4.0,)" + ordering="NONE" + side="BOTH" + referralUrl="https://modrinth.com/mod/t5W7Jfwy/versions?l=forge" + [modproperties.spawnanimations] catalogueItemIcon="minecraft:zombie_spawn_egg" diff --git a/META-INF/neoforge.mods.toml b/META-INF/neoforge.mods.toml index fc655b9..8473b70 100644 --- a/META-INF/neoforge.mods.toml +++ b/META-INF/neoforge.mods.toml @@ -45,9 +45,18 @@ features={ java_version = "[21,)" } type="optional" versionRange="[1.0,)" ordering="NONE" - side="BOTH" + side="SERVER" referralUrl="https://modrinth.com/mod/ofDka6PS/versions?l=neoforge" reason="Compatibility with other mods" +[[dependencies.spawnanimations]] + modId="pehkui" + type="optional" + versionRange="[3.4.0,)" + ordering="NONE" + side="BOTH" + referralUrl="https://modrinth.com/mod/t5W7Jfwy/versions?l=neoforge" + reason="Completely hiding entities with an emissive layer" + [modproperties.spawnanimations] catalogueItemIcon="minecraft:zombie_spawn_egg" diff --git a/assets/spawnanimations/lang/en_us.json b/assets/spawnanimations/lang/en_us.json index 770df2c..2224bb9 100644 --- a/assets/spawnanimations/lang/en_us.json +++ b/assets/spawnanimations/lang/en_us.json @@ -1,11 +1,15 @@ { + "modmenu.summaryTranslation.spawnanimations": "Hostile mobs dig out of the ground or poof into existence when they spawn!", + "modmenu.descriptionTranslation.spawnanimations": "Hostile mobs dig out of the ground or poof into existence when they spawn!\n§lWorks with:§r Zombies, Husks, Drowned, Skeletons, Strays, Bogged, Spiders, Cave Spiders, Creepers, Slimes, Magma Cubes, Wither Skeletons, Hoglins, Zombified Piglins, Striders, Enderman and Giants.\nThis data pack is designed to be as unintrusive as possible. Hidden entities including their worn armor and tools will only be invisible and silent.\nExecute the command §o/function §ospawnanimations:settings§r for a world-specific settings menu and/or install MidnightLib for global settings across all worlds.", + "fml.menu.mods.info.description.spawnanimations": "Hostile mobs dig out of the ground or poof into existence when they spawn!\n\n§lWorks with:§r Zombies, Husks, Drowned, Skeletons, Strays, Bogged, Spiders, Cave Spiders, Creepers, Slimes, Magma Cubes, Wither Skeletons, Hoglins, Zombified Piglins, Striders, Enderman and Giants.\n\nThis data pack is designed to be as unintrusive as possible. Hidden entities including their worn armor and tools will only be invisible and silent.\n\nExecute the command §o/function §ospawnanimations:settings§r for a world-specific settings menu and/or install MidnightLib for global settings across all worlds.", + "spawnanimations.midnightconfig.title": "Spawn Animations Configuration", "spawnanimations.midnightconfig.empty": "", - "spawnanimations.midnightconfig.configure_ingame": "§dℹ Info:§r§f To configure this data pack on a world-to-world basis,", + "spawnanimations.midnightconfig.configure_ingame": "§dℹ Info:§f To configure this data pack on a world-to-world basis,", "spawnanimations.midnightconfig.configure_ingame2": "join a world and execute the command §o/function spawnanimations:settings§r.", "spawnanimations.midnightconfig.empty2": "", "spawnanimations.midnightconfig.global_settings": "§n§l-=- Global Settings -=-", - "spawnanimations.midnightconfig.info": "§dℹ Info:§r§f These settings will be applied globally to all worlds.", + "spawnanimations.midnightconfig.info": "§dℹ Info:§f These settings will be applied globally to all worlds.", "spawnanimations.midnightconfig.info2": "Please make sure to rejoin any world for the global settings to take effect.", "spawnanimations.midnightconfig.empty3": "", "spawnanimations.midnightconfig.empty4": "", @@ -13,11 +17,19 @@ "spawnanimations.midnightconfig.activation_distance": "Activation Distance", "spawnanimations.midnightconfig.activation_distance.tooltip": "Default: §a20 blocks§f\nMobs closer to a player than this value will play the animation.\nSetting this to 0 will use the world-specific value.", "spawnanimations.midnightconfig.activation_mode": "Activation Mode", - "spawnanimations.midnightconfig.activation_mode.tooltip": "Default: §aClassic§f\n§nClassic§r: Out of range mobs will stay hidden until a player is in range\n§nVanilla§r: Out of range mobs will spawn normally", - "spawnanimations.midnightconfig.hide_worn_armor_and_tools": "Hide worn armor and tools", - "spawnanimations.midnightconfig.hide_worn_armor_and_tools.tooltip": "Default: §aYes§f\nIf enabled, stores the worn armor and tools in the feet and in some versions leggings slot of a hidden entity.\n§6⚠ Note: This may impact worn armor and tool drop rates from farms when enabled.", - "spawnanimations.midnightconfig.play_animation_on_unsupported_blocks": "Play block break animation on unsupported blocks", - "spawnanimations.midnightconfig.play_animation_on_unsupported_blocks.tooltip": "Default: §cNo§f\nIf enabled, plays a block breaking animation even on blocks that are not hard-coded into the data pack.\n§6⚠ Note: This could lead to unwanted block updates when enabled.", + "spawnanimations.midnightconfig.activation_mode.tooltip": "Default: §aClassic§f\n§nClassic§r: Mobs outside the activation range remain hidden until a player is in range.\n§nVanilla§r: Mobs outside the activation range spawn normally.\n§9ℹ Info:§f When set to Vanilla, it is recommended to set the activation distance to at least 25 blocks to see the animation.", + "spawnanimations.midnightconfig.enable_poof_animation": "Enable Poof Animation", + "spawnanimations.midnightconfig.enable_poof_animation.tooltip": "Default: §aYes§f\nIf enabled, some mobs, or mobs without a block to dig up from, will play the poof animation instead.", + "spawnanimations.midnightconfig.play_animation_sounds": "Play Animation Sounds", + "spawnanimations.midnightconfig.play_animation_sounds.tooltip": "Default: §aYes§f\nIf enabled, sounds will be played during the animation.", + "spawnanimations.midnightconfig.hide_worn_armor_and_tools": "Hide Worn Armor and Tools", + "spawnanimations.midnightconfig.hide_worn_armor_and_tools.tooltip": "Default: §aYes§f\nIf enabled, worn armor and tools are stored in the body, feet, or in some versions, leggings slot of a hidden entity.\n§6⚠ Note: This may impact worn armor and tool drop rates from mob farms when enabled.", + "spawnanimations.midnightconfig.hide_emissive_mob_layers": "Hide Emissive Mob Layers", + "spawnanimations.midnightconfig.hide_emissive_mob_layers.tooltip": "Default: §aYes§f\nIf enabled, emissive layers of some mobs (e.g., Endermen, Spiders, and Cave Spiders), or with Pehkui all mobs, will be hidden by shrinking them.\nRequires Pehkui to be installed in Minecraft 1.20.4 and below.\n§6⚠ Note: This may decrease the efficiency of mob farms due to the changed hitbox size for hidden entities when Pehkui is §nnot§r§6 installed and the feature is enabled.", + "spawnanimations.midnightconfig.reduce_enderman_particles": "Reduce Hidden Enderman Particles", + "spawnanimations.midnightconfig.reduce_enderman_particles.tooltip": "Default: §aYes§f\nIf enabled, the number of particles emitted by hidden Endermen will be reduced by shrinking their hitbox scale.\nOnly applicable when Pehkui is installed.\n§6⚠ Note: This may decrease the efficiency of Enderman mob farms when enabled.", + "spawnanimations.midnightconfig.play_animation_on_unsupported_blocks": "Play Block Break Animation on Unsupported Blocks", + "spawnanimations.midnightconfig.play_animation_on_unsupported_blocks.tooltip": "Default: §cNo§f\nIf enabled, the block breaking animation plays on blocks not explicitly supported by Spawn Animations.\n§6⚠ Note: This could lead to unwanted block updates when enabled.", "spawnanimations.midnightconfig.enum.bool.WORLD": "§bWorld-Specific", "spawnanimations.midnightconfig.enum.bool.YES": "§a[✔] Yes", @@ -26,7 +38,6 @@ "spawnanimations.midnightconfig.enum.mode.CLASSIC": "§aClassic", "spawnanimations.midnightconfig.enum.mode.VANILLA": "§aVanilla", - "modmenu.summaryTranslation.spawnanimations": "Hostile mobs dig out of the ground or poof into existence when they spawn!", "modmenu.donate": "Donate", "modmenu.modrinth": "Modrinth", "modmenu.curseforge": "CurseForge", diff --git a/data/spawnanimations/function/install.mcfunction b/data/spawnanimations/function/install.mcfunction index 7b180be..5e16ff4 100644 --- a/data/spawnanimations/function/install.mcfunction +++ b/data/spawnanimations/function/install.mcfunction @@ -5,9 +5,16 @@ scoreboard objectives add ts.sa.timer dummy scoreboard objectives add ts.sa.count dummy scoreboard objectives add ts.sa.welcome trigger +# Activation distance calculation scoreboard objectives add ts.sa.x dummy scoreboard objectives add ts.sa.y dummy scoreboard objectives add ts.sa.z dummy +scoreboard players set #minus ts.sa.x -1 + +# Escape protection for shrunk/emissive entities (see emissive_layer) +scoreboard objectives add ts.sa.prev_x dummy +scoreboard objectives add ts.sa.prev_y dummy +scoreboard objectives add ts.sa.prev_z dummy # Entity properties scoreboard objectives add ts.sa.e.y dummy diff --git a/data/spawnanimations/function/internal/animation/dig_up/prepare.mcfunction b/data/spawnanimations/function/internal/animation/dig_up/prepare.mcfunction index eba7264..fd87a78 100644 --- a/data/spawnanimations/function/internal/animation/dig_up/prepare.mcfunction +++ b/data/spawnanimations/function/internal/animation/dig_up/prepare.mcfunction @@ -1,11 +1,17 @@ ## by Tschipcraft # Prepares an entity for hiding -# Exclude entities that have the glowing, levitation or invisibility potion effect, are riding another entity or are burning -execute as @s[predicate=!spawnanimations:exclude] run tag @s add ts.sa.verified -# Exclude silent or no ai mobs -execute as @s[tag=!ts.sa.verified,nbt={Silent:1b}] run tag @s add ts.sa.verified -execute as @s[tag=!ts.sa.verified,nbt={NoAI:1b}] run tag @s add ts.sa.verified +# Recover entity tags that may have been removed by other mods/data packs (Issue #26) +execute as @s[scores={ts.sa.timer=-300..99}] run function spawnanimations:internal/animation/dig_up/recover_tags/animating +execute as @s[scores={ts.sa.e.nbt.Sil=0},tag=!ts.sa.verify] run function spawnanimations:internal/animation/dig_up/recover_tags/hidden +tag @s[scores={ts.sa.timer=100}] add ts.sa.verified + +# Exclude entities that have the glowing, levitation or invisibility potion effect, are riding another entity, or are burning +execute as @s[tag=!ts.sa.verify,tag=!ts.sa.to_verify,predicate=!spawnanimations:exclude] run tag @s add ts.sa.verified + +# Exclude silent or no AI mobs +execute as @s[tag=!ts.sa.verified,tag=!ts.sa.verify,tag=!ts.sa.to_verify,nbt={Silent:1b}] run tag @s add ts.sa.verified +execute as @s[tag=!ts.sa.verified,tag=!ts.sa.verify,tag=!ts.sa.to_verify,nbt={NoAI:1b}] run tag @s add ts.sa.verified # Hide the entity -execute as @s[tag=!ts.sa.verified] run function spawnanimations:internal/entity/hide +execute as @s[tag=!ts.sa.verified,tag=!ts.sa.verify,tag=!ts.sa.to_verify] run function spawnanimations:internal/entity/hide diff --git a/data/spawnanimations/function/internal/animation/dig_up/recover_tags/animating.mcfunction b/data/spawnanimations/function/internal/animation/dig_up/recover_tags/animating.mcfunction new file mode 100644 index 0000000..7dc95c8 --- /dev/null +++ b/data/spawnanimations/function/internal/animation/dig_up/recover_tags/animating.mcfunction @@ -0,0 +1,12 @@ +##by Tschipcraft +# Recovers entity tags that were removed by other mods/data packs during the dig up animation + +# We set every possible tag an entity in this state might have in hope that we can properly recover it +tag @s add ts.sa.verify +tag @s add ts.sa.protected + +tag @s add ts.sa.hidden +execute if score $hide_armor ts.sa.settings matches 1..2 run tag @s[type=#spawnanimations:can_wear_armor,predicate=spawnanimations:validate/save_format] add ts.sa.ehs.saved +execute if score $hide_emissive ts.sa.settings matches 1..2 run tag @s[type=#spawnanimations:has_emissive_layer] add ts.sa.ehs.shrunk +execute if score $hide_emissive ts.sa.settings matches 1..2 run tag @s add ts.sa.ehs.pehkui.shrunk +execute if score $enderman_hack ts.sa.settings matches 1..2 run tag @s[type=minecraft:enderman] add ts.sa.ehs.pehkui.hitbox diff --git a/data/spawnanimations/function/internal/animation/dig_up/recover_tags/hidden.mcfunction b/data/spawnanimations/function/internal/animation/dig_up/recover_tags/hidden.mcfunction new file mode 100644 index 0000000..c4a52ca --- /dev/null +++ b/data/spawnanimations/function/internal/animation/dig_up/recover_tags/hidden.mcfunction @@ -0,0 +1,11 @@ +##by Tschipcraft +# Recovers entity tags that were removed by other mods/data packs when hidden + +# We set every possible tag an entity in this state might have in hope that we can properly recover it +tag @s add ts.sa.to_verify + +tag @s add ts.sa.hidden +execute if score $hide_armor ts.sa.settings matches 1..2 run tag @s[type=#spawnanimations:can_wear_armor,predicate=spawnanimations:validate/save_format] add ts.sa.ehs.saved +execute if score $hide_emissive ts.sa.settings matches 1..2 run tag @s[type=#spawnanimations:has_emissive_layer] add ts.sa.ehs.shrunk +execute if score $hide_emissive ts.sa.settings matches 1..2 run tag @s add ts.sa.ehs.pehkui.shrunk +execute if score $enderman_hack ts.sa.settings matches 1..2 run tag @s[type=minecraft:enderman] add ts.sa.ehs.pehkui.hitbox diff --git a/data/spawnanimations/function/internal/animation/dig_up/sound/sound.mcfunction b/data/spawnanimations/function/internal/animation/dig_up/sound/sound.mcfunction index 25cc2e8..0b265d6 100644 --- a/data/spawnanimations/function/internal/animation/dig_up/sound/sound.mcfunction +++ b/data/spawnanimations/function/internal/animation/dig_up/sound/sound.mcfunction @@ -1,7 +1,7 @@ ## by Tschipcraft -execute if block ~ ~ ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/sound/play_sound -execute if score $play_unsupport ts.sa.settings matches 1..2 unless block ~ ~ ~ #spawnanimations:supported unless block ~ ~ ~ #spawnanimations:nonsolid unless block ~ ~ ~ minecraft:bedrock unless block ~ ~ ~ minecraft:air run function spawnanimations:internal/animation/dig_up/sound/support +execute if score $play_sounds ts.sa.settings matches 1..2 if block ~ ~ ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/sound/play_sound +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches 1..2 unless block ~ ~ ~ #spawnanimations:supported unless block ~ ~ ~ #spawnanimations:nonsolid unless block ~ ~ ~ minecraft:bedrock unless block ~ ~ ~ minecraft:air run function spawnanimations:internal/animation/dig_up/sound/support # Update stage + adjust animation speed scoreboard players add @s ts.sa.e.stage 1 diff --git a/data/spawnanimations/function/internal/animation/dig_up/sound/sound2.mcfunction b/data/spawnanimations/function/internal/animation/dig_up/sound/sound2.mcfunction index c8fe564..8bd207d 100644 --- a/data/spawnanimations/function/internal/animation/dig_up/sound/sound2.mcfunction +++ b/data/spawnanimations/function/internal/animation/dig_up/sound/sound2.mcfunction @@ -1,7 +1,7 @@ ## by Tschipcraft -execute if block ~ ~ ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/sound/play_sound2 -execute if score $play_unsupport ts.sa.settings matches 1..2 unless block ~ ~ ~ #spawnanimations:supported unless block ~ ~ ~ #spawnanimations:nonsolid unless block ~ ~ ~ minecraft:bedrock unless block ~ ~ ~ minecraft:air run function spawnanimations:internal/animation/dig_up/sound/support +execute if score $play_sounds ts.sa.settings matches 1..2 if block ~ ~ ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/sound/play_sound2 +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches 1..2 unless block ~ ~ ~ #spawnanimations:supported unless block ~ ~ ~ #spawnanimations:nonsolid unless block ~ ~ ~ minecraft:bedrock unless block ~ ~ ~ minecraft:air run function spawnanimations:internal/animation/dig_up/sound/support scoreboard players reset @s ts.sa.e.stage scoreboard players reset @s ts.sa.e.speed diff --git a/data/spawnanimations/function/internal/animation/dig_up/start.mcfunction b/data/spawnanimations/function/internal/animation/dig_up/start.mcfunction index f4e19ea..e96b139 100644 --- a/data/spawnanimations/function/internal/animation/dig_up/start.mcfunction +++ b/data/spawnanimations/function/internal/animation/dig_up/start.mcfunction @@ -18,16 +18,13 @@ function spawnanimations:internal/entity/protect # Prevent animation midair execute if block ~ ~-0.5 ~ #spawnanimations:nonsolid run function spawnanimations:internal/animation/dig_up/verify_in_air -execute if entity @s[type=minecraft:giant] unless block ~ ~-1 ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/verify_in_air +execute as @s[type=minecraft:giant] unless block ~ ~-1 ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/verify_in_air # Prevent animation on bedrock execute if block ~ ~-0.5 ~ minecraft:bedrock run function spawnanimations:internal/animation/dig_up/verify_in_air # Prevent animation in mob crusher -execute if entity @e[type=!#spawnanimations:exclude,distance=0.001..1.1] run function spawnanimations:internal/animation/dig_up/verify_in_air +execute as @s[tag=ts.sa.verify] if entity @e[type=!#spawnanimations:exclude,distance=0.001..0.9] run function spawnanimations:internal/animation/dig_up/verify_in_air # Prevent animation on unsupported blocks if disabled -execute if score $play_unsupport ts.sa.settings matches -1..0 unless block ~ ~-0.5 ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/verify_in_air - -# I don't remember why I put this here -#execute as @s[tag=ts.sa.to_verify] positioned ~ ~0.2 ~ align y unless block ~ ~ ~ #spawnanimations:exclude unless block ~ ~-1 ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/verify_in_air +execute as @s[tag=ts.sa.verify] if score $play_unsupport ts.sa.settings matches -1..0 unless block ~ ~-0.5 ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/verify_in_air diff --git a/data/spawnanimations/function/internal/animation/dig_up/verify.mcfunction b/data/spawnanimations/function/internal/animation/dig_up/verify.mcfunction index 68f2f73..8ef2de4 100644 --- a/data/spawnanimations/function/internal/animation/dig_up/verify.mcfunction +++ b/data/spawnanimations/function/internal/animation/dig_up/verify.mcfunction @@ -4,6 +4,7 @@ tag @s add ts.sa.verified tag @s remove ts.sa.verify # Reset entity info +scoreboard players set @s ts.sa.timer 100 scoreboard players reset @s ts.sa.e.y scoreboard players reset @s ts.sa.e.stage scoreboard players reset @s ts.sa.e.speed diff --git a/data/spawnanimations/function/internal/animation/dig_up/verify_in_air.mcfunction b/data/spawnanimations/function/internal/animation/dig_up/verify_in_air.mcfunction index fea236c..36949b2 100644 --- a/data/spawnanimations/function/internal/animation/dig_up/verify_in_air.mcfunction +++ b/data/spawnanimations/function/internal/animation/dig_up/verify_in_air.mcfunction @@ -1,9 +1,10 @@ ## by Tschipcraft +# The "Poof" animation tag @s remove ts.sa.verify tag @s remove ts.sa.to_verify function spawnanimations:internal/entity/unhide function spawnanimations:internal/entity/unprotect -particle minecraft:spit ~ ~1 ~ 0 0.3 0 0.2 15 normal -playsound minecraft:entity.llama.spit hostile @a ~ ~ ~ 0.75 0 +execute if score $enable_poof_anim ts.sa.settings matches 1..2 run particle minecraft:spit ~ ~1 ~ 0 0.3 0 0.2 10 normal +execute if score $enable_poof_anim ts.sa.settings matches 1..2 if score $play_sounds ts.sa.settings matches 1..2 run playsound minecraft:entity.llama.spit hostile @a ~ ~ ~ 0.75 0 function spawnanimations:internal/animation/dig_up/verify diff --git a/data/spawnanimations/function/internal/calc_activation.mcfunction b/data/spawnanimations/function/internal/calc_activation.mcfunction index 87139df..a2a77f1 100644 --- a/data/spawnanimations/function/internal/calc_activation.mcfunction +++ b/data/spawnanimations/function/internal/calc_activation.mcfunction @@ -2,9 +2,10 @@ # @s/~ ~ ~ is tested entity; $global is player position # Get position -execute store result score @s ts.sa.x run data get entity @s Pos[0] -execute store result score @s ts.sa.y run data get entity @s Pos[1] -execute store result score @s ts.sa.z run data get entity @s Pos[2] +data modify storage spawnanimations:temp Pos set from entity @s Pos +execute store result score @s ts.sa.x run data get storage spawnanimations:temp Pos[0] +execute store result score @s ts.sa.y run data get storage spawnanimations:temp Pos[1] +execute store result score @s ts.sa.z run data get storage spawnanimations:temp Pos[2] # Calculate diff scoreboard players operation @s ts.sa.x -= $global ts.sa.x @@ -12,12 +13,11 @@ scoreboard players operation @s ts.sa.y -= $global ts.sa.y scoreboard players operation @s ts.sa.z -= $global ts.sa.z # Make sure value is positive -scoreboard players set $minus ts.sa.x -1 -execute if score @s ts.sa.x matches ..0 run scoreboard players operation @s ts.sa.x *= $minus ts.sa.x -execute if score @s ts.sa.y matches ..0 run scoreboard players operation @s ts.sa.y *= $minus ts.sa.x -execute if score @s ts.sa.z matches ..0 run scoreboard players operation @s ts.sa.z *= $minus ts.sa.x +execute if score @s ts.sa.x matches ..0 run scoreboard players operation @s ts.sa.x *= #minus ts.sa.x +execute if score @s ts.sa.y matches ..0 run scoreboard players operation @s ts.sa.y *= #minus ts.sa.x +execute if score @s ts.sa.z matches ..0 run scoreboard players operation @s ts.sa.z *= #minus ts.sa.x -# Add dis together +# Add distances together scoreboard players operation @s ts.sa.x += @s ts.sa.y scoreboard players operation @s ts.sa.x += @s ts.sa.z diff --git a/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/hide.mcfunction b/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/hide.mcfunction new file mode 100644 index 0000000..8a42e7b --- /dev/null +++ b/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/hide.mcfunction @@ -0,0 +1,12 @@ +##by Tschipcraft +# Shrinks entities with an emissive layer to lowest possible scale (0.0625) +# We do this using a negative scale modifier to not disturb the base scale value + +attribute @s minecraft:scale modifier add spawnanimations.ehs.scale -1000000000000000000000000000000 add_value +tag @s add ts.sa.ehs.shrunk + +# Save initial position +data modify storage spawnanimations:temp Pos set from entity @s Pos +execute store result score @s ts.sa.prev_x run data get storage spawnanimations:temp Pos[0] 10 +execute store result score @s ts.sa.prev_y run data get storage spawnanimations:temp Pos[1] 10 +execute store result score @s ts.sa.prev_z run data get storage spawnanimations:temp Pos[2] 10 diff --git a/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance.mcfunction b/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance.mcfunction new file mode 100644 index 0000000..24e425f --- /dev/null +++ b/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance.mcfunction @@ -0,0 +1,32 @@ +##by Tschipcraft +# Shrunk entity @s is trying to escape an enclosure, when not to far away from its previous position we move it back + +# Get current position +data modify storage spawnanimations:temp Pos set from entity @s Pos +execute store result score #current ts.sa.prev_x run data get storage spawnanimations:temp Pos[0] 10 +execute store result score #current ts.sa.prev_y run data get storage spawnanimations:temp Pos[1] 10 +execute store result score #current ts.sa.prev_z run data get storage spawnanimations:temp Pos[2] 10 + +scoreboard players operation #previous ts.sa.prev_x = @s ts.sa.prev_x +scoreboard players operation #previous ts.sa.prev_y = @s ts.sa.prev_y +scoreboard players operation #previous ts.sa.prev_z = @s ts.sa.prev_z + +# Calculate diff +scoreboard players operation #previous ts.sa.prev_x -= #current ts.sa.prev_x +scoreboard players operation #previous ts.sa.prev_y -= #current ts.sa.prev_y +scoreboard players operation #previous ts.sa.prev_z -= #current ts.sa.prev_z + +# Make sure value is positive +execute if score #previous ts.sa.prev_x matches ..0 run scoreboard players operation #previous ts.sa.prev_x *= #minus ts.sa.x +execute if score #previous ts.sa.prev_y matches ..0 run scoreboard players operation #previous ts.sa.prev_y *= #minus ts.sa.x +execute if score #previous ts.sa.prev_z matches ..0 run scoreboard players operation #previous ts.sa.prev_z *= #minus ts.sa.x + +# Add distances together +scoreboard players operation #previous ts.sa.prev_x += #previous ts.sa.prev_y +scoreboard players operation #previous ts.sa.prev_x += #previous ts.sa.prev_z + +# Move entity back to previous location if it moved not too far (distance times 10) +execute if score #previous ts.sa.prev_x matches ..30 run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/move_back + +# Trigger animation any way +function spawnanimations:internal/animation/dig_up/start diff --git a/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_enclosure.mcfunction b/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_enclosure.mcfunction new file mode 100644 index 0000000..295fa4e --- /dev/null +++ b/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_enclosure.mcfunction @@ -0,0 +1,28 @@ +##by Tschipcraft +# Checks if shrunk entity @s is trying to escape a potential enclosure + +# Inside block +execute unless block ~ ~ ~ #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance + +# Model default enderman hitbox size +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^0.3 ^1.5 ^0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^0.3 ^1.5 ^-0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^-0.3 ^1.5 ^0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^-0.3 ^1.5 ^-0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^0.3 ^2.9 ^0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^0.3 ^2.9 ^-0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^-0.3 ^2.9 ^0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^-0.3 ^2.9 ^-0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance + +# Model default spider hitbox size +execute as @s[type=minecraft:spider,tag=ts.sa.to_verify] unless block ~0.7 ~ ~0.7 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:spider,tag=ts.sa.to_verify] unless block ~0.7 ~ ~-0.7 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:spider,tag=ts.sa.to_verify] unless block ~-0.7 ~ ~-0.7 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:spider,tag=ts.sa.to_verify] unless block ~-0.7 ~ ~0.7 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:spider,tag=ts.sa.to_verify] unless block ~ ~0.9 ~ #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance + +# Update position +execute if entity @s[tag=ts.sa.to_verify] run data modify storage spawnanimations:temp Pos set from entity @s Pos +execute if entity @s[tag=ts.sa.to_verify] store result score @s ts.sa.prev_x run data get storage spawnanimations:temp Pos[0] 10 +execute if entity @s[tag=ts.sa.to_verify] store result score @s ts.sa.prev_y run data get storage spawnanimations:temp Pos[1] 10 +execute if entity @s[tag=ts.sa.to_verify] store result score @s ts.sa.prev_z run data get storage spawnanimations:temp Pos[2] 10 diff --git a/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/move_back.mcfunction b/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/move_back.mcfunction new file mode 100644 index 0000000..1b3a623 --- /dev/null +++ b/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/move_back.mcfunction @@ -0,0 +1,6 @@ +##by Tschipcraft + +# Move back to previous position +execute store result entity @s Pos[0] double 0.1 run scoreboard players get @s ts.sa.prev_x +execute store result entity @s Pos[1] double 0.1 run scoreboard players get @s ts.sa.prev_y +execute store result entity @s Pos[2] double 0.1 run scoreboard players get @s ts.sa.prev_z diff --git a/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/unhide.mcfunction b/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/unhide.mcfunction new file mode 100644 index 0000000..d20b183 --- /dev/null +++ b/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/unhide.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft +# Resets entities with an emissive layer that got their scale changed + +attribute @s minecraft:scale modifier remove spawnanimations.ehs.scale +tag @s remove ts.sa.ehs.shrunk diff --git a/data/spawnanimations/function/internal/entity/ehs/hide.mcfunction b/data/spawnanimations/function/internal/entity/ehs/hide.mcfunction index afc7988..af058fb 100644 --- a/data/spawnanimations/function/internal/entity/ehs/hide.mcfunction +++ b/data/spawnanimations/function/internal/entity/ehs/hide.mcfunction @@ -7,3 +7,10 @@ execute store result score @s ts.sa.e.nbt.Sil run data get entity @s Silent execute if score @s ts.sa.e.nbt.Sil matches 0 run data merge entity @s {Silent:1b} tag @s add ts.sa.to_hide effect give @s invisibility 10 0 true + +# Pehkui integration (overlay_pre_49) +execute if score $hide_emissive ts.sa.settings matches 1..2 run function spawnanimations:internal/entity/ehs/pehkui/hide + +# Entity specific +execute if score $hide_emissive ts.sa.settings matches 1..2 if entity @s[type=#spawnanimations:has_emissive_layer,tag=!ts.sa.ehs.pehkui.shrunk] run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/hide +execute if entity @s[type=minecraft:creeper] run function spawnanimations:internal/entity/ehs/entity_specific/creeper/hide diff --git a/data/spawnanimations/function/internal/entity/ehs/hide_exec.mcfunction b/data/spawnanimations/function/internal/entity/ehs/hide_exec.mcfunction index d550418..ae4fe4b 100644 --- a/data/spawnanimations/function/internal/entity/ehs/hide_exec.mcfunction +++ b/data/spawnanimations/function/internal/entity/ehs/hide_exec.mcfunction @@ -7,6 +7,3 @@ tag @s add ts.sa.hidden # Save Armor and Hand Items execute if score $hide_armor ts.sa.settings matches 1..2 as @s[type=#spawnanimations:can_wear_armor] run function spawnanimations:internal/entity/ehs/save_armor - -# Entity specific -execute if entity @s[type=minecraft:creeper] run function spawnanimations:internal/entity/ehs/entity_specific/creeper/hide diff --git a/data/spawnanimations/function/internal/entity/ehs/unhide.mcfunction b/data/spawnanimations/function/internal/entity/ehs/unhide.mcfunction index 04d2f60..3f8e32b 100644 --- a/data/spawnanimations/function/internal/entity/ehs/unhide.mcfunction +++ b/data/spawnanimations/function/internal/entity/ehs/unhide.mcfunction @@ -9,5 +9,7 @@ execute as @s[tag=ts.sa.ehs.saved] run function spawnanimations:internal/entity/ # Entity specific execute if entity @s[type=minecraft:creeper] run function spawnanimations:internal/entity/ehs/entity_specific/creeper/unhide +execute as @s[tag=ts.sa.ehs.shrunk] run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/unhide +execute as @s[tag=ts.sa.ehs.pehkui.shrunk] run function spawnanimations:internal/entity/ehs/pehkui/unhide tag @s remove ts.sa.hidden diff --git a/data/spawnanimations/function/internal/entity/get_animation_speed.mcfunction b/data/spawnanimations/function/internal/entity/get_animation_speed.mcfunction index bba451c..f6c63b9 100644 --- a/data/spawnanimations/function/internal/entity/get_animation_speed.mcfunction +++ b/data/spawnanimations/function/internal/entity/get_animation_speed.mcfunction @@ -1,5 +1,5 @@ ##by Tschipcraft -# This function sets the ts.sa.e.speed scoreboard depending on speed and slowness effects of the current entity (@s) +# Sets the ts.sa.e.speed scoreboard value depending on speed and slowness effects of the current entity (@s) scoreboard players set @s ts.sa.e.speed 0 execute if predicate spawnanimations:animation_speed/speed0 run scoreboard players add @s ts.sa.e.speed 1 diff --git a/data/spawnanimations/function/internal/entity/unprotect.mcfunction b/data/spawnanimations/function/internal/entity/unprotect.mcfunction index 6997817..0391862 100644 --- a/data/spawnanimations/function/internal/entity/unprotect.mcfunction +++ b/data/spawnanimations/function/internal/entity/unprotect.mcfunction @@ -1,6 +1,6 @@ ##by Tschipcraft -data merge entity @s {Fire:0s,FallDistance:0f,fall_distance:0f} +execute unless block ~ ~-0.5 ~ #spawnanimations:nonsolid run data merge entity @s {Fire:0s,FallDistance:0f,fall_distance:0f} execute if score @s ts.sa.e.nbt.Inv matches 0 run data merge entity @s {Invulnerable:0b} scoreboard players reset @s ts.sa.e.nbt.Inv execute if score @s ts.sa.e.nbt.Sil matches 0 run data merge entity @s {Silent:0b} diff --git a/data/spawnanimations/function/internal/run_activation_batch.mcfunction b/data/spawnanimations/function/internal/run_activation_batch.mcfunction index e66a35e..b89ab19 100644 --- a/data/spawnanimations/function/internal/run_activation_batch.mcfunction +++ b/data/spawnanimations/function/internal/run_activation_batch.mcfunction @@ -1,9 +1,11 @@ ##by Tschipcraft -# Get pos -execute store result score $global ts.sa.x run data get entity @s Pos[0] -execute store result score $global ts.sa.y run data get entity @s Pos[1] -execute store result score $global ts.sa.z run data get entity @s Pos[2] +# Get player position +data modify storage spawnanimations:temp Pos set from entity @s Pos +execute store result score $global ts.sa.x run data get storage spawnanimations:temp Pos[0] +execute store result score $global ts.sa.y run data get storage spawnanimations:temp Pos[1] +execute store result score $global ts.sa.z run data get storage spawnanimations:temp Pos[2] # Activate entities -execute as @e[type=!#spawnanimations:exclude,tag=ts.sa.to_verify,distance=..100,limit=10,sort=random] at @s run function spawnanimations:internal/calc_activation +execute if score $activation_dist ts.sa.settings matches 25..100 as @e[type=!#spawnanimations:exclude,tag=ts.sa.to_verify,distance=..100,limit=5,sort=random] at @s run function spawnanimations:internal/calc_activation +execute if score $activation_dist ts.sa.settings matches 1..24 as @e[type=!#spawnanimations:exclude,tag=ts.sa.to_verify,distance=..25,limit=1,sort=random] at @s run function spawnanimations:internal/calc_activation diff --git a/data/spawnanimations/function/internal/version_checker/start.mcfunction b/data/spawnanimations/function/internal/version_checker/start.mcfunction index a44c693..e566eff 100644 --- a/data/spawnanimations/function/internal/version_checker/start.mcfunction +++ b/data/spawnanimations/function/internal/version_checker/start.mcfunction @@ -7,4 +7,9 @@ execute unless score $global tvc_ignore matches 1 if score $version ts.sa.settin # Announce escape sequence handling changes execute unless score $global tvc_ignore matches 1 if score $version ts.sa.settings matches 4298..4316 run tellraw @a [{"text":"[Spawn Animations] ","color":"gray"},{"text":"!","bold":true,"color":"gold"},{"text":" Due to changes in escape sequence handling, all text menus (including the settings menu) are unavailable from 25w02a through 25w08a.","color":"gold"}] -execute if score $version ts.sa.settings matches 0 run function spawnanimations:internal/version_checker/retry +# Pehkui Integration +scoreboard players set $pehkui_installed ts.sa.settings 0 +function spawnanimations:internal/entity/ehs/pehkui/check_installed + +# Retry if version retrieval failed +execute unless score $version ts.sa.settings matches 1.. run function spawnanimations:internal/version_checker/retry diff --git a/data/spawnanimations/function/loop.mcfunction b/data/spawnanimations/function/loop.mcfunction index 88fe86f..102edfa 100644 --- a/data/spawnanimations/function/loop.mcfunction +++ b/data/spawnanimations/function/loop.mcfunction @@ -6,13 +6,18 @@ schedule function spawnanimations:loop 5t ## Supply invisibility to hidden entities execute as @e[type=!#spawnanimations:exclude,tag=ts.sa.to_verify,tag=!smithed.strict,tag=!ignore.global] run function spawnanimations:internal/entity/ehs/supply_invisibility -## Check for old formats (post-1.20.5) +## Check for old save formats (post-1.20.5) function spawnanimations:internal/entity/ehs/check_for_old_v0_format function spawnanimations:internal/entity/ehs/check_for_old_v1_format ## Validate hidden entities +# Check save format validity execute as @e[type=#spawnanimations:can_wear_armor,tag=ts.sa.to_verify,tag=ts.sa.ehs.saved] unless predicate spawnanimations:validate at @s run function spawnanimations:internal/entity/ehs/conflict/evaluate +# Escape protection for shrunk entities +execute as @e[type=#spawnanimations:has_emissive_layer,tag=ts.sa.to_verify,tag=ts.sa.ehs.shrunk] at @s run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_enclosure +execute if score $enderman_hack ts.sa.settings matches 1..2 as @e[type=minecraft:enderman,tag=ts.sa.to_verify,tag=ts.sa.ehs.pehkui.hitbox] at @s run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_enclosure + ## Remove problematic items execute as @e[type=minecraft:item,tag=!ts.sa.i.checked,tag=!global.ignore] run function spawnanimations:internal/entity/ehs/remove_invalid_item/check diff --git a/data/spawnanimations/function/main.mcfunction b/data/spawnanimations/function/main.mcfunction index 756fc04..48033f7 100644 --- a/data/spawnanimations/function/main.mcfunction +++ b/data/spawnanimations/function/main.mcfunction @@ -1,19 +1,19 @@ ## by Tschipcraft ## Finish hiding entities -execute as @e[type=!#spawnanimations:exclude,tag=ts.sa.to_hide] run function spawnanimations:internal/entity/ehs/hide_exec +execute as @e[type=!#spawnanimations:exclude,tag=ts.sa.to_hide,limit=5] run function spawnanimations:internal/entity/ehs/hide_exec ## Detect new mobs # To edit mobs that are affected, see ../tags/entity_types/dig_up_animation.json # Normal -execute if score $version ts.sa.settings matches 2587.. as @e[type=#spawnanimations:dig_up_animation,tag=!ts.sa.verify,tag=!ts.sa.verified,tag=!ts.sa.to_verify,tag=!ts.sa.to_hide,tag=!exclude,tag=!smithed.strict,tag=!smithed.block,tag=!global.ignore,tag=!global.ignore.pos,limit=10,sort=arbitrary] run function spawnanimations:internal/animation/dig_up/prepare +execute if score $version ts.sa.settings matches 2587.. as @e[type=#spawnanimations:dig_up_animation,tag=!ts.sa.verify,tag=!ts.sa.verified,tag=!ts.sa.to_verify,tag=!ts.sa.to_hide,tag=!ts.sa.exclude,tag=!smithed.strict,tag=!smithed.block,tag=!global.ignore,tag=!global.ignore.pos,limit=10,sort=arbitrary] run function spawnanimations:internal/animation/dig_up/prepare ## Animation trigger # Player nearby execute if score $global ts.sa.count matches ..100 as @a[gamemode=!spectator,sort=random,limit=5] at @s run function spawnanimations:internal/run_activation_batch # Exclusion criteria -execute if score $global ts.sa.count matches ..100 as @e[type=!#spawnanimations:exclude,predicate=!spawnanimations:trigger,tag=ts.sa.to_verify,limit=10,sort=random] at @s run function spawnanimations:internal/animation/dig_up/start +execute if score $global ts.sa.count matches ..100 as @e[type=!#spawnanimations:exclude,tag=ts.sa.to_verify,limit=10,sort=random] as @s[predicate=!spawnanimations:trigger] at @s run function spawnanimations:internal/animation/dig_up/start ## Tick dig up animation diff --git a/data/spawnanimations/function/reset.mcfunction b/data/spawnanimations/function/reset.mcfunction index aefd7cc..bc19629 100644 --- a/data/spawnanimations/function/reset.mcfunction +++ b/data/spawnanimations/function/reset.mcfunction @@ -5,7 +5,7 @@ execute as @e[tag=ts.sa.to_hide] run function spawnanimations:internal/entity/eh # Remove animation trigger execute as @e[tag=ts.sa.to_verify] at @s run function spawnanimations:internal/animation/dig_up/verify_in_air # Cancel animation -execute as @e[tag=ts.sa.verify] store result entity @s Pos[1] double 0.01 run scoreboard players get @s ts.sa.e.y +execute as @e[tag=ts.sa.verify,scores={ts.sa.e.y=-2147483648..2147483647}] store result entity @s Pos[1] double 0.01 run scoreboard players get @s ts.sa.e.y execute as @e[tag=ts.sa.verify] at @s run function spawnanimations:internal/animation/dig_up/verify_in_air # Reset checked items diff --git a/data/spawnanimations/function/settings/classic.mcfunction b/data/spawnanimations/function/settings/classic.mcfunction index e7d6b85..9202210 100644 --- a/data/spawnanimations/function/settings/classic.mcfunction +++ b/data/spawnanimations/function/settings/classic.mcfunction @@ -1,5 +1,5 @@ ##by Tschipcraft -tellraw @s ["",{"text":"\n-> Set activation mode to "},{"text":"[classic]","color":"yellow"}] +tellraw @s ["",{"text":"\n-> Set Activation Mode to "},{"text":"[Classic]","color":"yellow"}] scoreboard players set $activation_mode ts.sa.settings 1 function #spawnanimations:settings diff --git a/data/spawnanimations/function/settings/core.mcfunction b/data/spawnanimations/function/settings/core.mcfunction index 4c417ca..246a87b 100644 --- a/data/spawnanimations/function/settings/core.mcfunction +++ b/data/spawnanimations/function/settings/core.mcfunction @@ -2,25 +2,46 @@ tellraw @s {"text":"\n=-=Spawn Animations Settings=-=","bold":true,"color":"dark_green"} -execute unless score #lock_distance ts.sa.settings matches 1 if score $activation_dist ts.sa.settings matches ..1 run tellraw @s [{"text":"Activation Distance","bold":true,"hover_event":{"action":"show_text","value":[{"text":"Mobs closer to a player than this value will play the animation."}]}},{"text":" "},{"text":"<<< ","color":"gray","hover_event":{"action":"show_text","value":[{"text":"Min is 1","color":"red"}]}},{"score":{"name":"$activation_dist","objective":"ts.sa.settings"},"color":"green","bold":true},{"text":" block","color":"green"},{"text":" >>>","color":"aqua","hover_event":{"action":"show_text","value":[{"text":"+1"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/increase"}},{"text":" [\u270e]","color":"gray","click_event":{"action":"suggest_command","command":"/scoreboard players set @s ts.sa.distance "},"hover_event":{"action":"show_text","value":"Edit"}}] -execute unless score #lock_distance ts.sa.settings matches 1 if score $activation_dist ts.sa.settings matches 2..99 run tellraw @s [{"text":"Activation Distance","bold":true,"hover_event":{"action":"show_text","value":[{"text":"Mobs closer to a player than this value will play the animation."}]}},{"text":" "},{"text":"<<< ","color":"aqua","hover_event":{"action":"show_text","value":[{"text":"-1"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/decrease"}},{"score":{"name":"$activation_dist","objective":"ts.sa.settings"},"color":"green","bold":true},{"text":" blocks","color":"green"},{"text":" >>>","color":"aqua","hover_event":{"action":"show_text","value":[{"text":"+1"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/increase"}},{"text":" [\u270e]","color":"gray","click_event":{"action":"suggest_command","command":"/scoreboard players set @s ts.sa.distance "},"hover_event":{"action":"show_text","value":"Edit"}}] -execute unless score #lock_distance ts.sa.settings matches 1 if score $activation_dist ts.sa.settings matches 100.. run tellraw @s [{"text":"Activation Distance","bold":true,"hover_event":{"action":"show_text","value":[{"text":"Mobs closer to you than this value will play the animation"}]}},{"text":" "},{"text":"<<< ","color":"aqua","hover_event":{"action":"show_text","value":[{"text":"-1"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/decrease"}},{"score":{"name":"$activation_dist","objective":"ts.sa.settings"},"color":"green","bold":true},{"text":" blocks","color":"green"},{"text":" >>>","color":"gray","hover_event":{"action":"show_text","value":[{"text":"Max is 100","color":"red"}]}},{"text":" [\u270e]","color":"gray","click_event":{"action":"suggest_command","command":"/scoreboard players set @s ts.sa.distance "},"hover_event":{"action":"show_text","value":"Edit"}}] -execute if score #lock_distance ts.sa.settings matches 1 run tellraw @s [{"text":"Activation Distance <<< ","bold":false,"color":"gray","hover_event":{"action":"show_text","value":[{"text":"This setting is getting controlled globally and can't be changed here."}]}},{"score":{"name":"$activation_dist","objective":"ts.sa.settings"}},{"text":" blocks >>>"}] - -execute if score $activation_mode ts.sa.settings matches 1 run tellraw @s ["",{"text":"Activation mode","bold":true},{"text":" "},{"text":"[>classic<]","color":"green","bold":true,"hover_event":{"action":"show_text","value":[{"text":"Out of range mobs will stay hidden until a player is in range."}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/classic"}},{"text":" | "},{"text":"[vanilla]","color":"red","hover_event":{"action":"show_text","value":[{"text":"Out of range mobs will spawn normally."}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/vanilla"}}] -execute if score $activation_mode ts.sa.settings matches 0 run tellraw @s ["",{"text":"Activation mode","bold":true},{"text":" "},{"text":"[classic]","color":"red","hover_event":{"action":"show_text","value":[{"text":"Out of range mobs will stay hidden until a player is in range."}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/classic"}},{"text":" | "},{"text":"[>vanilla<]","color":"green","bold":true,"hover_event":{"action":"show_text","value":[{"text":"Out of range mobs will spawn normally."}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/vanilla"}}] -execute if score $activation_mode ts.sa.settings matches -1 run tellraw @s [{"text":"Activation mode [classic] | [>vanilla<]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] -execute if score $activation_mode ts.sa.settings matches 2 run tellraw @s [{"text":"Activation mode [>classic<] | [vanilla]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] - -execute if score $hide_armor ts.sa.settings matches 1 run tellraw @s ["",{"text":"Hide worn armor and tools","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hover_event":{"action":"show_text","value":[{"text":"Worn armor and tools will be hidden. "},{"text":"\n⚠ Note: This feature may impact worn armor and tool drop rates inside farms.","color":"gold"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_hidearmorandtools"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hover_event":{"action":"show_text","value":"Worn armor and tools will not be hidden."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_hidearmorandtools"}}] -execute if score $hide_armor ts.sa.settings matches 0 run tellraw @s ["",{"text":"Hide worn armor and tools","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hover_event":{"action":"show_text","value":[{"text":"Worn armor and tools will be hidden. "},{"text":"\n⚠ Note: This feature may impact worn armor and tool drop rates inside farms.","color":"gold"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_hidearmorandtools"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hover_event":{"action":"show_text","value":"Worn armor and tools will not be hidden."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_hidearmorandtools"}}] -execute if score $hide_armor ts.sa.settings matches -1 run tellraw @s [{"text":"Hide worn armor and tools [✔] | [>❌<]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] -execute if score $hide_armor ts.sa.settings matches 2 run tellraw @s [{"text":"Hide worn armor and tools [>✔<] | [❌]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] - -execute if score $play_unsupport ts.sa.settings matches 1 run tellraw @s ["",{"text":"Play animation on unsupported blocks","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hover_event":{"action":"show_text","value":[{"text":"The block break animation is played on unsupported blocks. "},{"text":"\n⚠ Note: This could lead to unwanted block updates.","color":"gold"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_allblocksupport"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hover_event":{"action":"show_text","value":"The block break animation will not be played on unsupported blocks."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_allblocksupport"}}] -execute if score $play_unsupport ts.sa.settings matches 0 run tellraw @s ["",{"text":"Play animation on unsupported blocks","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hover_event":{"action":"show_text","value":[{"text":"The block break animation is played on unsupported blocks. "},{"text":"\n⚠ Note: This could lead to unwanted block updates.","color":"gold"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_allblocksupport"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hover_event":{"action":"show_text","value":"The block break animation will not be played on unsupported blocks."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_allblocksupport"}}] -execute if score $play_unsupport ts.sa.settings matches -1 run tellraw @s [{"text":"Play animation on unsupported blocks [✔] | [>❌<]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] -execute if score $play_unsupport ts.sa.settings matches 2 run tellraw @s [{"text":"Play animation on unsupported blocks [>✔<] | [❌]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute unless score #lock_distance ts.sa.settings matches 1 if score $activation_dist ts.sa.settings matches ..1 run tellraw @s [{"text":"Activation Distance","bold":true,"hover_event":{"action":"show_text","value":"Mobs closer to a player than this value will play the animation."}},{"text":" "},{"text":"<<< ","color":"gray","hover_event":{"action":"show_text","value":[{"text":"Min is 1","color":"red"}]}},{"score":{"name":"$activation_dist","objective":"ts.sa.settings"},"color":"green","bold":true},{"text":" block","color":"green"},{"text":" >>>","color":"aqua","hover_event":{"action":"show_text","value":"+1"},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/increase"}},{"text":" [\u270e]","color":"gray","click_event":{"action":"suggest_command","command":"/scoreboard players set @s ts.sa.distance "},"hover_event":{"action":"show_text","value":"Edit"}}] +execute unless score #lock_distance ts.sa.settings matches 1 if score $activation_dist ts.sa.settings matches 2..99 run tellraw @s [{"text":"Activation Distance","bold":true,"hover_event":{"action":"show_text","value":"Mobs closer to a player than this value will play the animation."}},{"text":" "},{"text":"<<< ","color":"aqua","hover_event":{"action":"show_text","value":"-1"},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/decrease"}},{"score":{"name":"$activation_dist","objective":"ts.sa.settings"},"color":"green","bold":true},{"text":" blocks","color":"green"},{"text":" >>>","color":"aqua","hover_event":{"action":"show_text","value":"+1"},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/increase"}},{"text":" [\u270e]","color":"gray","click_event":{"action":"suggest_command","command":"/scoreboard players set @s ts.sa.distance "},"hover_event":{"action":"show_text","value":"Edit"}}] +execute unless score #lock_distance ts.sa.settings matches 1 if score $activation_dist ts.sa.settings matches 100.. run tellraw @s [{"text":"Activation Distance","bold":true,"hover_event":{"action":"show_text","value":"Mobs closer to you than this value will play the animation"}},{"text":" "},{"text":"<<< ","color":"aqua","hover_event":{"action":"show_text","value":"-1"},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/decrease"}},{"score":{"name":"$activation_dist","objective":"ts.sa.settings"},"color":"green","bold":true},{"text":" blocks","color":"green"},{"text":" >>>","color":"gray","hover_event":{"action":"show_text","value":[{"text":"Max is 100","color":"red"}]}},{"text":" [\u270e]","color":"gray","click_event":{"action":"suggest_command","command":"/scoreboard players set @s ts.sa.distance "},"hover_event":{"action":"show_text","value":"Edit"}}] +execute if score #lock_distance ts.sa.settings matches 1 run tellraw @s [{"text":"Activation Distance <<< ","bold":false,"color":"gray","hover_event":{"action":"show_text","value":"This setting is getting controlled globally and can't be changed here."}},{"score":{"name":"$activation_dist","objective":"ts.sa.settings"}},{"text":" blocks >>>"}] + +execute if score $activation_mode ts.sa.settings matches 1 run tellraw @s ["",{"text":"Activation Mode","bold":true},{"text":" "},{"text":"[>Classic<]","color":"green","bold":true,"hover_event":{"action":"show_text","value":[{"text":"Mobs outside the activation range remain hidden until a player is in range."}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/classic"}},{"text":" | "},{"text":"[Vanilla]","color":"red","hover_event":{"action":"show_text","value":[{"text":"Mobs outside the activation range spawn normally."}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/vanilla"}}] +execute if score $activation_mode ts.sa.settings matches 0 run tellraw @s ["",{"text":"Activation Mode","bold":true},{"text":" "},{"text":"[Classic]","color":"red","hover_event":{"action":"show_text","value":[{"text":"Mobs outside the activation range remain hidden until a player is in range."}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/classic"}},{"text":" | "},{"text":"[>Vanilla<]","color":"green","bold":true,"hover_event":{"action":"show_text","value":[{"text":"Mobs outside the activation range spawn normally."}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/vanilla"}}] +execute if score $activation_mode ts.sa.settings matches -1 run tellraw @s [{"text":"Activation Mode [Classic] | [>Vanilla<]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":"This setting is getting controlled globally and can't be changed here."}}] +execute if score $activation_mode ts.sa.settings matches 2 run tellraw @s [{"text":"Activation Mode [>Classic<] | [Vanilla]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":"This setting is getting controlled globally and can't be changed here."}}] + +execute if score $enable_poof_anim ts.sa.settings matches 1 run tellraw @s ["",{"text":"Enable Poof Animation","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hover_event":{"action":"show_text","value":"If enabled, some mobs, or mobs without a block to dig up from, will play the poof animation instead."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_poofanim"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hover_event":{"action":"show_text","value":"Poof animation will not be played."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_poofanim"}}] +execute if score $enable_poof_anim ts.sa.settings matches 0 run tellraw @s ["",{"text":"Enable Poof Animation","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hover_event":{"action":"show_text","value":"If enabled, some mobs, or mobs without a block to dig up from, will play the poof animation instead."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_poofanim"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hover_event":{"action":"show_text","value":"Poof animation will not be played."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_poofanim"}}] +execute if score $enable_poof_anim ts.sa.settings matches -1 run tellraw @s [{"text":"Enable Poof Animation [✔] | [>❌<]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":"This setting is getting controlled globally and can't be changed here."}}] +execute if score $enable_poof_anim ts.sa.settings matches 2 run tellraw @s [{"text":"Enable Poof Animation [>✔<] | [❌]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":"This setting is getting controlled globally and can't be changed here."}}] + +execute if score $play_sounds ts.sa.settings matches 1 run tellraw @s ["",{"text":"Play Animation Sounds","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hover_event":{"action":"show_text","value":"If enabled, sounds will be played during the animation."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_playsounds"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hover_event":{"action":"show_text","value":"Sounds will not be played."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_playsounds"}}] +execute if score $play_sounds ts.sa.settings matches 0 run tellraw @s ["",{"text":"Play Animation Sounds","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hover_event":{"action":"show_text","value":"If enabled, sounds will be played during the animation."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_playsounds"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hover_event":{"action":"show_text","value":"Sounds will not be played."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_playsounds"}}] +execute if score $play_sounds ts.sa.settings matches -1 run tellraw @s [{"text":"Play Animation Sounds [✔] | [>❌<]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":"This setting is getting controlled globally and can't be changed here."}}] +execute if score $play_sounds ts.sa.settings matches 2 run tellraw @s [{"text":"Play Animation Sounds [>✔<] | [❌]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":"This setting is getting controlled globally and can't be changed here."}}] + +execute if score $hide_armor ts.sa.settings matches 1 run tellraw @s ["",{"text":"Hide Worn Armor and Tools","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hover_event":{"action":"show_text","value":[{"text":"If enabled, stores the worn armor and tools in the body, feet, or in some versions, leggings slot of a hidden entity. "},{"text":"\n⚠ Note: This may impact worn armor and tool drop rates from mob farms.","color":"gold"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_hidearmorandtools"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hover_event":{"action":"show_text","value":"Worn armor and tools will not be hidden."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_hidearmorandtools"}}] +execute if score $hide_armor ts.sa.settings matches 0 run tellraw @s ["",{"text":"Hide Worn Armor and Tools","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hover_event":{"action":"show_text","value":[{"text":"If enabled, stores the worn armor and tools in the body, feet, or in some versions, leggings slot of a hidden entity. "},{"text":"\n⚠ Note: This may impact worn armor and tool drop rates from mob farms when enabled.","color":"gold"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_hidearmorandtools"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hover_event":{"action":"show_text","value":"Worn armor and tools will not be hidden."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_hidearmorandtools"}}] +execute if score $hide_armor ts.sa.settings matches -1 run tellraw @s [{"text":"Hide Worn Armor and Tools [✔] | [>❌<]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":"This setting is getting controlled globally and can't be changed here."}}] +execute if score $hide_armor ts.sa.settings matches 2 run tellraw @s [{"text":"Hide Worn Armor and Tools [>✔<] | [❌]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":"This setting is getting controlled globally and can't be changed here."}}] + +execute if score $hide_emissive ts.sa.settings matches 1 run tellraw @s ["",{"text":"Hide Emissive Mob Layers","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hover_event":{"action":"show_text","value":[{"text":"If enabled, emissive layers of some mobs (e.g., Endermen, Spiders, and Cave Spiders), or with Pehkui all mobs, will be hidden by shrinking them."},{"text":"\n⚠ Note: This may decrease the efficiency of mob farms due to the changed hitbox size for hidden entities when Pehkui is not installed and the feature is enabled.","color":"gold"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_hideemissive"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hover_event":{"action":"show_text","value":"Emissive layers will not be hidden."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_hideemissive"}}] +execute if score $hide_emissive ts.sa.settings matches 0 run tellraw @s ["",{"text":"Hide Emissive Mob Layers","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hover_event":{"action":"show_text","value":[{"text":"If enabled, emissive layers of some mobs (e.g., Endermen, Spiders, and Cave Spiders), or with Pehkui all mobs, will be hidden by shrinking them."},{"text":"\n⚠ Note: This may decrease the efficiency of mob farms due to the changed hitbox size for hidden entities when Pehkui is not installed and the feature is enabled.","color":"gold"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_hideemissive"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hover_event":{"action":"show_text","value":"Emissive layers will not be hidden."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_hideemissive"}}] +execute if score $hide_emissive ts.sa.settings matches -1 run tellraw @s [{"text":"Hide Emissive Mob Layers [✔] | [>❌<]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":"This setting is getting controlled globally and can't be changed here."}}] +execute if score $hide_emissive ts.sa.settings matches 2 run tellraw @s [{"text":"Hide Emissive Mob Layers [>✔<] | [❌]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":"This setting is getting controlled globally and can't be changed here."}}] + +execute if score $pehkui_installed ts.sa.settings matches 1 if score $enderman_hack ts.sa.settings matches 1 run tellraw @s ["",{"text":"Reduce Hidden Enderman Particles","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hover_event":{"action":"show_text","value":[{"text":"If enabled, the number of particles emitted by hidden Endermen will be reduced by shrinking their hitbox scale."},{"text":"\n⚠ Note: This may decrease the efficiency of Enderman mob farms.","color":"gold"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_reduceendermanparticles"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hover_event":{"action":"show_text","value":"Hidden Enderman particles will not be reduced."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_reduceendermanparticles"}}] +execute if score $pehkui_installed ts.sa.settings matches 1 if score $enderman_hack ts.sa.settings matches 0 run tellraw @s ["",{"text":"Reduce Hidden Enderman Particles","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hover_event":{"action":"show_text","value":[{"text":"If enabled, the number of particles emitted by hidden Endermen will be reduced by shrinking their hitbox scale."},{"text":"\n⚠ Note: This may decrease the efficiency of Enderman mob farms when enabled.","color":"gold"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_reduceendermanparticles"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hover_event":{"action":"show_text","value":"Hidden Enderman particles will not be reduced."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_reduceendermanparticles"}}] +execute if score $enderman_hack ts.sa.settings matches -1 run tellraw @s [{"text":"Reduce Hidden Enderman Particles [✔] | [>❌<]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":"This setting is getting controlled globally and can't be changed here. Only applicable when Pehkui is installed."}}] +execute if score $enderman_hack ts.sa.settings matches 2 run tellraw @s [{"text":"Reduce Hidden Enderman Particles [>✔<] | [❌]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":"This setting is getting controlled globally and can't be changed here. Only applicable when Pehkui is installed."}}] + +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches 1 run tellraw @s ["",{"text":"Play Animation on Unsupported Blocks","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hover_event":{"action":"show_text","value":[{"text":"If enabled, the block breaking animation plays on blocks that are not hard-coded into the data pack. "},{"text":"\n⚠ Note: This could lead to unwanted block updates.","color":"gold"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_allblocksupport"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hover_event":{"action":"show_text","value":"The block breaking animation will not be played on unsupported blocks."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_allblocksupport"}}] +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches 0 run tellraw @s ["",{"text":"Play Animation on Unsupported Blocks","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hover_event":{"action":"show_text","value":[{"text":"If enabled, the block breaking animation plays on blocks that are not hard-coded into the data pack. "},{"text":"\n⚠ Note: This could lead to unwanted block updates.","color":"gold"}]},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/enable_allblocksupport"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hover_event":{"action":"show_text","value":"The block breaking animation will not be played on unsupported blocks."},"click_event":{"action":"run_command","command":"/function spawnanimations:settings/disable_allblocksupport"}}] +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches -1 run tellraw @s [{"text":"Play Animation on Unsupported Blocks [✔] | [>❌<]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":"This setting is getting controlled globally and can't be changed here."}}] +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches 2 run tellraw @s [{"text":"Play Animation on Unsupported Blocks [>✔<] | [❌]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":"This setting is getting controlled globally and can't be changed here."}}] +execute if score $play_sounds ts.sa.settings matches -1..0 run tellraw @s [{"text":"Play Animation on Unsupported Blocks [✔] | [>❌<]","bold":false,"color":"gray","hover_event":{"action":"show_text","value":[{"text":"Enable [Play Animation Sounds] first."}]}}] function spawnanimations:settings/hide_feedback/main playsound minecraft:block.dispenser.dispense master @s ~ ~ ~ 0.2 2 diff --git a/data/spawnanimations/function/settings/defaults.mcfunction b/data/spawnanimations/function/settings/defaults.mcfunction index 873311f..c1ff454 100644 --- a/data/spawnanimations/function/settings/defaults.mcfunction +++ b/data/spawnanimations/function/settings/defaults.mcfunction @@ -5,5 +5,9 @@ execute unless score $activation_dist ts.sa.settings matches 1..100 run scoreboard players set $activation_dist ts.sa.settings 20 execute unless score #lock_distance ts.sa.settings matches 0..1 run scoreboard players set #lock_distance ts.sa.settings 0 execute unless score $activation_mode ts.sa.settings matches -1..2 run scoreboard players set $activation_mode ts.sa.settings 1 +execute unless score $enable_poof_anim ts.sa.settings matches -1..2 run scoreboard players set $enable_poof_anim ts.sa.settings 1 +execute unless score $play_sounds ts.sa.settings matches -1..2 run scoreboard players set $play_sounds ts.sa.settings 1 execute unless score $hide_armor ts.sa.settings matches -1..2 run scoreboard players set $hide_armor ts.sa.settings 1 +execute unless score $hide_emissive ts.sa.settings matches -1..2 run scoreboard players set $hide_emissive ts.sa.settings 1 +execute unless score $enderman_hack ts.sa.settings matches -1..2 run scoreboard players set $enderman_hack ts.sa.settings 1 execute unless score $play_unsupport ts.sa.settings matches -1..2 run scoreboard players set $play_unsupport ts.sa.settings 0 diff --git a/data/spawnanimations/function/settings/disable_allblocksupport.mcfunction b/data/spawnanimations/function/settings/disable_allblocksupport.mcfunction index 0db9e55..054aaec 100644 --- a/data/spawnanimations/function/settings/disable_allblocksupport.mcfunction +++ b/data/spawnanimations/function/settings/disable_allblocksupport.mcfunction @@ -1,5 +1,5 @@ ##by Tschipcraft -tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Play animation on unsupported blocks]","color":"yellow"}] +tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Play Animation on Unsupported Blocks]","color":"yellow"}] scoreboard players set $play_unsupport ts.sa.settings 0 function #spawnanimations:settings diff --git a/data/spawnanimations/function/settings/disable_hidearmorandtools.mcfunction b/data/spawnanimations/function/settings/disable_hidearmorandtools.mcfunction index 92ba91d..9858741 100644 --- a/data/spawnanimations/function/settings/disable_hidearmorandtools.mcfunction +++ b/data/spawnanimations/function/settings/disable_hidearmorandtools.mcfunction @@ -1,5 +1,6 @@ ##by Tschipcraft -tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Hide armor and tools]","color":"yellow"}] +tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Hide Worn Armor and Tools]","color":"yellow"}] +tellraw @s ["",{"text":"ℹ Info: ","color":"blue"},{"text":"This change only applies to new mobs"}] scoreboard players set $hide_armor ts.sa.settings 0 function #spawnanimations:settings diff --git a/data/spawnanimations/function/settings/disable_hideemissive.mcfunction b/data/spawnanimations/function/settings/disable_hideemissive.mcfunction new file mode 100644 index 0000000..cc178f5 --- /dev/null +++ b/data/spawnanimations/function/settings/disable_hideemissive.mcfunction @@ -0,0 +1,7 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Hide Emissive Mob Layers]","color":"yellow"}] +scoreboard players set $hide_emissive ts.sa.settings 0 +execute as @e[type=!#spawnanimations:exclude,tag=ts.sa.ehs.shrunk] run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/unhide +execute as @e[type=!#spawnanimations:exclude,tag=ts.sa.ehs.pehkui.shrunk] run function spawnanimations:internal/entity/ehs/pehkui/unhide +function #spawnanimations:settings diff --git a/data/spawnanimations/function/settings/disable_playsounds.mcfunction b/data/spawnanimations/function/settings/disable_playsounds.mcfunction new file mode 100644 index 0000000..8333762 --- /dev/null +++ b/data/spawnanimations/function/settings/disable_playsounds.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Play Animation Sounds]","color":"yellow"}] +scoreboard players set $play_sounds ts.sa.settings 0 +function #spawnanimations:settings diff --git a/data/spawnanimations/function/settings/disable_poofanim.mcfunction b/data/spawnanimations/function/settings/disable_poofanim.mcfunction new file mode 100644 index 0000000..62139ca --- /dev/null +++ b/data/spawnanimations/function/settings/disable_poofanim.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Enable Poof Animation]","color":"yellow"}] +scoreboard players set $enable_poof_anim ts.sa.settings 0 +function #spawnanimations:settings diff --git a/data/spawnanimations/function/settings/disable_reduceendermanparticles.mcfunction b/data/spawnanimations/function/settings/disable_reduceendermanparticles.mcfunction new file mode 100644 index 0000000..b6ae018 --- /dev/null +++ b/data/spawnanimations/function/settings/disable_reduceendermanparticles.mcfunction @@ -0,0 +1,6 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Reduce Hidden Enderman Particles]","color":"yellow"}] +tellraw @s ["",{"text":"ℹ Info: ","color":"blue"},{"text":"This change only applies to new mobs"}] +scoreboard players set $enderman_hack ts.sa.settings 0 +function #spawnanimations:settings diff --git a/data/spawnanimations/function/settings/enable_allblocksupport.mcfunction b/data/spawnanimations/function/settings/enable_allblocksupport.mcfunction index e563573..8430335 100644 --- a/data/spawnanimations/function/settings/enable_allblocksupport.mcfunction +++ b/data/spawnanimations/function/settings/enable_allblocksupport.mcfunction @@ -1,5 +1,5 @@ ##by Tschipcraft -tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Play animation on unsupported blocks]","color":"yellow"}] +tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Play Animation on Unsupported Blocks]","color":"yellow"}] scoreboard players set $play_unsupport ts.sa.settings 1 function #spawnanimations:settings diff --git a/data/spawnanimations/function/settings/enable_hidearmorandtools.mcfunction b/data/spawnanimations/function/settings/enable_hidearmorandtools.mcfunction index 74dbc63..bbe4aa4 100644 --- a/data/spawnanimations/function/settings/enable_hidearmorandtools.mcfunction +++ b/data/spawnanimations/function/settings/enable_hidearmorandtools.mcfunction @@ -1,5 +1,6 @@ ##by Tschipcraft -tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Hide armor and tools]","color":"yellow"}] +tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Hide Worn Armor and Tools]","color":"yellow"}] +tellraw @s ["",{"text":"ℹ Info: ","color":"blue"},{"text":"This change only applies to new mobs"}] scoreboard players set $hide_armor ts.sa.settings 1 function #spawnanimations:settings diff --git a/data/spawnanimations/function/settings/enable_hideemissive.mcfunction b/data/spawnanimations/function/settings/enable_hideemissive.mcfunction new file mode 100644 index 0000000..4466bc8 --- /dev/null +++ b/data/spawnanimations/function/settings/enable_hideemissive.mcfunction @@ -0,0 +1,6 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Hide Emissive Mob Layers]","color":"yellow"}] +tellraw @s ["",{"text":"ℹ Info: ","color":"blue"},{"text":"This change only applies to new mobs"}] +scoreboard players set $hide_emissive ts.sa.settings 1 +function #spawnanimations:settings diff --git a/data/spawnanimations/function/settings/enable_playsounds.mcfunction b/data/spawnanimations/function/settings/enable_playsounds.mcfunction new file mode 100644 index 0000000..2ce58f9 --- /dev/null +++ b/data/spawnanimations/function/settings/enable_playsounds.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Play Animation Sounds]","color":"yellow"}] +scoreboard players set $play_sounds ts.sa.settings 1 +function #spawnanimations:settings diff --git a/data/spawnanimations/function/settings/enable_poofanim.mcfunction b/data/spawnanimations/function/settings/enable_poofanim.mcfunction new file mode 100644 index 0000000..96482c7 --- /dev/null +++ b/data/spawnanimations/function/settings/enable_poofanim.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Enable Poof Animation]","color":"yellow"}] +scoreboard players set $enable_poof_anim ts.sa.settings 1 +function #spawnanimations:settings diff --git a/data/spawnanimations/function/settings/enable_reduceendermanparticles.mcfunction b/data/spawnanimations/function/settings/enable_reduceendermanparticles.mcfunction new file mode 100644 index 0000000..ee69c22 --- /dev/null +++ b/data/spawnanimations/function/settings/enable_reduceendermanparticles.mcfunction @@ -0,0 +1,6 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Reduce Hidden Enderman Particles]","color":"yellow"}] +tellraw @s ["",{"text":"ℹ Info: ","color":"blue"},{"text":"This change only applies to new mobs"}] +scoreboard players set $enderman_hack ts.sa.settings 1 +function #spawnanimations:settings diff --git a/data/spawnanimations/function/settings/vanilla.mcfunction b/data/spawnanimations/function/settings/vanilla.mcfunction index 87a1320..468f363 100644 --- a/data/spawnanimations/function/settings/vanilla.mcfunction +++ b/data/spawnanimations/function/settings/vanilla.mcfunction @@ -1,5 +1,6 @@ ##by Tschipcraft -tellraw @s ["",{"text":"\n-> Set activation mode to "},{"text":"[vanilla]","color":"yellow"}] +tellraw @s ["",{"text":"\n-> Set Activation Mode to "},{"text":"[Vanilla]","color":"yellow"}] +execute if score $activation_dist ts.sa.settings matches ..24 run tellraw @s ["",{"text":"ℹ Info: ","color":"blue"},{"text":"It is recommended to set the activation distance to at least 25 blocks when using the vanilla activation mode to see the animation","hoverEvent":{"action":"show_text","contents":"Why? In vanilla, mobs do not spawn if a player is within a 24-block radius (spherical)"},"hover_event":{"action":"show_text","value":"Why? In vanilla, mobs do not spawn if a player is within a 24-block radius (spherical)"}}] scoreboard players set $activation_mode ts.sa.settings 0 function #spawnanimations:settings diff --git a/data/spawnanimations/function/uninstall.mcfunction b/data/spawnanimations/function/uninstall.mcfunction index ff3f2b6..f188b4c 100644 --- a/data/spawnanimations/function/uninstall.mcfunction +++ b/data/spawnanimations/function/uninstall.mcfunction @@ -17,6 +17,9 @@ scoreboard objectives remove ts.sa.welcome scoreboard objectives remove ts.sa.x scoreboard objectives remove ts.sa.y scoreboard objectives remove ts.sa.z +scoreboard objectives remove ts.sa.prev_x +scoreboard objectives remove ts.sa.prev_y +scoreboard objectives remove ts.sa.prev_z scoreboard objectives remove ts.sa.settings scoreboard objectives remove ts.sa.distance diff --git a/data/spawnanimations/functions/install.mcfunction b/data/spawnanimations/functions/install.mcfunction index f8ada66..3e44c3f 100644 --- a/data/spawnanimations/functions/install.mcfunction +++ b/data/spawnanimations/functions/install.mcfunction @@ -5,9 +5,16 @@ scoreboard objectives add ts.sa.timer dummy scoreboard objectives add ts.sa.count dummy scoreboard objectives add ts.sa.welcome trigger +# Activation distance calculation scoreboard objectives add ts.sa.x dummy scoreboard objectives add ts.sa.y dummy scoreboard objectives add ts.sa.z dummy +scoreboard players set #minus ts.sa.x -1 + +# Escape protection for shrunk/emissive entities (see emissive_layer in overlay_33) +scoreboard objectives add ts.sa.prev_x dummy +scoreboard objectives add ts.sa.prev_y dummy +scoreboard objectives add ts.sa.prev_z dummy # Entity properties scoreboard objectives add ts.sa.e.y dummy diff --git a/data/spawnanimations/functions/internal/animation/dig_up/prepare.mcfunction b/data/spawnanimations/functions/internal/animation/dig_up/prepare.mcfunction index eba7264..fd87a78 100644 --- a/data/spawnanimations/functions/internal/animation/dig_up/prepare.mcfunction +++ b/data/spawnanimations/functions/internal/animation/dig_up/prepare.mcfunction @@ -1,11 +1,17 @@ ## by Tschipcraft # Prepares an entity for hiding -# Exclude entities that have the glowing, levitation or invisibility potion effect, are riding another entity or are burning -execute as @s[predicate=!spawnanimations:exclude] run tag @s add ts.sa.verified -# Exclude silent or no ai mobs -execute as @s[tag=!ts.sa.verified,nbt={Silent:1b}] run tag @s add ts.sa.verified -execute as @s[tag=!ts.sa.verified,nbt={NoAI:1b}] run tag @s add ts.sa.verified +# Recover entity tags that may have been removed by other mods/data packs (Issue #26) +execute as @s[scores={ts.sa.timer=-300..99}] run function spawnanimations:internal/animation/dig_up/recover_tags/animating +execute as @s[scores={ts.sa.e.nbt.Sil=0},tag=!ts.sa.verify] run function spawnanimations:internal/animation/dig_up/recover_tags/hidden +tag @s[scores={ts.sa.timer=100}] add ts.sa.verified + +# Exclude entities that have the glowing, levitation or invisibility potion effect, are riding another entity, or are burning +execute as @s[tag=!ts.sa.verify,tag=!ts.sa.to_verify,predicate=!spawnanimations:exclude] run tag @s add ts.sa.verified + +# Exclude silent or no AI mobs +execute as @s[tag=!ts.sa.verified,tag=!ts.sa.verify,tag=!ts.sa.to_verify,nbt={Silent:1b}] run tag @s add ts.sa.verified +execute as @s[tag=!ts.sa.verified,tag=!ts.sa.verify,tag=!ts.sa.to_verify,nbt={NoAI:1b}] run tag @s add ts.sa.verified # Hide the entity -execute as @s[tag=!ts.sa.verified] run function spawnanimations:internal/entity/hide +execute as @s[tag=!ts.sa.verified,tag=!ts.sa.verify,tag=!ts.sa.to_verify] run function spawnanimations:internal/entity/hide diff --git a/data/spawnanimations/functions/internal/animation/dig_up/recover_tags/animating.mcfunction b/data/spawnanimations/functions/internal/animation/dig_up/recover_tags/animating.mcfunction new file mode 100644 index 0000000..7dc95c8 --- /dev/null +++ b/data/spawnanimations/functions/internal/animation/dig_up/recover_tags/animating.mcfunction @@ -0,0 +1,12 @@ +##by Tschipcraft +# Recovers entity tags that were removed by other mods/data packs during the dig up animation + +# We set every possible tag an entity in this state might have in hope that we can properly recover it +tag @s add ts.sa.verify +tag @s add ts.sa.protected + +tag @s add ts.sa.hidden +execute if score $hide_armor ts.sa.settings matches 1..2 run tag @s[type=#spawnanimations:can_wear_armor,predicate=spawnanimations:validate/save_format] add ts.sa.ehs.saved +execute if score $hide_emissive ts.sa.settings matches 1..2 run tag @s[type=#spawnanimations:has_emissive_layer] add ts.sa.ehs.shrunk +execute if score $hide_emissive ts.sa.settings matches 1..2 run tag @s add ts.sa.ehs.pehkui.shrunk +execute if score $enderman_hack ts.sa.settings matches 1..2 run tag @s[type=minecraft:enderman] add ts.sa.ehs.pehkui.hitbox diff --git a/data/spawnanimations/functions/internal/animation/dig_up/recover_tags/hidden.mcfunction b/data/spawnanimations/functions/internal/animation/dig_up/recover_tags/hidden.mcfunction new file mode 100644 index 0000000..c4a52ca --- /dev/null +++ b/data/spawnanimations/functions/internal/animation/dig_up/recover_tags/hidden.mcfunction @@ -0,0 +1,11 @@ +##by Tschipcraft +# Recovers entity tags that were removed by other mods/data packs when hidden + +# We set every possible tag an entity in this state might have in hope that we can properly recover it +tag @s add ts.sa.to_verify + +tag @s add ts.sa.hidden +execute if score $hide_armor ts.sa.settings matches 1..2 run tag @s[type=#spawnanimations:can_wear_armor,predicate=spawnanimations:validate/save_format] add ts.sa.ehs.saved +execute if score $hide_emissive ts.sa.settings matches 1..2 run tag @s[type=#spawnanimations:has_emissive_layer] add ts.sa.ehs.shrunk +execute if score $hide_emissive ts.sa.settings matches 1..2 run tag @s add ts.sa.ehs.pehkui.shrunk +execute if score $enderman_hack ts.sa.settings matches 1..2 run tag @s[type=minecraft:enderman] add ts.sa.ehs.pehkui.hitbox diff --git a/data/spawnanimations/functions/internal/animation/dig_up/sound/sound.mcfunction b/data/spawnanimations/functions/internal/animation/dig_up/sound/sound.mcfunction index 25cc2e8..0b265d6 100644 --- a/data/spawnanimations/functions/internal/animation/dig_up/sound/sound.mcfunction +++ b/data/spawnanimations/functions/internal/animation/dig_up/sound/sound.mcfunction @@ -1,7 +1,7 @@ ## by Tschipcraft -execute if block ~ ~ ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/sound/play_sound -execute if score $play_unsupport ts.sa.settings matches 1..2 unless block ~ ~ ~ #spawnanimations:supported unless block ~ ~ ~ #spawnanimations:nonsolid unless block ~ ~ ~ minecraft:bedrock unless block ~ ~ ~ minecraft:air run function spawnanimations:internal/animation/dig_up/sound/support +execute if score $play_sounds ts.sa.settings matches 1..2 if block ~ ~ ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/sound/play_sound +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches 1..2 unless block ~ ~ ~ #spawnanimations:supported unless block ~ ~ ~ #spawnanimations:nonsolid unless block ~ ~ ~ minecraft:bedrock unless block ~ ~ ~ minecraft:air run function spawnanimations:internal/animation/dig_up/sound/support # Update stage + adjust animation speed scoreboard players add @s ts.sa.e.stage 1 diff --git a/data/spawnanimations/functions/internal/animation/dig_up/sound/sound2.mcfunction b/data/spawnanimations/functions/internal/animation/dig_up/sound/sound2.mcfunction index c8fe564..8bd207d 100644 --- a/data/spawnanimations/functions/internal/animation/dig_up/sound/sound2.mcfunction +++ b/data/spawnanimations/functions/internal/animation/dig_up/sound/sound2.mcfunction @@ -1,7 +1,7 @@ ## by Tschipcraft -execute if block ~ ~ ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/sound/play_sound2 -execute if score $play_unsupport ts.sa.settings matches 1..2 unless block ~ ~ ~ #spawnanimations:supported unless block ~ ~ ~ #spawnanimations:nonsolid unless block ~ ~ ~ minecraft:bedrock unless block ~ ~ ~ minecraft:air run function spawnanimations:internal/animation/dig_up/sound/support +execute if score $play_sounds ts.sa.settings matches 1..2 if block ~ ~ ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/sound/play_sound2 +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches 1..2 unless block ~ ~ ~ #spawnanimations:supported unless block ~ ~ ~ #spawnanimations:nonsolid unless block ~ ~ ~ minecraft:bedrock unless block ~ ~ ~ minecraft:air run function spawnanimations:internal/animation/dig_up/sound/support scoreboard players reset @s ts.sa.e.stage scoreboard players reset @s ts.sa.e.speed diff --git a/data/spawnanimations/functions/internal/animation/dig_up/start.mcfunction b/data/spawnanimations/functions/internal/animation/dig_up/start.mcfunction index f4e19ea..e96b139 100644 --- a/data/spawnanimations/functions/internal/animation/dig_up/start.mcfunction +++ b/data/spawnanimations/functions/internal/animation/dig_up/start.mcfunction @@ -18,16 +18,13 @@ function spawnanimations:internal/entity/protect # Prevent animation midair execute if block ~ ~-0.5 ~ #spawnanimations:nonsolid run function spawnanimations:internal/animation/dig_up/verify_in_air -execute if entity @s[type=minecraft:giant] unless block ~ ~-1 ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/verify_in_air +execute as @s[type=minecraft:giant] unless block ~ ~-1 ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/verify_in_air # Prevent animation on bedrock execute if block ~ ~-0.5 ~ minecraft:bedrock run function spawnanimations:internal/animation/dig_up/verify_in_air # Prevent animation in mob crusher -execute if entity @e[type=!#spawnanimations:exclude,distance=0.001..1.1] run function spawnanimations:internal/animation/dig_up/verify_in_air +execute as @s[tag=ts.sa.verify] if entity @e[type=!#spawnanimations:exclude,distance=0.001..0.9] run function spawnanimations:internal/animation/dig_up/verify_in_air # Prevent animation on unsupported blocks if disabled -execute if score $play_unsupport ts.sa.settings matches -1..0 unless block ~ ~-0.5 ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/verify_in_air - -# I don't remember why I put this here -#execute as @s[tag=ts.sa.to_verify] positioned ~ ~0.2 ~ align y unless block ~ ~ ~ #spawnanimations:exclude unless block ~ ~-1 ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/verify_in_air +execute as @s[tag=ts.sa.verify] if score $play_unsupport ts.sa.settings matches -1..0 unless block ~ ~-0.5 ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/verify_in_air diff --git a/data/spawnanimations/functions/internal/animation/dig_up/verify.mcfunction b/data/spawnanimations/functions/internal/animation/dig_up/verify.mcfunction index 68f2f73..8ef2de4 100644 --- a/data/spawnanimations/functions/internal/animation/dig_up/verify.mcfunction +++ b/data/spawnanimations/functions/internal/animation/dig_up/verify.mcfunction @@ -4,6 +4,7 @@ tag @s add ts.sa.verified tag @s remove ts.sa.verify # Reset entity info +scoreboard players set @s ts.sa.timer 100 scoreboard players reset @s ts.sa.e.y scoreboard players reset @s ts.sa.e.stage scoreboard players reset @s ts.sa.e.speed diff --git a/data/spawnanimations/functions/internal/animation/dig_up/verify_in_air.mcfunction b/data/spawnanimations/functions/internal/animation/dig_up/verify_in_air.mcfunction index fea236c..36949b2 100644 --- a/data/spawnanimations/functions/internal/animation/dig_up/verify_in_air.mcfunction +++ b/data/spawnanimations/functions/internal/animation/dig_up/verify_in_air.mcfunction @@ -1,9 +1,10 @@ ## by Tschipcraft +# The "Poof" animation tag @s remove ts.sa.verify tag @s remove ts.sa.to_verify function spawnanimations:internal/entity/unhide function spawnanimations:internal/entity/unprotect -particle minecraft:spit ~ ~1 ~ 0 0.3 0 0.2 15 normal -playsound minecraft:entity.llama.spit hostile @a ~ ~ ~ 0.75 0 +execute if score $enable_poof_anim ts.sa.settings matches 1..2 run particle minecraft:spit ~ ~1 ~ 0 0.3 0 0.2 10 normal +execute if score $enable_poof_anim ts.sa.settings matches 1..2 if score $play_sounds ts.sa.settings matches 1..2 run playsound minecraft:entity.llama.spit hostile @a ~ ~ ~ 0.75 0 function spawnanimations:internal/animation/dig_up/verify diff --git a/data/spawnanimations/functions/internal/calc_activation.mcfunction b/data/spawnanimations/functions/internal/calc_activation.mcfunction index 87139df..a2a77f1 100644 --- a/data/spawnanimations/functions/internal/calc_activation.mcfunction +++ b/data/spawnanimations/functions/internal/calc_activation.mcfunction @@ -2,9 +2,10 @@ # @s/~ ~ ~ is tested entity; $global is player position # Get position -execute store result score @s ts.sa.x run data get entity @s Pos[0] -execute store result score @s ts.sa.y run data get entity @s Pos[1] -execute store result score @s ts.sa.z run data get entity @s Pos[2] +data modify storage spawnanimations:temp Pos set from entity @s Pos +execute store result score @s ts.sa.x run data get storage spawnanimations:temp Pos[0] +execute store result score @s ts.sa.y run data get storage spawnanimations:temp Pos[1] +execute store result score @s ts.sa.z run data get storage spawnanimations:temp Pos[2] # Calculate diff scoreboard players operation @s ts.sa.x -= $global ts.sa.x @@ -12,12 +13,11 @@ scoreboard players operation @s ts.sa.y -= $global ts.sa.y scoreboard players operation @s ts.sa.z -= $global ts.sa.z # Make sure value is positive -scoreboard players set $minus ts.sa.x -1 -execute if score @s ts.sa.x matches ..0 run scoreboard players operation @s ts.sa.x *= $minus ts.sa.x -execute if score @s ts.sa.y matches ..0 run scoreboard players operation @s ts.sa.y *= $minus ts.sa.x -execute if score @s ts.sa.z matches ..0 run scoreboard players operation @s ts.sa.z *= $minus ts.sa.x +execute if score @s ts.sa.x matches ..0 run scoreboard players operation @s ts.sa.x *= #minus ts.sa.x +execute if score @s ts.sa.y matches ..0 run scoreboard players operation @s ts.sa.y *= #minus ts.sa.x +execute if score @s ts.sa.z matches ..0 run scoreboard players operation @s ts.sa.z *= #minus ts.sa.x -# Add dis together +# Add distances together scoreboard players operation @s ts.sa.x += @s ts.sa.y scoreboard players operation @s ts.sa.x += @s ts.sa.z diff --git a/data/spawnanimations/functions/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance.mcfunction b/data/spawnanimations/functions/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance.mcfunction new file mode 100644 index 0000000..24e425f --- /dev/null +++ b/data/spawnanimations/functions/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance.mcfunction @@ -0,0 +1,32 @@ +##by Tschipcraft +# Shrunk entity @s is trying to escape an enclosure, when not to far away from its previous position we move it back + +# Get current position +data modify storage spawnanimations:temp Pos set from entity @s Pos +execute store result score #current ts.sa.prev_x run data get storage spawnanimations:temp Pos[0] 10 +execute store result score #current ts.sa.prev_y run data get storage spawnanimations:temp Pos[1] 10 +execute store result score #current ts.sa.prev_z run data get storage spawnanimations:temp Pos[2] 10 + +scoreboard players operation #previous ts.sa.prev_x = @s ts.sa.prev_x +scoreboard players operation #previous ts.sa.prev_y = @s ts.sa.prev_y +scoreboard players operation #previous ts.sa.prev_z = @s ts.sa.prev_z + +# Calculate diff +scoreboard players operation #previous ts.sa.prev_x -= #current ts.sa.prev_x +scoreboard players operation #previous ts.sa.prev_y -= #current ts.sa.prev_y +scoreboard players operation #previous ts.sa.prev_z -= #current ts.sa.prev_z + +# Make sure value is positive +execute if score #previous ts.sa.prev_x matches ..0 run scoreboard players operation #previous ts.sa.prev_x *= #minus ts.sa.x +execute if score #previous ts.sa.prev_y matches ..0 run scoreboard players operation #previous ts.sa.prev_y *= #minus ts.sa.x +execute if score #previous ts.sa.prev_z matches ..0 run scoreboard players operation #previous ts.sa.prev_z *= #minus ts.sa.x + +# Add distances together +scoreboard players operation #previous ts.sa.prev_x += #previous ts.sa.prev_y +scoreboard players operation #previous ts.sa.prev_x += #previous ts.sa.prev_z + +# Move entity back to previous location if it moved not too far (distance times 10) +execute if score #previous ts.sa.prev_x matches ..30 run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/move_back + +# Trigger animation any way +function spawnanimations:internal/animation/dig_up/start diff --git a/data/spawnanimations/functions/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_enclosure.mcfunction b/data/spawnanimations/functions/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_enclosure.mcfunction new file mode 100644 index 0000000..295fa4e --- /dev/null +++ b/data/spawnanimations/functions/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_enclosure.mcfunction @@ -0,0 +1,28 @@ +##by Tschipcraft +# Checks if shrunk entity @s is trying to escape a potential enclosure + +# Inside block +execute unless block ~ ~ ~ #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance + +# Model default enderman hitbox size +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^0.3 ^1.5 ^0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^0.3 ^1.5 ^-0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^-0.3 ^1.5 ^0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^-0.3 ^1.5 ^-0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^0.3 ^2.9 ^0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^0.3 ^2.9 ^-0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^-0.3 ^2.9 ^0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:enderman,tag=ts.sa.to_verify] unless block ^-0.3 ^2.9 ^-0.3 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance + +# Model default spider hitbox size +execute as @s[type=minecraft:spider,tag=ts.sa.to_verify] unless block ~0.7 ~ ~0.7 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:spider,tag=ts.sa.to_verify] unless block ~0.7 ~ ~-0.7 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:spider,tag=ts.sa.to_verify] unless block ~-0.7 ~ ~-0.7 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:spider,tag=ts.sa.to_verify] unless block ~-0.7 ~ ~0.7 #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance +execute as @s[type=minecraft:spider,tag=ts.sa.to_verify] unless block ~ ~0.9 ~ #spawnanimations:nonsolid run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_distance + +# Update position +execute if entity @s[tag=ts.sa.to_verify] run data modify storage spawnanimations:temp Pos set from entity @s Pos +execute if entity @s[tag=ts.sa.to_verify] store result score @s ts.sa.prev_x run data get storage spawnanimations:temp Pos[0] 10 +execute if entity @s[tag=ts.sa.to_verify] store result score @s ts.sa.prev_y run data get storage spawnanimations:temp Pos[1] 10 +execute if entity @s[tag=ts.sa.to_verify] store result score @s ts.sa.prev_z run data get storage spawnanimations:temp Pos[2] 10 diff --git a/data/spawnanimations/functions/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/move_back.mcfunction b/data/spawnanimations/functions/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/move_back.mcfunction new file mode 100644 index 0000000..1b3a623 --- /dev/null +++ b/data/spawnanimations/functions/internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/move_back.mcfunction @@ -0,0 +1,6 @@ +##by Tschipcraft + +# Move back to previous position +execute store result entity @s Pos[0] double 0.1 run scoreboard players get @s ts.sa.prev_x +execute store result entity @s Pos[1] double 0.1 run scoreboard players get @s ts.sa.prev_y +execute store result entity @s Pos[2] double 0.1 run scoreboard players get @s ts.sa.prev_z diff --git a/data/spawnanimations/functions/internal/entity/ehs/hide.mcfunction b/data/spawnanimations/functions/internal/entity/ehs/hide.mcfunction index afc7988..91983ca 100644 --- a/data/spawnanimations/functions/internal/entity/ehs/hide.mcfunction +++ b/data/spawnanimations/functions/internal/entity/ehs/hide.mcfunction @@ -7,3 +7,10 @@ execute store result score @s ts.sa.e.nbt.Sil run data get entity @s Silent execute if score @s ts.sa.e.nbt.Sil matches 0 run data merge entity @s {Silent:1b} tag @s add ts.sa.to_hide effect give @s invisibility 10 0 true + +# Pehkui integration +execute if score $hide_emissive ts.sa.settings matches 1..2 run function spawnanimations:internal/entity/ehs/pehkui/hide + +# Entity specific +execute if score $hide_emissive ts.sa.settings matches 1..2 if entity @s[type=#spawnanimations:has_emissive_layer,tag=!ts.sa.ehs.pehkui.shrunk] run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/hide +execute if entity @s[type=minecraft:creeper] run function spawnanimations:internal/entity/ehs/entity_specific/creeper/hide diff --git a/data/spawnanimations/functions/internal/entity/ehs/hide_exec.mcfunction b/data/spawnanimations/functions/internal/entity/ehs/hide_exec.mcfunction index d550418..ae4fe4b 100644 --- a/data/spawnanimations/functions/internal/entity/ehs/hide_exec.mcfunction +++ b/data/spawnanimations/functions/internal/entity/ehs/hide_exec.mcfunction @@ -7,6 +7,3 @@ tag @s add ts.sa.hidden # Save Armor and Hand Items execute if score $hide_armor ts.sa.settings matches 1..2 as @s[type=#spawnanimations:can_wear_armor] run function spawnanimations:internal/entity/ehs/save_armor - -# Entity specific -execute if entity @s[type=minecraft:creeper] run function spawnanimations:internal/entity/ehs/entity_specific/creeper/hide diff --git a/data/spawnanimations/functions/internal/entity/ehs/pehkui/check_installed.mcfunction b/data/spawnanimations/functions/internal/entity/ehs/pehkui/check_installed.mcfunction new file mode 100644 index 0000000..28f4e9e --- /dev/null +++ b/data/spawnanimations/functions/internal/entity/ehs/pehkui/check_installed.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft +# Checks if Pehkui is installed + +scale get @r +scoreboard players set $pehkui_installed ts.sa.settings 1 diff --git a/data/spawnanimations/functions/internal/entity/ehs/pehkui/enderman/hide.mcfunction b/data/spawnanimations/functions/internal/entity/ehs/pehkui/enderman/hide.mcfunction new file mode 100644 index 0000000..2f2d6de --- /dev/null +++ b/data/spawnanimations/functions/internal/entity/ehs/pehkui/enderman/hide.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft +# Shrinks the hitbox of a Enderman to a smaller scale to better hide its particles + +scale set pehkui:hitbox_height 0.2 @s +tag @s add ts.sa.ehs.pehkui.hitbox diff --git a/data/spawnanimations/functions/internal/entity/ehs/pehkui/enderman/unhide.mcfunction b/data/spawnanimations/functions/internal/entity/ehs/pehkui/enderman/unhide.mcfunction new file mode 100644 index 0000000..2bf14de --- /dev/null +++ b/data/spawnanimations/functions/internal/entity/ehs/pehkui/enderman/unhide.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft +# Resets the hitbox of a Enderman + +scale reset pehkui:hitbox_height @s +tag @s remove ts.sa.ehs.pehkui.hitbox diff --git a/data/spawnanimations/functions/internal/entity/ehs/pehkui/hide.mcfunction b/data/spawnanimations/functions/internal/entity/ehs/pehkui/hide.mcfunction new file mode 100644 index 0000000..e65ffa4 --- /dev/null +++ b/data/spawnanimations/functions/internal/entity/ehs/pehkui/hide.mcfunction @@ -0,0 +1,11 @@ +##by Tschipcraft +# Shrinks entities to a smaller scale to completely hide them + +scale delay set pehkui:model_width 0 @s +scale delay set pehkui:model_height 0 @s + +scale set pehkui:model_width 0.0001 @s +scale set pehkui:model_height 0.0001 @s +execute if score $enderman_hack ts.sa.settings matches 1..2 as @s[type=minecraft:enderman] run function spawnanimations:internal/entity/ehs/pehkui/enderman/hide + +tag @s add ts.sa.ehs.pehkui.shrunk diff --git a/data/spawnanimations/functions/internal/entity/ehs/pehkui/set_easing.mcfunction b/data/spawnanimations/functions/internal/entity/ehs/pehkui/set_easing.mcfunction new file mode 100644 index 0000000..dc4a28d --- /dev/null +++ b/data/spawnanimations/functions/internal/entity/ehs/pehkui/set_easing.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft +# Sets the easing for the model width and height of entities (Pehkui 3.4.0+) + +scale easing set pehkui:model_width pehkui:quadratic_in_out @s +scale easing set pehkui:model_height pehkui:quadratic_in_out @s diff --git a/data/spawnanimations/functions/internal/entity/ehs/pehkui/unhide.mcfunction b/data/spawnanimations/functions/internal/entity/ehs/pehkui/unhide.mcfunction new file mode 100644 index 0000000..11d42f7 --- /dev/null +++ b/data/spawnanimations/functions/internal/entity/ehs/pehkui/unhide.mcfunction @@ -0,0 +1,12 @@ +##by Tschipcraft +# Resets entities that got their scale changed + +scale delay set pehkui:model_width 10 @s +scale delay set pehkui:model_height 10 @s +function spawnanimations:internal/entity/ehs/pehkui/set_easing + +scale set pehkui:model_width 1 @s +scale set pehkui:model_height 1 @s +execute as @s[tag=ts.sa.ehs.pehkui.hitbox] run function spawnanimations:internal/entity/ehs/pehkui/enderman/unhide + +tag @s remove ts.sa.ehs.pehkui.shrunk diff --git a/data/spawnanimations/functions/internal/entity/ehs/unhide.mcfunction b/data/spawnanimations/functions/internal/entity/ehs/unhide.mcfunction index 04d2f60..3f8e32b 100644 --- a/data/spawnanimations/functions/internal/entity/ehs/unhide.mcfunction +++ b/data/spawnanimations/functions/internal/entity/ehs/unhide.mcfunction @@ -9,5 +9,7 @@ execute as @s[tag=ts.sa.ehs.saved] run function spawnanimations:internal/entity/ # Entity specific execute if entity @s[type=minecraft:creeper] run function spawnanimations:internal/entity/ehs/entity_specific/creeper/unhide +execute as @s[tag=ts.sa.ehs.shrunk] run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/unhide +execute as @s[tag=ts.sa.ehs.pehkui.shrunk] run function spawnanimations:internal/entity/ehs/pehkui/unhide tag @s remove ts.sa.hidden diff --git a/data/spawnanimations/functions/internal/entity/get_animation_speed.mcfunction b/data/spawnanimations/functions/internal/entity/get_animation_speed.mcfunction index bba451c..f6c63b9 100644 --- a/data/spawnanimations/functions/internal/entity/get_animation_speed.mcfunction +++ b/data/spawnanimations/functions/internal/entity/get_animation_speed.mcfunction @@ -1,5 +1,5 @@ ##by Tschipcraft -# This function sets the ts.sa.e.speed scoreboard depending on speed and slowness effects of the current entity (@s) +# Sets the ts.sa.e.speed scoreboard value depending on speed and slowness effects of the current entity (@s) scoreboard players set @s ts.sa.e.speed 0 execute if predicate spawnanimations:animation_speed/speed0 run scoreboard players add @s ts.sa.e.speed 1 diff --git a/data/spawnanimations/functions/internal/entity/unprotect.mcfunction b/data/spawnanimations/functions/internal/entity/unprotect.mcfunction index 49a065f..cd7745b 100644 --- a/data/spawnanimations/functions/internal/entity/unprotect.mcfunction +++ b/data/spawnanimations/functions/internal/entity/unprotect.mcfunction @@ -1,6 +1,6 @@ ##by Tschipcraft -data merge entity @s {Fire:0s,FallDistance:0f} +execute unless block ~ ~-0.5 ~ #spawnanimations:nonsolid run data merge entity @s {Fire:0s,FallDistance:0f} execute if score @s ts.sa.e.nbt.Inv matches 0 run data merge entity @s {Invulnerable:0b} scoreboard players reset @s ts.sa.e.nbt.Inv execute if score @s ts.sa.e.nbt.Sil matches 0 run data merge entity @s {Silent:0b} diff --git a/data/spawnanimations/functions/internal/run_activation_batch.mcfunction b/data/spawnanimations/functions/internal/run_activation_batch.mcfunction index e66a35e..b89ab19 100644 --- a/data/spawnanimations/functions/internal/run_activation_batch.mcfunction +++ b/data/spawnanimations/functions/internal/run_activation_batch.mcfunction @@ -1,9 +1,11 @@ ##by Tschipcraft -# Get pos -execute store result score $global ts.sa.x run data get entity @s Pos[0] -execute store result score $global ts.sa.y run data get entity @s Pos[1] -execute store result score $global ts.sa.z run data get entity @s Pos[2] +# Get player position +data modify storage spawnanimations:temp Pos set from entity @s Pos +execute store result score $global ts.sa.x run data get storage spawnanimations:temp Pos[0] +execute store result score $global ts.sa.y run data get storage spawnanimations:temp Pos[1] +execute store result score $global ts.sa.z run data get storage spawnanimations:temp Pos[2] # Activate entities -execute as @e[type=!#spawnanimations:exclude,tag=ts.sa.to_verify,distance=..100,limit=10,sort=random] at @s run function spawnanimations:internal/calc_activation +execute if score $activation_dist ts.sa.settings matches 25..100 as @e[type=!#spawnanimations:exclude,tag=ts.sa.to_verify,distance=..100,limit=5,sort=random] at @s run function spawnanimations:internal/calc_activation +execute if score $activation_dist ts.sa.settings matches 1..24 as @e[type=!#spawnanimations:exclude,tag=ts.sa.to_verify,distance=..25,limit=1,sort=random] at @s run function spawnanimations:internal/calc_activation diff --git a/data/spawnanimations/functions/internal/version_checker/start.mcfunction b/data/spawnanimations/functions/internal/version_checker/start.mcfunction index 0ba7274..755867e 100644 --- a/data/spawnanimations/functions/internal/version_checker/start.mcfunction +++ b/data/spawnanimations/functions/internal/version_checker/start.mcfunction @@ -10,4 +10,9 @@ execute if score $version ts.sa.settings matches 1977..2230 run tellraw @a [{"te execute if score $version ts.sa.settings matches 1632..1976 run tellraw @a [{"text":"[Spawn Animations] ","color":"gray"},{"text":"\u26a0 Minecraft version ","color":"red"},{"text":"1.14","color":"red","bold": true},{"text":" detected! This pack does not work in 1.14! Please use ","color":"red"},{"text": "1.17 or above", "color":"red","underlined":true},{"text":"!","color":"red"}] execute if score $version ts.sa.settings matches 1343..1631 run tellraw @a [{"text":"[Spawn Animations] ","color":"gray"},{"text":"\u26a0 Minecraft version ","color":"red"},{"text":"1.13","color":"red","bold": true},{"text":" detected! This pack does not work in 1.13! Please use ","color":"red"},{"text": "1.17 or above", "color":"red","underlined":true},{"text":"!","color":"red"}] -execute if score $version ts.sa.settings matches 0 run function spawnanimations:internal/version_checker/retry +# Pehkui Integration +scoreboard players set $pehkui_installed ts.sa.settings 0 +function spawnanimations:internal/entity/ehs/pehkui/check_installed + +# Retry if version retrieval failed +execute unless score $version ts.sa.settings matches 1.. run function spawnanimations:internal/version_checker/retry diff --git a/data/spawnanimations/functions/loop.mcfunction b/data/spawnanimations/functions/loop.mcfunction index aba0b9d..48a67f3 100644 --- a/data/spawnanimations/functions/loop.mcfunction +++ b/data/spawnanimations/functions/loop.mcfunction @@ -6,12 +6,17 @@ schedule function spawnanimations:loop 5t ## Supply invisibility to hidden entities execute as @e[type=!#spawnanimations:exclude,tag=ts.sa.to_verify,tag=!smithed.strict,tag=!ignore.global] run function spawnanimations:internal/entity/ehs/supply_invisibility -## Check for old format (post-1.20.5) +## Check for old save format (post-1.20.5) function spawnanimations:internal/entity/ehs/check_for_old_v0_format ## Validate hidden entities +# Check save format validity execute as @e[type=#spawnanimations:can_wear_armor,tag=ts.sa.to_verify,tag=ts.sa.ehs.saved] unless predicate spawnanimations:validate at @s run function spawnanimations:internal/entity/ehs/conflict/evaluate +# Escape protection for shrunk entities +execute as @e[type=#spawnanimations:has_emissive_layer,tag=ts.sa.to_verify,tag=ts.sa.ehs.shrunk] at @s run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_enclosure +execute if score $enderman_hack ts.sa.settings matches 1..2 as @e[type=minecraft:enderman,tag=ts.sa.to_verify,tag=ts.sa.ehs.pehkui.hitbox] at @s run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/prevent_enclosure_breach/check_enclosure + ## Remove problematic items execute as @e[type=minecraft:item,tag=!ts.sa.i.checked,tag=!global.ignore] run function spawnanimations:internal/entity/ehs/remove_invalid_item/check diff --git a/data/spawnanimations/functions/main.mcfunction b/data/spawnanimations/functions/main.mcfunction index 8f76718..7663aa3 100644 --- a/data/spawnanimations/functions/main.mcfunction +++ b/data/spawnanimations/functions/main.mcfunction @@ -1,19 +1,19 @@ ## by Tschipcraft ## Finish hiding entities -execute as @e[type=!#spawnanimations:exclude,tag=ts.sa.to_hide] run function spawnanimations:internal/entity/ehs/hide_exec +execute as @e[type=!#spawnanimations:exclude,tag=ts.sa.to_hide,limit=5] run function spawnanimations:internal/entity/ehs/hide_exec ## Detect new mobs # To edit mobs that are affected, see ../tags/entity_types/dig_up_animation.json # Normal -execute if score $version ts.sa.settings matches 2587.. as @e[type=#spawnanimations:dig_up_animation,tag=!ts.sa.verify,tag=!ts.sa.verified,tag=!ts.sa.to_verify,tag=!ts.sa.to_hide,tag=!exclude,tag=!smithed.strict,tag=!smithed.block,tag=!global.ignore,tag=!global.ignore.pos,limit=10,sort=arbitrary] run function spawnanimations:internal/animation/dig_up/prepare +execute if score $version ts.sa.settings matches 2587.. as @e[type=#spawnanimations:dig_up_animation,tag=!ts.sa.verify,tag=!ts.sa.verified,tag=!ts.sa.to_verify,tag=!ts.sa.to_hide,tag=!ts.sa.exclude,tag=!smithed.strict,tag=!smithed.block,tag=!global.ignore,tag=!global.ignore.pos,limit=10,sort=arbitrary] run function spawnanimations:internal/animation/dig_up/prepare ## Animation trigger # Player nearby execute if score $global ts.sa.count matches ..100 as @a[gamemode=!spectator,sort=random,limit=5] at @s run function spawnanimations:internal/run_activation_batch # Exclusion criteria -execute if score $global ts.sa.count matches ..100 as @e[type=!#spawnanimations:exclude,predicate=!spawnanimations:trigger,tag=ts.sa.to_verify,limit=10,sort=random] at @s run function spawnanimations:internal/animation/dig_up/start +execute if score $global ts.sa.count matches ..100 as @e[type=!#spawnanimations:exclude,tag=ts.sa.to_verify,limit=10,sort=random] as @s[predicate=!spawnanimations:trigger] at @s run function spawnanimations:internal/animation/dig_up/start ## Tick dig up animation diff --git a/data/spawnanimations/functions/reset.mcfunction b/data/spawnanimations/functions/reset.mcfunction index 6be3dca..12c6944 100644 --- a/data/spawnanimations/functions/reset.mcfunction +++ b/data/spawnanimations/functions/reset.mcfunction @@ -5,7 +5,7 @@ execute as @e[tag=ts.sa.to_hide] run function spawnanimations:internal/entity/eh # Remove animation trigger execute as @e[tag=ts.sa.to_verify] at @s run function spawnanimations:internal/animation/dig_up/verify_in_air # Cancel animation -execute as @e[tag=ts.sa.verify] store result entity @s Pos[1] double 0.01 run scoreboard players get @s ts.sa.e.y +execute as @e[tag=ts.sa.verify,scores={ts.sa.e.y=-2147483648..2147483647}] store result entity @s Pos[1] double 0.01 run scoreboard players get @s ts.sa.e.y execute as @e[tag=ts.sa.verify] at @s run function spawnanimations:internal/animation/dig_up/verify_in_air # Reset checked items diff --git a/data/spawnanimations/functions/settings/classic.mcfunction b/data/spawnanimations/functions/settings/classic.mcfunction index e7d6b85..9202210 100644 --- a/data/spawnanimations/functions/settings/classic.mcfunction +++ b/data/spawnanimations/functions/settings/classic.mcfunction @@ -1,5 +1,5 @@ ##by Tschipcraft -tellraw @s ["",{"text":"\n-> Set activation mode to "},{"text":"[classic]","color":"yellow"}] +tellraw @s ["",{"text":"\n-> Set Activation Mode to "},{"text":"[Classic]","color":"yellow"}] scoreboard players set $activation_mode ts.sa.settings 1 function #spawnanimations:settings diff --git a/data/spawnanimations/functions/settings/core.mcfunction b/data/spawnanimations/functions/settings/core.mcfunction index 94195bb..e040167 100644 --- a/data/spawnanimations/functions/settings/core.mcfunction +++ b/data/spawnanimations/functions/settings/core.mcfunction @@ -7,20 +7,41 @@ execute unless score #lock_distance ts.sa.settings matches 1 if score $activatio execute unless score #lock_distance ts.sa.settings matches 1 if score $activation_dist ts.sa.settings matches 100.. run tellraw @s [{"text":"Activation Distance","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"Mobs closer to you than this value will play the animation"}]}},{"text":" "},{"text":"<<< ","color":"aqua","hoverEvent":{"action":"show_text","contents":[{"text":"-1"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/decrease"}},{"score":{"name":"$activation_dist","objective":"ts.sa.settings"},"color":"green","bold":true},{"text":" blocks","color":"green"},{"text":" >>>","color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"Max is 100","color":"red"}]}},{"text":" [\u270e]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set @s ts.sa.distance "},"hoverEvent":{"action":"show_text","contents":"Edit"}}] execute if score #lock_distance ts.sa.settings matches 1 run tellraw @s [{"text":"Activation Distance <<< ","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}},{"score":{"name":"$activation_dist","objective":"ts.sa.settings"}},{"text":" blocks >>>"}] -execute if score $activation_mode ts.sa.settings matches 1 run tellraw @s ["",{"text":"Activation mode","bold":true},{"text":" "},{"text":"[>classic<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"Out of range mobs will stay hidden until a player is in range."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/classic"}},{"text":" | "},{"text":"[vanilla]","color":"red","hoverEvent":{"action":"show_text","contents":[{"text":"Out of range mobs will spawn normally."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/vanilla"}}] -execute if score $activation_mode ts.sa.settings matches 0 run tellraw @s ["",{"text":"Activation mode","bold":true},{"text":" "},{"text":"[classic]","color":"red","hoverEvent":{"action":"show_text","contents":[{"text":"Out of range mobs will stay hidden until a player is in range."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/classic"}},{"text":" | "},{"text":"[>vanilla<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"Out of range mobs will spawn normally."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/vanilla"}}] -execute if score $activation_mode ts.sa.settings matches -1 run tellraw @s [{"text":"Activation mode [classic] | [>vanilla<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] -execute if score $activation_mode ts.sa.settings matches 2 run tellraw @s [{"text":"Activation mode [>classic<] | [vanilla]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] - -execute if score $hide_armor ts.sa.settings matches 1 run tellraw @s ["",{"text":"Hide worn armor and tools","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"Worn armor and tools will be hidden. "},{"text":"\n⚠ Note: This feature may impact worn armor and tool drop rates inside farms.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_hidearmorandtools"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"Worn armor and tools will not be hidden."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_hidearmorandtools"}}] -execute if score $hide_armor ts.sa.settings matches 0 run tellraw @s ["",{"text":"Hide worn armor and tools","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":[{"text":"Worn armor and tools will be hidden. "},{"text":"\n⚠ Note: This feature may impact worn armor and tool drop rates inside farms.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_hidearmorandtools"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"Worn armor and tools will not be hidden."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_hidearmorandtools"}}] -execute if score $hide_armor ts.sa.settings matches -1 run tellraw @s [{"text":"Hide worn armor and tools [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] -execute if score $hide_armor ts.sa.settings matches 2 run tellraw @s [{"text":"Hide worn armor and tools [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] - -execute if score $play_unsupport ts.sa.settings matches 1 run tellraw @s ["",{"text":"Play animation on unsupported blocks","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"The block break animation is played on unsupported blocks. "},{"text":"\n⚠ Note: This could lead to unwanted block updates.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_allblocksupport"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"The block break animation will not be played on unsupported blocks."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_allblocksupport"}}] -execute if score $play_unsupport ts.sa.settings matches 0 run tellraw @s ["",{"text":"Play animation on unsupported blocks","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":[{"text":"The block break animation is played on unsupported blocks. "},{"text":"\n⚠ Note: This could lead to unwanted block updates.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_allblocksupport"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"The block break animation will not be played on unsupported blocks."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_allblocksupport"}}] -execute if score $play_unsupport ts.sa.settings matches -1 run tellraw @s [{"text":"Play animation on unsupported blocks [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] -execute if score $play_unsupport ts.sa.settings matches 2 run tellraw @s [{"text":"Play animation on unsupported blocks [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $activation_mode ts.sa.settings matches 1 run tellraw @s ["",{"text":"Activation Mode","bold":true},{"text":" "},{"text":"[>Classic<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"Mobs outside the activation range remain hidden until a player is in range."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/classic"}},{"text":" | "},{"text":"[Vanilla]","color":"red","hoverEvent":{"action":"show_text","contents":[{"text":"Mobs outside the activation range spawn normally."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/vanilla"}}] +execute if score $activation_mode ts.sa.settings matches 0 run tellraw @s ["",{"text":"Activation Mode","bold":true},{"text":" "},{"text":"[Classic]","color":"red","hoverEvent":{"action":"show_text","contents":[{"text":"Mobs outside the activation range remain hidden until a player is in range."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/classic"}},{"text":" | "},{"text":"[>Vanilla<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"Mobs outside the activation range spawn normally."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/vanilla"}}] +execute if score $activation_mode ts.sa.settings matches -1 run tellraw @s [{"text":"Activation Mode [Classic] | [>Vanilla<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $activation_mode ts.sa.settings matches 2 run tellraw @s [{"text":"Activation Mode [>Classic<] | [Vanilla]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] + +execute if score $enable_poof_anim ts.sa.settings matches 1 run tellraw @s ["",{"text":"Enable Poof Animation","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":"If enabled, some mobs, or mobs without a block to dig up from, will play the poof animation instead."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_poofanim"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"Poof animation will not be played."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_poofanim"}}] +execute if score $enable_poof_anim ts.sa.settings matches 0 run tellraw @s ["",{"text":"Enable Poof Animation","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":"If enabled, some mobs, or mobs without a block to dig up from, will play the poof animation instead."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_poofanim"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"Poof animation will not be played."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_poofanim"}}] +execute if score $enable_poof_anim ts.sa.settings matches -1 run tellraw @s [{"text":"Enable Poof Animation [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $enable_poof_anim ts.sa.settings matches 2 run tellraw @s [{"text":"Enable Poof Animation [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] + +execute if score $play_sounds ts.sa.settings matches 1 run tellraw @s ["",{"text":"Play Animation Sounds","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":"If enabled, sounds will be played during the animation."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_playsounds"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"Sounds will not be played."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_playsounds"}}] +execute if score $play_sounds ts.sa.settings matches 0 run tellraw @s ["",{"text":"Play Animation Sounds","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":"If enabled, sounds will be played during the animation."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_playsounds"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"Sounds will not be played."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_playsounds"}}] +execute if score $play_sounds ts.sa.settings matches -1 run tellraw @s [{"text":"Play Animation Sounds [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $play_sounds ts.sa.settings matches 2 run tellraw @s [{"text":"Play Animation Sounds [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] + +execute if score $hide_armor ts.sa.settings matches 1 run tellraw @s ["",{"text":"Hide Worn Armor and Tools","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, stores the worn armor and tools in the body, feet, or in some versions, leggings slot of a hidden entity. "},{"text":"\n⚠ Note: This may impact worn armor and tool drop rates from mob farms.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_hidearmorandtools"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"Worn armor and tools will not be hidden."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_hidearmorandtools"}}] +execute if score $hide_armor ts.sa.settings matches 0 run tellraw @s ["",{"text":"Hide Worn Armor and Tools","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, stores the worn armor and tools in the body, feet, or in some versions, leggings slot of a hidden entity. "},{"text":"\n⚠ Note: This may impact worn armor and tool drop rates from mob farms when enabled.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_hidearmorandtools"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"Worn armor and tools will not be hidden."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_hidearmorandtools"}}] +execute if score $hide_armor ts.sa.settings matches -1 run tellraw @s [{"text":"Hide Worn Armor and Tools [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $hide_armor ts.sa.settings matches 2 run tellraw @s [{"text":"Hide Worn Armor and Tools [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] + +execute if score $hide_emissive ts.sa.settings matches 1 run tellraw @s ["",{"text":"Hide Emissive Mob Layers","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, emissive layers of some mobs (e.g., Endermen, Spiders, and Cave Spiders), or with Pehkui all mobs, will be hidden by shrinking them.\nRequires Pehkui to be installed in Minecraft 1.20.4 and below."},{"text":"\n⚠ Note: This may decrease the efficiency of mob farms due to the changed hitbox size for hidden entities when Pehkui is not installed and the feature is enabled.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_hideemissive"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"Emissive layers will not be hidden."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_hideemissive"}}] +execute if score $hide_emissive ts.sa.settings matches 0 run tellraw @s ["",{"text":"Hide Emissive Mob Layers","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, emissive layers of some mobs (e.g., Endermen, Spiders, and Cave Spiders), or with Pehkui all mobs, will be hidden by shrinking them.\nRequires Pehkui to be installed in Minecraft 1.20.4 and below."},{"text":"\n⚠ Note: This may decrease the efficiency of mob farms due to the changed hitbox size for hidden entities when Pehkui is not installed and the feature is enabled.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_hideemissive"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"Emissive layers will not be hidden."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_hideemissive"}}] +execute if score $hide_emissive ts.sa.settings matches -1 run tellraw @s [{"text":"Hide Emissive Mob Layers [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $hide_emissive ts.sa.settings matches 2 run tellraw @s [{"text":"Hide Emissive Mob Layers [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] + +execute if score $pehkui_installed ts.sa.settings matches 1 if score $enderman_hack ts.sa.settings matches 1 run tellraw @s ["",{"text":"Reduce Hidden Enderman Particles","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, the number of particles emitted by hidden Endermen will be reduced by shrinking their hitbox scale."},{"text":"\n⚠ Note: This may decrease the efficiency of Enderman mob farms.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_reduceendermanparticles"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"Hidden Enderman particles will not be reduced."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_reduceendermanparticles"}}] +execute if score $pehkui_installed ts.sa.settings matches 1 if score $enderman_hack ts.sa.settings matches 0 run tellraw @s ["",{"text":"Reduce Hidden Enderman Particles","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, the number of particles emitted by hidden Endermen will be reduced by shrinking their hitbox scale."},{"text":"\n⚠ Note: This may decrease the efficiency of Enderman mob farms when enabled.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_reduceendermanparticles"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"Hidden Enderman particles will not be reduced."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_reduceendermanparticles"}}] +execute if score $enderman_hack ts.sa.settings matches -1 run tellraw @s [{"text":"Reduce Hidden Enderman Particles [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here. Only applicable when Pehkui is installed."}]}}] +execute if score $enderman_hack ts.sa.settings matches 2 run tellraw @s [{"text":"Reduce Hidden Enderman Particles [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here. Only applicable when Pehkui is installed."}]}}] + +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches 1 run tellraw @s ["",{"text":"Play Animation on Unsupported Blocks","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, the block breaking animation plays on blocks that are not hard-coded into the data pack. "},{"text":"\n⚠ Note: This could lead to unwanted block updates.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_allblocksupport"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"The block breaking animation will not be played on unsupported blocks."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_allblocksupport"}}] +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches 0 run tellraw @s ["",{"text":"Play Animation on Unsupported Blocks","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, the block breaking animation plays on blocks that are not hard-coded into the data pack. "},{"text":"\n⚠ Note: This could lead to unwanted block updates.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_allblocksupport"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"The block breaking animation will not be played on unsupported blocks."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_allblocksupport"}}] +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches -1 run tellraw @s [{"text":"Play Animation on Unsupported Blocks [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches 2 run tellraw @s [{"text":"Play Animation on Unsupported Blocks [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $play_sounds ts.sa.settings matches -1..0 run tellraw @s [{"text":"Play Animation on Unsupported Blocks [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"Enable [Play Animation Sounds] first."}]}}] function spawnanimations:settings/hide_feedback/main playsound minecraft:block.dispenser.dispense master @s ~ ~ ~ 0.2 2 diff --git a/data/spawnanimations/functions/settings/defaults.mcfunction b/data/spawnanimations/functions/settings/defaults.mcfunction index 873311f..c1ff454 100644 --- a/data/spawnanimations/functions/settings/defaults.mcfunction +++ b/data/spawnanimations/functions/settings/defaults.mcfunction @@ -5,5 +5,9 @@ execute unless score $activation_dist ts.sa.settings matches 1..100 run scoreboard players set $activation_dist ts.sa.settings 20 execute unless score #lock_distance ts.sa.settings matches 0..1 run scoreboard players set #lock_distance ts.sa.settings 0 execute unless score $activation_mode ts.sa.settings matches -1..2 run scoreboard players set $activation_mode ts.sa.settings 1 +execute unless score $enable_poof_anim ts.sa.settings matches -1..2 run scoreboard players set $enable_poof_anim ts.sa.settings 1 +execute unless score $play_sounds ts.sa.settings matches -1..2 run scoreboard players set $play_sounds ts.sa.settings 1 execute unless score $hide_armor ts.sa.settings matches -1..2 run scoreboard players set $hide_armor ts.sa.settings 1 +execute unless score $hide_emissive ts.sa.settings matches -1..2 run scoreboard players set $hide_emissive ts.sa.settings 1 +execute unless score $enderman_hack ts.sa.settings matches -1..2 run scoreboard players set $enderman_hack ts.sa.settings 1 execute unless score $play_unsupport ts.sa.settings matches -1..2 run scoreboard players set $play_unsupport ts.sa.settings 0 diff --git a/data/spawnanimations/functions/settings/disable_allblocksupport.mcfunction b/data/spawnanimations/functions/settings/disable_allblocksupport.mcfunction index 0db9e55..054aaec 100644 --- a/data/spawnanimations/functions/settings/disable_allblocksupport.mcfunction +++ b/data/spawnanimations/functions/settings/disable_allblocksupport.mcfunction @@ -1,5 +1,5 @@ ##by Tschipcraft -tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Play animation on unsupported blocks]","color":"yellow"}] +tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Play Animation on Unsupported Blocks]","color":"yellow"}] scoreboard players set $play_unsupport ts.sa.settings 0 function #spawnanimations:settings diff --git a/data/spawnanimations/functions/settings/disable_hidearmorandtools.mcfunction b/data/spawnanimations/functions/settings/disable_hidearmorandtools.mcfunction index 92ba91d..9858741 100644 --- a/data/spawnanimations/functions/settings/disable_hidearmorandtools.mcfunction +++ b/data/spawnanimations/functions/settings/disable_hidearmorandtools.mcfunction @@ -1,5 +1,6 @@ ##by Tschipcraft -tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Hide armor and tools]","color":"yellow"}] +tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Hide Worn Armor and Tools]","color":"yellow"}] +tellraw @s ["",{"text":"ℹ Info: ","color":"blue"},{"text":"This change only applies to new mobs"}] scoreboard players set $hide_armor ts.sa.settings 0 function #spawnanimations:settings diff --git a/data/spawnanimations/functions/settings/disable_hideemissive.mcfunction b/data/spawnanimations/functions/settings/disable_hideemissive.mcfunction new file mode 100644 index 0000000..cc178f5 --- /dev/null +++ b/data/spawnanimations/functions/settings/disable_hideemissive.mcfunction @@ -0,0 +1,7 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Hide Emissive Mob Layers]","color":"yellow"}] +scoreboard players set $hide_emissive ts.sa.settings 0 +execute as @e[type=!#spawnanimations:exclude,tag=ts.sa.ehs.shrunk] run function spawnanimations:internal/entity/ehs/entity_specific/emissive_layer/unhide +execute as @e[type=!#spawnanimations:exclude,tag=ts.sa.ehs.pehkui.shrunk] run function spawnanimations:internal/entity/ehs/pehkui/unhide +function #spawnanimations:settings diff --git a/data/spawnanimations/functions/settings/disable_playsounds.mcfunction b/data/spawnanimations/functions/settings/disable_playsounds.mcfunction new file mode 100644 index 0000000..8333762 --- /dev/null +++ b/data/spawnanimations/functions/settings/disable_playsounds.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Play Animation Sounds]","color":"yellow"}] +scoreboard players set $play_sounds ts.sa.settings 0 +function #spawnanimations:settings diff --git a/data/spawnanimations/functions/settings/disable_poofanim.mcfunction b/data/spawnanimations/functions/settings/disable_poofanim.mcfunction new file mode 100644 index 0000000..62139ca --- /dev/null +++ b/data/spawnanimations/functions/settings/disable_poofanim.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Enable Poof Animation]","color":"yellow"}] +scoreboard players set $enable_poof_anim ts.sa.settings 0 +function #spawnanimations:settings diff --git a/data/spawnanimations/functions/settings/disable_reduceendermanparticles.mcfunction b/data/spawnanimations/functions/settings/disable_reduceendermanparticles.mcfunction new file mode 100644 index 0000000..b6ae018 --- /dev/null +++ b/data/spawnanimations/functions/settings/disable_reduceendermanparticles.mcfunction @@ -0,0 +1,6 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Disabled "},{"text":"[Reduce Hidden Enderman Particles]","color":"yellow"}] +tellraw @s ["",{"text":"ℹ Info: ","color":"blue"},{"text":"This change only applies to new mobs"}] +scoreboard players set $enderman_hack ts.sa.settings 0 +function #spawnanimations:settings diff --git a/data/spawnanimations/functions/settings/enable_allblocksupport.mcfunction b/data/spawnanimations/functions/settings/enable_allblocksupport.mcfunction index e563573..8430335 100644 --- a/data/spawnanimations/functions/settings/enable_allblocksupport.mcfunction +++ b/data/spawnanimations/functions/settings/enable_allblocksupport.mcfunction @@ -1,5 +1,5 @@ ##by Tschipcraft -tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Play animation on unsupported blocks]","color":"yellow"}] +tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Play Animation on Unsupported Blocks]","color":"yellow"}] scoreboard players set $play_unsupport ts.sa.settings 1 function #spawnanimations:settings diff --git a/data/spawnanimations/functions/settings/enable_hidearmorandtools.mcfunction b/data/spawnanimations/functions/settings/enable_hidearmorandtools.mcfunction index 74dbc63..bbe4aa4 100644 --- a/data/spawnanimations/functions/settings/enable_hidearmorandtools.mcfunction +++ b/data/spawnanimations/functions/settings/enable_hidearmorandtools.mcfunction @@ -1,5 +1,6 @@ ##by Tschipcraft -tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Hide armor and tools]","color":"yellow"}] +tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Hide Worn Armor and Tools]","color":"yellow"}] +tellraw @s ["",{"text":"ℹ Info: ","color":"blue"},{"text":"This change only applies to new mobs"}] scoreboard players set $hide_armor ts.sa.settings 1 function #spawnanimations:settings diff --git a/data/spawnanimations/functions/settings/enable_hideemissive.mcfunction b/data/spawnanimations/functions/settings/enable_hideemissive.mcfunction new file mode 100644 index 0000000..4466bc8 --- /dev/null +++ b/data/spawnanimations/functions/settings/enable_hideemissive.mcfunction @@ -0,0 +1,6 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Hide Emissive Mob Layers]","color":"yellow"}] +tellraw @s ["",{"text":"ℹ Info: ","color":"blue"},{"text":"This change only applies to new mobs"}] +scoreboard players set $hide_emissive ts.sa.settings 1 +function #spawnanimations:settings diff --git a/data/spawnanimations/functions/settings/enable_playsounds.mcfunction b/data/spawnanimations/functions/settings/enable_playsounds.mcfunction new file mode 100644 index 0000000..2ce58f9 --- /dev/null +++ b/data/spawnanimations/functions/settings/enable_playsounds.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Play Animation Sounds]","color":"yellow"}] +scoreboard players set $play_sounds ts.sa.settings 1 +function #spawnanimations:settings diff --git a/data/spawnanimations/functions/settings/enable_poofanim.mcfunction b/data/spawnanimations/functions/settings/enable_poofanim.mcfunction new file mode 100644 index 0000000..96482c7 --- /dev/null +++ b/data/spawnanimations/functions/settings/enable_poofanim.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Enable Poof Animation]","color":"yellow"}] +scoreboard players set $enable_poof_anim ts.sa.settings 1 +function #spawnanimations:settings diff --git a/data/spawnanimations/functions/settings/enable_reduceendermanparticles.mcfunction b/data/spawnanimations/functions/settings/enable_reduceendermanparticles.mcfunction new file mode 100644 index 0000000..ee69c22 --- /dev/null +++ b/data/spawnanimations/functions/settings/enable_reduceendermanparticles.mcfunction @@ -0,0 +1,6 @@ +##by Tschipcraft + +tellraw @s ["",{"text":"\n-> Enabled "},{"text":"[Reduce Hidden Enderman Particles]","color":"yellow"}] +tellraw @s ["",{"text":"ℹ Info: ","color":"blue"},{"text":"This change only applies to new mobs"}] +scoreboard players set $enderman_hack ts.sa.settings 1 +function #spawnanimations:settings diff --git a/data/spawnanimations/functions/settings/vanilla.mcfunction b/data/spawnanimations/functions/settings/vanilla.mcfunction index 87a1320..bd68ca0 100644 --- a/data/spawnanimations/functions/settings/vanilla.mcfunction +++ b/data/spawnanimations/functions/settings/vanilla.mcfunction @@ -1,5 +1,6 @@ ##by Tschipcraft -tellraw @s ["",{"text":"\n-> Set activation mode to "},{"text":"[vanilla]","color":"yellow"}] +tellraw @s ["",{"text":"\n-> Set Activation Mode to "},{"text":"[Vanilla]","color":"yellow"}] +execute if score $activation_dist ts.sa.settings matches ..24 run tellraw @s ["",{"text":"ℹ Info: ","color":"blue"},{"text":"It is recommended to set the activation distance to at least 25 blocks when using the vanilla activation mode to see the animation","hoverEvent":{"action":"show_text","contents":"Why? In vanilla, mobs do not spawn if a player is within a 24-block radius (spherical)"}}] scoreboard players set $activation_mode ts.sa.settings 0 function #spawnanimations:settings diff --git a/data/spawnanimations/functions/uninstall.mcfunction b/data/spawnanimations/functions/uninstall.mcfunction index ff3f2b6..f188b4c 100644 --- a/data/spawnanimations/functions/uninstall.mcfunction +++ b/data/spawnanimations/functions/uninstall.mcfunction @@ -17,6 +17,9 @@ scoreboard objectives remove ts.sa.welcome scoreboard objectives remove ts.sa.x scoreboard objectives remove ts.sa.y scoreboard objectives remove ts.sa.z +scoreboard objectives remove ts.sa.prev_x +scoreboard objectives remove ts.sa.prev_y +scoreboard objectives remove ts.sa.prev_z scoreboard objectives remove ts.sa.settings scoreboard objectives remove ts.sa.distance diff --git a/data/spawnanimations/predicate/attacking.json b/data/spawnanimations/predicate/attacking.json index 296bc70..49336e1 100644 --- a/data/spawnanimations/predicate/attacking.json +++ b/data/spawnanimations/predicate/attacking.json @@ -4,8 +4,8 @@ "predicate": { "targeted_entity": { "distance": { - "absolute": { - "max": 3 + "horizontal": { + "max": 3.5 } } } diff --git a/data/spawnanimations/predicates/attacking.json b/data/spawnanimations/predicates/attacking.json index 296bc70..49336e1 100644 --- a/data/spawnanimations/predicates/attacking.json +++ b/data/spawnanimations/predicates/attacking.json @@ -4,8 +4,8 @@ "predicate": { "targeted_entity": { "distance": { - "absolute": { - "max": 3 + "horizontal": { + "max": 3.5 } } } diff --git a/data/spawnanimations/tags/entity_type/can_wear_armor.json b/data/spawnanimations/tags/entity_type/can_wear_armor.json index 648b3d9..72a007b 100644 --- a/data/spawnanimations/tags/entity_type/can_wear_armor.json +++ b/data/spawnanimations/tags/entity_type/can_wear_armor.json @@ -7,7 +7,7 @@ "minecraft:drowned", "#minecraft:skeletons", "minecraft:piglin", - "minecraft:zombified_piglin", - "minecraft:piglin_brute" + "minecraft:piglin_brute", + "minecraft:zombified_piglin" ] } diff --git a/data/spawnanimations/tags/entity_type/dig_up_animation.json b/data/spawnanimations/tags/entity_type/dig_up_animation.json index 8249491..b883c5a 100644 --- a/data/spawnanimations/tags/entity_type/dig_up_animation.json +++ b/data/spawnanimations/tags/entity_type/dig_up_animation.json @@ -8,14 +8,13 @@ "minecraft:skeleton", "minecraft:stray", {"id": "minecraft:bogged", "required": false}, + "minecraft:creeper", "minecraft:spider", "minecraft:cave_spider", - "minecraft:creeper", + "minecraft:enderman", "minecraft:wither_skeleton", - "minecraft:hoglin", "minecraft:zombified_piglin", "minecraft:strider", - "minecraft:enderman", "minecraft:giant", "minecraft:magma_cube", "minecraft:slime" diff --git a/data/spawnanimations/tags/entity_type/has_emissive_layer.json b/data/spawnanimations/tags/entity_type/has_emissive_layer.json new file mode 100644 index 0000000..63e7315 --- /dev/null +++ b/data/spawnanimations/tags/entity_type/has_emissive_layer.json @@ -0,0 +1,9 @@ +{ + "//comment": "Entities specified here have an emissive layer which will not vanish with the invisibility effect. Instead, they will be shrunk to 6.25% of their size to become invisible to players.", + "replace": false, + "values": [ + "minecraft:spider", + "minecraft:cave_spider", + "minecraft:enderman" + ] +} diff --git a/data/spawnanimations/tags/entity_types/can_wear_armor.json b/data/spawnanimations/tags/entity_types/can_wear_armor.json index 648b3d9..72a007b 100644 --- a/data/spawnanimations/tags/entity_types/can_wear_armor.json +++ b/data/spawnanimations/tags/entity_types/can_wear_armor.json @@ -7,7 +7,7 @@ "minecraft:drowned", "#minecraft:skeletons", "minecraft:piglin", - "minecraft:zombified_piglin", - "minecraft:piglin_brute" + "minecraft:piglin_brute", + "minecraft:zombified_piglin" ] } diff --git a/data/spawnanimations/tags/entity_types/dig_up_animation.json b/data/spawnanimations/tags/entity_types/dig_up_animation.json index 8249491..b883c5a 100644 --- a/data/spawnanimations/tags/entity_types/dig_up_animation.json +++ b/data/spawnanimations/tags/entity_types/dig_up_animation.json @@ -8,14 +8,13 @@ "minecraft:skeleton", "minecraft:stray", {"id": "minecraft:bogged", "required": false}, + "minecraft:creeper", "minecraft:spider", "minecraft:cave_spider", - "minecraft:creeper", + "minecraft:enderman", "minecraft:wither_skeleton", - "minecraft:hoglin", "minecraft:zombified_piglin", "minecraft:strider", - "minecraft:enderman", "minecraft:giant", "minecraft:magma_cube", "minecraft:slime" diff --git a/data/spawnanimations/tags/entity_types/has_emissive_layer.json b/data/spawnanimations/tags/entity_types/has_emissive_layer.json new file mode 100644 index 0000000..63e7315 --- /dev/null +++ b/data/spawnanimations/tags/entity_types/has_emissive_layer.json @@ -0,0 +1,9 @@ +{ + "//comment": "Entities specified here have an emissive layer which will not vanish with the invisibility effect. Instead, they will be shrunk to 6.25% of their size to become invisible to players.", + "replace": false, + "values": [ + "minecraft:spider", + "minecraft:cave_spider", + "minecraft:enderman" + ] +} diff --git a/fabric.mod.json b/fabric.mod.json index 4905d80..00b9d5c 100644 --- a/fabric.mod.json +++ b/fabric.mod.json @@ -26,11 +26,17 @@ "java": ">=8" }, "recommends": { - "modmenu": "*", - "modmenu-badges-lib": "*", "midnightlib": "*", "mr_spawn_animationscompats": "*" }, + "suggests": { + "pehkui": ">=3.4.0", + "modmenu": "*", + "modmenu-badges-lib": "*" + }, + "conflicts": { + "pehkui": "<3.4.0" + }, "custom": { "modmenu": { "links": { diff --git a/net/tschipcraft/spawnanimations/fabric/Config.class b/net/tschipcraft/spawnanimations/fabric/Config.class index 9844295..c42d298 100644 Binary files a/net/tschipcraft/spawnanimations/fabric/Config.class and b/net/tschipcraft/spawnanimations/fabric/Config.class differ diff --git a/net/tschipcraft/spawnanimations/fabric/sendConfig.class b/net/tschipcraft/spawnanimations/fabric/sendConfig.class index b05d2cf..83e46f4 100644 Binary files a/net/tschipcraft/spawnanimations/fabric/sendConfig.class and b/net/tschipcraft/spawnanimations/fabric/sendConfig.class differ diff --git a/net/tschipcraft/spawnanimations/forge/Config.class b/net/tschipcraft/spawnanimations/forge/Config.class index b789866..8b8fbed 100644 Binary files a/net/tschipcraft/spawnanimations/forge/Config.class and b/net/tschipcraft/spawnanimations/forge/Config.class differ diff --git a/net/tschipcraft/spawnanimations/forge/sendConfig.class b/net/tschipcraft/spawnanimations/forge/sendConfig.class index fdebde5..16dfdc8 100644 Binary files a/net/tschipcraft/spawnanimations/forge/sendConfig.class and b/net/tschipcraft/spawnanimations/forge/sendConfig.class differ diff --git a/net/tschipcraft/spawnanimations/neoforge/Config.class b/net/tschipcraft/spawnanimations/neoforge/Config.class index 87d2187..116aa7c 100644 Binary files a/net/tschipcraft/spawnanimations/neoforge/Config.class and b/net/tschipcraft/spawnanimations/neoforge/Config.class differ diff --git a/net/tschipcraft/spawnanimations/neoforge/sendConfig.class b/net/tschipcraft/spawnanimations/neoforge/sendConfig.class index e84ee13..c668ad3 100644 Binary files a/net/tschipcraft/spawnanimations/neoforge/sendConfig.class and b/net/tschipcraft/spawnanimations/neoforge/sendConfig.class differ diff --git a/overlay_33/data/spawnanimations/functions/internal/entity/ehs/entity_specific/emissive_layer/hide.mcfunction b/overlay_33/data/spawnanimations/functions/internal/entity/ehs/entity_specific/emissive_layer/hide.mcfunction new file mode 100644 index 0000000..b9d4520 --- /dev/null +++ b/overlay_33/data/spawnanimations/functions/internal/entity/ehs/entity_specific/emissive_layer/hide.mcfunction @@ -0,0 +1,12 @@ +##by Tschipcraft +# Shrinks entities with an emissive layer to lowest possible scale (0.0625) +# We do this using a negative scale modifier to not disturb the base scale value + +attribute @s minecraft:generic.scale modifier add b3b6680a-c78e-4476-88b1-c21017dd4ecc spawnanimations.ehs.scale -1000000000000000000000000000000 add_value +tag @s add ts.sa.ehs.shrunk + +# Save initial position +data modify storage spawnanimations:temp Pos set from entity @s Pos +execute store result score @s ts.sa.prev_x run data get storage spawnanimations:temp Pos[0] 10 +execute store result score @s ts.sa.prev_y run data get storage spawnanimations:temp Pos[1] 10 +execute store result score @s ts.sa.prev_z run data get storage spawnanimations:temp Pos[2] 10 diff --git a/overlay_33/data/spawnanimations/functions/internal/entity/ehs/entity_specific/emissive_layer/unhide.mcfunction b/overlay_33/data/spawnanimations/functions/internal/entity/ehs/entity_specific/emissive_layer/unhide.mcfunction new file mode 100644 index 0000000..fb813ad --- /dev/null +++ b/overlay_33/data/spawnanimations/functions/internal/entity/ehs/entity_specific/emissive_layer/unhide.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft +# Resets entities with an emissive layer that got their scale changed + +attribute @s minecraft:generic.scale modifier remove b3b6680a-c78e-4476-88b1-c21017dd4ecc +tag @s remove ts.sa.ehs.shrunk diff --git a/overlay_35/data/spawnanimations/predicates/validate/detect_old_format.json b/overlay_35/data/spawnanimations/predicates/validate/detect_v0_format.json similarity index 100% rename from overlay_35/data/spawnanimations/predicates/validate/detect_old_format.json rename to overlay_35/data/spawnanimations/predicates/validate/detect_v0_format.json diff --git a/overlay_35/overrides.impdoc b/overlay_35/overrides.impdoc new file mode 100644 index 0000000..eece619 --- /dev/null +++ b/overlay_35/overrides.impdoc @@ -0,0 +1,4 @@ +@targets 24w11a..24w20a +@changes predicates + +- `custom_data` now uses a sub predicate diff --git a/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/hide.mcfunction b/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/hide.mcfunction new file mode 100644 index 0000000..8dce29e --- /dev/null +++ b/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/hide.mcfunction @@ -0,0 +1,12 @@ +##by Tschipcraft +# Shrinks entities with an emissive layer to lowest possible scale (0.0625) +# We do this using a negative scale modifier to not disturb the base scale value + +attribute @s minecraft:generic.scale modifier add spawnanimations.ehs.scale -1000000000000000000000000000000 add_value +tag @s add ts.sa.ehs.shrunk + +# Save initial position +data modify storage spawnanimations:temp Pos set from entity @s Pos +execute store result score @s ts.sa.prev_x run data get storage spawnanimations:temp Pos[0] 10 +execute store result score @s ts.sa.prev_y run data get storage spawnanimations:temp Pos[1] 10 +execute store result score @s ts.sa.prev_z run data get storage spawnanimations:temp Pos[2] 10 diff --git a/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/unhide.mcfunction b/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/unhide.mcfunction new file mode 100644 index 0000000..82ba42c --- /dev/null +++ b/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/entity_specific/emissive_layer/unhide.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft +# Resets entities with an emissive layer that got their scale changed + +attribute @s minecraft:generic.scale modifier remove spawnanimations.ehs.scale +tag @s remove ts.sa.ehs.shrunk diff --git a/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/pehkui/check_installed.mcfunction b/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/pehkui/check_installed.mcfunction new file mode 100644 index 0000000..28f4e9e --- /dev/null +++ b/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/pehkui/check_installed.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft +# Checks if Pehkui is installed + +scale get @r +scoreboard players set $pehkui_installed ts.sa.settings 1 diff --git a/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/pehkui/enderman/hide.mcfunction b/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/pehkui/enderman/hide.mcfunction new file mode 100644 index 0000000..2f2d6de --- /dev/null +++ b/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/pehkui/enderman/hide.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft +# Shrinks the hitbox of a Enderman to a smaller scale to better hide its particles + +scale set pehkui:hitbox_height 0.2 @s +tag @s add ts.sa.ehs.pehkui.hitbox diff --git a/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/pehkui/enderman/unhide.mcfunction b/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/pehkui/enderman/unhide.mcfunction new file mode 100644 index 0000000..2bf14de --- /dev/null +++ b/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/pehkui/enderman/unhide.mcfunction @@ -0,0 +1,5 @@ +##by Tschipcraft +# Resets the hitbox of a Enderman + +scale reset pehkui:hitbox_height @s +tag @s remove ts.sa.ehs.pehkui.hitbox diff --git a/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/pehkui/hide.mcfunction b/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/pehkui/hide.mcfunction new file mode 100644 index 0000000..e65ffa4 --- /dev/null +++ b/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/pehkui/hide.mcfunction @@ -0,0 +1,11 @@ +##by Tschipcraft +# Shrinks entities to a smaller scale to completely hide them + +scale delay set pehkui:model_width 0 @s +scale delay set pehkui:model_height 0 @s + +scale set pehkui:model_width 0.0001 @s +scale set pehkui:model_height 0.0001 @s +execute if score $enderman_hack ts.sa.settings matches 1..2 as @s[type=minecraft:enderman] run function spawnanimations:internal/entity/ehs/pehkui/enderman/hide + +tag @s add ts.sa.ehs.pehkui.shrunk diff --git a/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/pehkui/unhide.mcfunction b/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/pehkui/unhide.mcfunction new file mode 100644 index 0000000..32d5bfc --- /dev/null +++ b/overlay_pre_49/data/spawnanimations/function/internal/entity/ehs/pehkui/unhide.mcfunction @@ -0,0 +1,13 @@ +##by Tschipcraft +# Resets entities that got their scale changed + +scale delay set pehkui:model_width 10 @s +scale delay set pehkui:model_height 10 @s +scale easing set pehkui:model_width pehkui:quadratic_in_out @s +scale easing set pehkui:model_height pehkui:quadratic_in_out @s + +scale set pehkui:model_width 1 @s +scale set pehkui:model_height 1 @s +execute as @s[tag=ts.sa.ehs.pehkui.hitbox] run function spawnanimations:internal/entity/ehs/pehkui/enderman/unhide + +tag @s remove ts.sa.ehs.pehkui.shrunk diff --git a/overlay_pre_49/overrides.impdoc b/overlay_pre_49/overrides.impdoc new file mode 100644 index 0000000..b603f70 --- /dev/null +++ b/overlay_pre_49/overrides.impdoc @@ -0,0 +1,5 @@ +@targets 24w21a..1.21.1 +@changes function calls + +- Attribute IDs have the old `generic.` prefix +- Pehkui integration (no port to newer versions exists yet) diff --git a/overlay_pre_63/data/spawnanimations/function/settings/core.mcfunction b/overlay_pre_63/data/spawnanimations/function/settings/core.mcfunction index 94195bb..849533f 100644 --- a/overlay_pre_63/data/spawnanimations/function/settings/core.mcfunction +++ b/overlay_pre_63/data/spawnanimations/function/settings/core.mcfunction @@ -7,20 +7,41 @@ execute unless score #lock_distance ts.sa.settings matches 1 if score $activatio execute unless score #lock_distance ts.sa.settings matches 1 if score $activation_dist ts.sa.settings matches 100.. run tellraw @s [{"text":"Activation Distance","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"Mobs closer to you than this value will play the animation"}]}},{"text":" "},{"text":"<<< ","color":"aqua","hoverEvent":{"action":"show_text","contents":[{"text":"-1"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/decrease"}},{"score":{"name":"$activation_dist","objective":"ts.sa.settings"},"color":"green","bold":true},{"text":" blocks","color":"green"},{"text":" >>>","color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"Max is 100","color":"red"}]}},{"text":" [\u270e]","color":"gray","clickEvent":{"action":"suggest_command","value":"/scoreboard players set @s ts.sa.distance "},"hoverEvent":{"action":"show_text","contents":"Edit"}}] execute if score #lock_distance ts.sa.settings matches 1 run tellraw @s [{"text":"Activation Distance <<< ","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}},{"score":{"name":"$activation_dist","objective":"ts.sa.settings"}},{"text":" blocks >>>"}] -execute if score $activation_mode ts.sa.settings matches 1 run tellraw @s ["",{"text":"Activation mode","bold":true},{"text":" "},{"text":"[>classic<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"Out of range mobs will stay hidden until a player is in range."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/classic"}},{"text":" | "},{"text":"[vanilla]","color":"red","hoverEvent":{"action":"show_text","contents":[{"text":"Out of range mobs will spawn normally."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/vanilla"}}] -execute if score $activation_mode ts.sa.settings matches 0 run tellraw @s ["",{"text":"Activation mode","bold":true},{"text":" "},{"text":"[classic]","color":"red","hoverEvent":{"action":"show_text","contents":[{"text":"Out of range mobs will stay hidden until a player is in range."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/classic"}},{"text":" | "},{"text":"[>vanilla<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"Out of range mobs will spawn normally."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/vanilla"}}] -execute if score $activation_mode ts.sa.settings matches -1 run tellraw @s [{"text":"Activation mode [classic] | [>vanilla<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] -execute if score $activation_mode ts.sa.settings matches 2 run tellraw @s [{"text":"Activation mode [>classic<] | [vanilla]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] - -execute if score $hide_armor ts.sa.settings matches 1 run tellraw @s ["",{"text":"Hide worn armor and tools","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"Worn armor and tools will be hidden. "},{"text":"\n⚠ Note: This feature may impact worn armor and tool drop rates inside farms.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_hidearmorandtools"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"Worn armor and tools will not be hidden."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_hidearmorandtools"}}] -execute if score $hide_armor ts.sa.settings matches 0 run tellraw @s ["",{"text":"Hide worn armor and tools","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":[{"text":"Worn armor and tools will be hidden. "},{"text":"\n⚠ Note: This feature may impact worn armor and tool drop rates inside farms.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_hidearmorandtools"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"Worn armor and tools will not be hidden."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_hidearmorandtools"}}] -execute if score $hide_armor ts.sa.settings matches -1 run tellraw @s [{"text":"Hide worn armor and tools [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] -execute if score $hide_armor ts.sa.settings matches 2 run tellraw @s [{"text":"Hide worn armor and tools [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] - -execute if score $play_unsupport ts.sa.settings matches 1 run tellraw @s ["",{"text":"Play animation on unsupported blocks","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"The block break animation is played on unsupported blocks. "},{"text":"\n⚠ Note: This could lead to unwanted block updates.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_allblocksupport"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"The block break animation will not be played on unsupported blocks."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_allblocksupport"}}] -execute if score $play_unsupport ts.sa.settings matches 0 run tellraw @s ["",{"text":"Play animation on unsupported blocks","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":[{"text":"The block break animation is played on unsupported blocks. "},{"text":"\n⚠ Note: This could lead to unwanted block updates.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_allblocksupport"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"The block break animation will not be played on unsupported blocks."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_allblocksupport"}}] -execute if score $play_unsupport ts.sa.settings matches -1 run tellraw @s [{"text":"Play animation on unsupported blocks [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] -execute if score $play_unsupport ts.sa.settings matches 2 run tellraw @s [{"text":"Play animation on unsupported blocks [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $activation_mode ts.sa.settings matches 1 run tellraw @s ["",{"text":"Activation Mode","bold":true},{"text":" "},{"text":"[>Classic<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"Mobs outside the activation range remain hidden until a player is in range."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/classic"}},{"text":" | "},{"text":"[Vanilla]","color":"red","hoverEvent":{"action":"show_text","contents":[{"text":"Mobs outside the activation range spawn normally."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/vanilla"}}] +execute if score $activation_mode ts.sa.settings matches 0 run tellraw @s ["",{"text":"Activation Mode","bold":true},{"text":" "},{"text":"[Classic]","color":"red","hoverEvent":{"action":"show_text","contents":[{"text":"Mobs outside the activation range remain hidden until a player is in range."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/classic"}},{"text":" | "},{"text":"[>Vanilla<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"Mobs outside the activation range spawn normally."}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/vanilla"}}] +execute if score $activation_mode ts.sa.settings matches -1 run tellraw @s [{"text":"Activation Mode [Classic] | [>Vanilla<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $activation_mode ts.sa.settings matches 2 run tellraw @s [{"text":"Activation Mode [>Classic<] | [Vanilla]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] + +execute if score $enable_poof_anim ts.sa.settings matches 1 run tellraw @s ["",{"text":"Enable Poof Animation","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":"If enabled, some mobs, or mobs without a block to dig up from, will play the poof animation instead."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_poofanim"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"Poof animation will not be played."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_poofanim"}}] +execute if score $enable_poof_anim ts.sa.settings matches 0 run tellraw @s ["",{"text":"Enable Poof Animation","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":"If enabled, some mobs, or mobs without a block to dig up from, will play the poof animation instead."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_poofanim"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"Poof animation will not be played."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_poofanim"}}] +execute if score $enable_poof_anim ts.sa.settings matches -1 run tellraw @s [{"text":"Enable Poof Animation [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $enable_poof_anim ts.sa.settings matches 2 run tellraw @s [{"text":"Enable Poof Animation [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] + +execute if score $play_sounds ts.sa.settings matches 1 run tellraw @s ["",{"text":"Play Animation Sounds","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":"If enabled, sounds will be played during the animation."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_playsounds"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"Sounds will not be played."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_playsounds"}}] +execute if score $play_sounds ts.sa.settings matches 0 run tellraw @s ["",{"text":"Play Animation Sounds","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":"If enabled, sounds will be played during the animation."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_playsounds"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"Sounds will not be played."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_playsounds"}}] +execute if score $play_sounds ts.sa.settings matches -1 run tellraw @s [{"text":"Play Animation Sounds [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $play_sounds ts.sa.settings matches 2 run tellraw @s [{"text":"Play Animation Sounds [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] + +execute if score $hide_armor ts.sa.settings matches 1 run tellraw @s ["",{"text":"Hide Worn Armor and Tools","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, stores the worn armor and tools in the body, feet, or in some versions, leggings slot of a hidden entity. "},{"text":"\n⚠ Note: This may impact worn armor and tool drop rates from mob farms.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_hidearmorandtools"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"Worn armor and tools will not be hidden."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_hidearmorandtools"}}] +execute if score $hide_armor ts.sa.settings matches 0 run tellraw @s ["",{"text":"Hide Worn Armor and Tools","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, stores the worn armor and tools in the body, feet, or in some versions, leggings slot of a hidden entity. "},{"text":"\n⚠ Note: This may impact worn armor and tool drop rates from mob farms when enabled.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_hidearmorandtools"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"Worn armor and tools will not be hidden."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_hidearmorandtools"}}] +execute if score $hide_armor ts.sa.settings matches -1 run tellraw @s [{"text":"Hide Worn Armor and Tools [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $hide_armor ts.sa.settings matches 2 run tellraw @s [{"text":"Hide Worn Armor and Tools [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] + +execute if score $hide_emissive ts.sa.settings matches 1 run tellraw @s ["",{"text":"Hide Emissive Mob Layers","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, emissive layers of some mobs (e.g., Endermen, Spiders, and Cave Spiders), or with Pehkui all mobs, will be hidden by shrinking them."},{"text":"\n⚠ Note: This may decrease the efficiency of mob farms due to the changed hitbox size for hidden entities when Pehkui is not installed and the feature is enabled.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_hideemissive"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"Emissive layers will not be hidden."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_hideemissive"}}] +execute if score $hide_emissive ts.sa.settings matches 0 run tellraw @s ["",{"text":"Hide Emissive Mob Layers","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, emissive layers of some mobs (e.g., Endermen, Spiders, and Cave Spiders), or with Pehkui all mobs, will be hidden by shrinking them."},{"text":"\n⚠ Note: This may decrease the efficiency of mob farms due to the changed hitbox size for hidden entities when Pehkui is not installed and the feature is enabled.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_hideemissive"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"Emissive layers will not be hidden."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_hideemissive"}}] +execute if score $hide_emissive ts.sa.settings matches -1 run tellraw @s [{"text":"Hide Emissive Mob Layers [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $hide_emissive ts.sa.settings matches 2 run tellraw @s [{"text":"Hide Emissive Mob Layers [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] + +execute if score $pehkui_installed ts.sa.settings matches 1 if score $enderman_hack ts.sa.settings matches 1 run tellraw @s ["",{"text":"Reduce Hidden Enderman Particles","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, the number of particles emitted by hidden Endermen will be reduced by shrinking their hitbox scale."},{"text":"\n⚠ Note: This may decrease the efficiency of Enderman mob farms.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_reduceendermanparticles"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"Hidden Enderman particles will not be reduced."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_reduceendermanparticles"}}] +execute if score $pehkui_installed ts.sa.settings matches 1 if score $enderman_hack ts.sa.settings matches 0 run tellraw @s ["",{"text":"Reduce Hidden Enderman Particles","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, the number of particles emitted by hidden Endermen will be reduced by shrinking their hitbox scale."},{"text":"\n⚠ Note: This may decrease the efficiency of Enderman mob farms when enabled.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_reduceendermanparticles"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"Hidden Enderman particles will not be reduced."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_reduceendermanparticles"}}] +execute if score $enderman_hack ts.sa.settings matches -1 run tellraw @s [{"text":"Reduce Hidden Enderman Particles [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here. Only applicable when Pehkui is installed."}]}}] +execute if score $enderman_hack ts.sa.settings matches 2 run tellraw @s [{"text":"Reduce Hidden Enderman Particles [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here. Only applicable when Pehkui is installed."}]}}] + +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches 1 run tellraw @s ["",{"text":"Play Animation on Unsupported Blocks","bold":true},{"text":" "},{"text":"[>✔<]","color":"green","bold":true,"hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, the block breaking animation plays on blocks that are not hard-coded into the data pack. "},{"text":"\n⚠ Note: This could lead to unwanted block updates.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_allblocksupport"}},{"text":" | "},{"text":"[❌]","color":"dark_red","hoverEvent":{"action":"show_text","contents":"The block breaking animation will not be played on unsupported blocks."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_allblocksupport"}}] +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches 0 run tellraw @s ["",{"text":"Play Animation on Unsupported Blocks","bold":true},{"text":" "},{"text":"[✔]","color":"dark_green","hoverEvent":{"action":"show_text","contents":[{"text":"If enabled, the block breaking animation plays on blocks that are not hard-coded into the data pack. "},{"text":"\n⚠ Note: This could lead to unwanted block updates.","color":"gold"}]},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/enable_allblocksupport"}},{"text":" | "},{"text":"[>❌<]","color":"red","bold":true,"hoverEvent":{"action":"show_text","contents":"The block breaking animation will not be played on unsupported blocks."},"clickEvent":{"action":"run_command","value":"/function spawnanimations:settings/disable_allblocksupport"}}] +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches -1 run tellraw @s [{"text":"Play Animation on Unsupported Blocks [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $play_sounds ts.sa.settings matches 1..2 if score $play_unsupport ts.sa.settings matches 2 run tellraw @s [{"text":"Play Animation on Unsupported Blocks [>✔<] | [❌]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"This setting is getting controlled globally and can't be changed here."}]}}] +execute if score $play_sounds ts.sa.settings matches -1..0 run tellraw @s [{"text":"Play Animation on Unsupported Blocks [✔] | [>❌<]","bold":false,"color":"gray","hoverEvent":{"action":"show_text","contents":[{"text":"Enable [Play Animation Sounds] first."}]}}] function spawnanimations:settings/hide_feedback/main playsound minecraft:block.dispenser.dispense master @s ~ ~ ~ 0.2 2 diff --git a/pack.mcmeta b/pack.mcmeta index 9902f78..8427626 100644 --- a/pack.mcmeta +++ b/pack.mcmeta @@ -19,6 +19,10 @@ "formats": [39,44], "directory": "overlay_39" }, + { + "formats": [45,48], + "directory": "overlay_pre_49" + }, { "formats": [45,62], "directory": "overlay_pre_63" diff --git a/src/main/java/net/tschipcraft/spawnanimations/fabric/Config.java b/src/main/java/net/tschipcraft/spawnanimations/fabric/Config.java index 7f5fcf7..e8ffe9e 100644 --- a/src/main/java/net/tschipcraft/spawnanimations/fabric/Config.java +++ b/src/main/java/net/tschipcraft/spawnanimations/fabric/Config.java @@ -29,6 +29,10 @@ public enum mode { public static int activation_distance = 0; @Entry public static mode activation_mode = mode.WORLD; + @Entry + public static bool enable_poof_animation = bool.WORLD; + @Entry + public static bool play_animation_sounds = bool.WORLD; @Comment public static Comment empty2; @@ -36,6 +40,10 @@ public enum mode { @Entry public static bool hide_worn_armor_and_tools = bool.WORLD; @Entry + public static bool hide_emissive_mob_layers = bool.WORLD; + @Entry + public static bool reduce_enderman_particles = bool.WORLD; + @Entry public static bool play_animation_on_unsupported_blocks = bool.WORLD; } diff --git a/src/main/java/net/tschipcraft/spawnanimations/fabric/sendConfig.java b/src/main/java/net/tschipcraft/spawnanimations/fabric/sendConfig.java index 8dc9100..d88ef86 100644 --- a/src/main/java/net/tschipcraft/spawnanimations/fabric/sendConfig.java +++ b/src/main/java/net/tschipcraft/spawnanimations/fabric/sendConfig.java @@ -8,6 +8,7 @@ public class sendConfig { public static void sendConfig(MinecraftServer server) { sendCommand("scoreboard objectives add ts.sa.settings dummy", server); + if (Config.activation_distance == 0) { sendCommand("execute unless score $activation_dist ts.sa.settings matches 1..100 run scoreboard players set $activation_dist ts.sa.settings 20", server); sendCommand("execute if score #lock_distance ts.sa.settings matches 1 run scoreboard players set #lock_distance ts.sa.settings 0", server); @@ -15,7 +16,6 @@ public static void sendConfig(MinecraftServer server) { sendCommand("scoreboard players set $activation_dist ts.sa.settings " + Config.activation_distance, server); sendCommand("scoreboard players set #lock_distance ts.sa.settings 1", server); } - if (Config.activation_mode == Config.mode.CLASSIC) { sendCommand("scoreboard players set $activation_mode ts.sa.settings 2", server); } else if (Config.activation_mode == Config.mode.VANILLA) { @@ -24,6 +24,21 @@ public static void sendConfig(MinecraftServer server) { sendCommand("execute if score $activation_mode ts.sa.settings matches -1 run scoreboard players set $activation_mode ts.sa.settings 0", server); sendCommand("execute if score $activation_mode ts.sa.settings matches 2 run scoreboard players set $activation_mode ts.sa.settings 1", server); } + if (Config.enable_poof_animation == Config.bool.YES) { + sendCommand("scoreboard players set $enable_poof_anim ts.sa.settings 2", server); + } else if (Config.enable_poof_animation == Config.bool.NO) { + sendCommand("scoreboard players set $enable_poof_anim ts.sa.settings -1", server); + } else { + sendCommand("execute if score $enable_poof_anim ts.sa.settings matches -1 run scoreboard players set $enable_poof_anim ts.sa.settings 0", server); + sendCommand("execute if score $enable_poof_anim ts.sa.settings matches 2 run scoreboard players set $enable_poof_anim ts.sa.settings 1", server); + } + if (Config.play_animation_sounds == Config.bool.YES) { + sendCommand("scoreboard players set $play_sounds ts.sa.settings 2", server); + } else if (Config.play_animation_sounds == Config.bool.NO) { + sendCommand("scoreboard players set $play_sounds ts.sa.settings -1", server); + } else { + sendCommand("execute if score $play_sounds ts.sa.settings matches -1 run scoreboard players set $play_sounds ts.sa.settings 0", server); + sendCommand("execute if score $play_sounds ts.sa.settings matches 2 run scoreboard players set $play_sounds ts.sa.settings 1", server); if (Config.hide_worn_armor_and_tools == Config.bool.YES) { sendCommand("scoreboard players set $hide_armor ts.sa.settings 2", server); @@ -33,6 +48,22 @@ public static void sendConfig(MinecraftServer server) { sendCommand("execute if score $hide_armor ts.sa.settings matches -1 run scoreboard players set $hide_armor ts.sa.settings 0", server); sendCommand("execute if score $hide_armor ts.sa.settings matches 2 run scoreboard players set $hide_armor ts.sa.settings 1", server); } + if (Config.hide_emissive_mob_layers == Config.bool.YES) { + sendCommand("scoreboard players set $hide_emissive ts.sa.settings 2", server); + } else if (Config.hide_emissive_mob_layers == Config.bool.NO) { + sendCommand("scoreboard players set $hide_emissive ts.sa.settings -1", server); + } else { + sendCommand("execute if score $hide_emissive ts.sa.settings matches -1 run scoreboard players set $hide_emissive ts.sa.settings 0", server); + sendCommand("execute if score $hide_emissive ts.sa.settings matches 2 run scoreboard players set $hide_emissive ts.sa.settings 1", server); + } + if (Config.reduce_enderman_particles == Config.bool.YES) { + sendCommand("scoreboard players set $enderman_hack ts.sa.settings 2", server); + } else if (Config.reduce_enderman_particles == Config.bool.NO) { + sendCommand("scoreboard players set $enderman_hack ts.sa.settings -1", server); + } else { + sendCommand("execute if score $enderman_hack ts.sa.settings matches -1 run scoreboard players set $enderman_hack ts.sa.settings 0", server); + sendCommand("execute if score $enderman_hack ts.sa.settings matches 2 run scoreboard players set $enderman_hack ts.sa.settings 1", server); + } if (Config.play_animation_on_unsupported_blocks == Config.bool.YES) { sendCommand("scoreboard players set $play_unsupport ts.sa.settings 2", server); } else if (Config.play_animation_on_unsupported_blocks == Config.bool.NO) { diff --git a/src/main/java/net/tschipcraft/spawnanimations/forge/Config.java b/src/main/java/net/tschipcraft/spawnanimations/forge/Config.java index d06f21e..0a261f4 100644 --- a/src/main/java/net/tschipcraft/spawnanimations/forge/Config.java +++ b/src/main/java/net/tschipcraft/spawnanimations/forge/Config.java @@ -29,6 +29,10 @@ public enum mode { public static int activation_distance = 0; @Entry public static mode activation_mode = mode.WORLD; + @Entry + public static bool enable_poof_animation = bool.WORLD; + @Entry + public static bool play_animation_sounds = bool.WORLD; @Comment public static Comment empty2; @@ -36,6 +40,10 @@ public enum mode { @Entry public static bool hide_worn_armor_and_tools = bool.WORLD; @Entry + public static bool hide_emissive_mob_layers = bool.WORLD; + @Entry + public static bool reduce_enderman_particles = bool.WORLD; + @Entry public static bool play_animation_on_unsupported_blocks = bool.WORLD; } diff --git a/src/main/java/net/tschipcraft/spawnanimations/forge/sendConfig.java b/src/main/java/net/tschipcraft/spawnanimations/forge/sendConfig.java index 84f7016..40bf369 100644 --- a/src/main/java/net/tschipcraft/spawnanimations/forge/sendConfig.java +++ b/src/main/java/net/tschipcraft/spawnanimations/forge/sendConfig.java @@ -8,6 +8,7 @@ public class sendConfig { public static void sendConfig(MinecraftServer server) { sendCommand("scoreboard objectives add ts.sa.settings dummy", server); + if (Config.activation_distance == 0) { sendCommand("execute unless score $activation_dist ts.sa.settings matches 1..100 run scoreboard players set $activation_dist ts.sa.settings 20", server); sendCommand("execute if score #lock_distance ts.sa.settings matches 1 run scoreboard players set #lock_distance ts.sa.settings 0", server); @@ -15,7 +16,6 @@ public static void sendConfig(MinecraftServer server) { sendCommand("scoreboard players set $activation_dist ts.sa.settings " + Config.activation_distance, server); sendCommand("scoreboard players set #lock_distance ts.sa.settings 1", server); } - if (Config.activation_mode == Config.mode.CLASSIC) { sendCommand("scoreboard players set $activation_mode ts.sa.settings 2", server); } else if (Config.activation_mode == Config.mode.VANILLA) { @@ -24,6 +24,21 @@ public static void sendConfig(MinecraftServer server) { sendCommand("execute if score $activation_mode ts.sa.settings matches -1 run scoreboard players set $activation_mode ts.sa.settings 0", server); sendCommand("execute if score $activation_mode ts.sa.settings matches 2 run scoreboard players set $activation_mode ts.sa.settings 1", server); } + if (Config.enable_poof_animation == Config.bool.YES) { + sendCommand("scoreboard players set $enable_poof_anim ts.sa.settings 2", server); + } else if (Config.enable_poof_animation == Config.bool.NO) { + sendCommand("scoreboard players set $enable_poof_anim ts.sa.settings -1", server); + } else { + sendCommand("execute if score $enable_poof_anim ts.sa.settings matches -1 run scoreboard players set $enable_poof_anim ts.sa.settings 0", server); + sendCommand("execute if score $enable_poof_anim ts.sa.settings matches 2 run scoreboard players set $enable_poof_anim ts.sa.settings 1", server); + } + if (Config.play_animation_sounds == Config.bool.YES) { + sendCommand("scoreboard players set $play_sounds ts.sa.settings 2", server); + } else if (Config.play_animation_sounds == Config.bool.NO) { + sendCommand("scoreboard players set $play_sounds ts.sa.settings -1", server); + } else { + sendCommand("execute if score $play_sounds ts.sa.settings matches -1 run scoreboard players set $play_sounds ts.sa.settings 0", server); + sendCommand("execute if score $play_sounds ts.sa.settings matches 2 run scoreboard players set $play_sounds ts.sa.settings 1", server); if (Config.hide_worn_armor_and_tools == Config.bool.YES) { sendCommand("scoreboard players set $hide_armor ts.sa.settings 2", server); @@ -33,6 +48,22 @@ public static void sendConfig(MinecraftServer server) { sendCommand("execute if score $hide_armor ts.sa.settings matches -1 run scoreboard players set $hide_armor ts.sa.settings 0", server); sendCommand("execute if score $hide_armor ts.sa.settings matches 2 run scoreboard players set $hide_armor ts.sa.settings 1", server); } + if (Config.hide_emissive_mob_layers == Config.bool.YES) { + sendCommand("scoreboard players set $hide_emissive ts.sa.settings 2", server); + } else if (Config.hide_emissive_mob_layers == Config.bool.NO) { + sendCommand("scoreboard players set $hide_emissive ts.sa.settings -1", server); + } else { + sendCommand("execute if score $hide_emissive ts.sa.settings matches -1 run scoreboard players set $hide_emissive ts.sa.settings 0", server); + sendCommand("execute if score $hide_emissive ts.sa.settings matches 2 run scoreboard players set $hide_emissive ts.sa.settings 1", server); + } + if (Config.reduce_enderman_particles == Config.bool.YES) { + sendCommand("scoreboard players set $enderman_hack ts.sa.settings 2", server); + } else if (Config.reduce_enderman_particles == Config.bool.NO) { + sendCommand("scoreboard players set $enderman_hack ts.sa.settings -1", server); + } else { + sendCommand("execute if score $enderman_hack ts.sa.settings matches -1 run scoreboard players set $enderman_hack ts.sa.settings 0", server); + sendCommand("execute if score $enderman_hack ts.sa.settings matches 2 run scoreboard players set $enderman_hack ts.sa.settings 1", server); + } if (Config.play_animation_on_unsupported_blocks == Config.bool.YES) { sendCommand("scoreboard players set $play_unsupport ts.sa.settings 2", server); } else if (Config.play_animation_on_unsupported_blocks == Config.bool.NO) { diff --git a/src/main/java/net/tschipcraft/spawnanimations/neoforge/Config.java b/src/main/java/net/tschipcraft/spawnanimations/neoforge/Config.java index 84cff0a..6b45896 100644 --- a/src/main/java/net/tschipcraft/spawnanimations/neoforge/Config.java +++ b/src/main/java/net/tschipcraft/spawnanimations/neoforge/Config.java @@ -29,6 +29,10 @@ public enum mode { public static int activation_distance = 0; @Entry public static mode activation_mode = mode.WORLD; + @Entry + public static bool enable_poof_animation = bool.WORLD; + @Entry + public static bool play_animation_sounds = bool.WORLD; @Comment public static Comment empty2; @@ -36,6 +40,10 @@ public enum mode { @Entry public static bool hide_worn_armor_and_tools = bool.WORLD; @Entry + public static bool hide_emissive_mob_layers = bool.WORLD; + @Entry + public static bool reduce_enderman_particles = bool.WORLD; + @Entry public static bool play_animation_on_unsupported_blocks = bool.WORLD; } diff --git a/src/main/java/net/tschipcraft/spawnanimations/neoforge/sendConfig.java b/src/main/java/net/tschipcraft/spawnanimations/neoforge/sendConfig.java index aea2e46..6e98ce6 100644 --- a/src/main/java/net/tschipcraft/spawnanimations/neoforge/sendConfig.java +++ b/src/main/java/net/tschipcraft/spawnanimations/neoforge/sendConfig.java @@ -8,6 +8,7 @@ public class sendConfig { public static void sendConfig(MinecraftServer server) { sendCommand("scoreboard objectives add ts.sa.settings dummy", server); + if (Config.activation_distance == 0) { sendCommand("execute unless score $activation_dist ts.sa.settings matches 1..100 run scoreboard players set $activation_dist ts.sa.settings 20", server); sendCommand("execute if score #lock_distance ts.sa.settings matches 1 run scoreboard players set #lock_distance ts.sa.settings 0", server); @@ -15,7 +16,6 @@ public static void sendConfig(MinecraftServer server) { sendCommand("scoreboard players set $activation_dist ts.sa.settings " + Config.activation_distance, server); sendCommand("scoreboard players set #lock_distance ts.sa.settings 1", server); } - if (Config.activation_mode == Config.mode.CLASSIC) { sendCommand("scoreboard players set $activation_mode ts.sa.settings 2", server); } else if (Config.activation_mode == Config.mode.VANILLA) { @@ -24,6 +24,21 @@ public static void sendConfig(MinecraftServer server) { sendCommand("execute if score $activation_mode ts.sa.settings matches -1 run scoreboard players set $activation_mode ts.sa.settings 0", server); sendCommand("execute if score $activation_mode ts.sa.settings matches 2 run scoreboard players set $activation_mode ts.sa.settings 1", server); } + if (Config.enable_poof_animation == Config.bool.YES) { + sendCommand("scoreboard players set $enable_poof_anim ts.sa.settings 2", server); + } else if (Config.enable_poof_animation == Config.bool.NO) { + sendCommand("scoreboard players set $enable_poof_anim ts.sa.settings -1", server); + } else { + sendCommand("execute if score $enable_poof_anim ts.sa.settings matches -1 run scoreboard players set $enable_poof_anim ts.sa.settings 0", server); + sendCommand("execute if score $enable_poof_anim ts.sa.settings matches 2 run scoreboard players set $enable_poof_anim ts.sa.settings 1", server); + } + if (Config.play_animation_sounds == Config.bool.YES) { + sendCommand("scoreboard players set $play_sounds ts.sa.settings 2", server); + } else if (Config.play_animation_sounds == Config.bool.NO) { + sendCommand("scoreboard players set $play_sounds ts.sa.settings -1", server); + } else { + sendCommand("execute if score $play_sounds ts.sa.settings matches -1 run scoreboard players set $play_sounds ts.sa.settings 0", server); + sendCommand("execute if score $play_sounds ts.sa.settings matches 2 run scoreboard players set $play_sounds ts.sa.settings 1", server); if (Config.hide_worn_armor_and_tools == Config.bool.YES) { sendCommand("scoreboard players set $hide_armor ts.sa.settings 2", server); @@ -33,6 +48,22 @@ public static void sendConfig(MinecraftServer server) { sendCommand("execute if score $hide_armor ts.sa.settings matches -1 run scoreboard players set $hide_armor ts.sa.settings 0", server); sendCommand("execute if score $hide_armor ts.sa.settings matches 2 run scoreboard players set $hide_armor ts.sa.settings 1", server); } + if (Config.hide_emissive_mob_layers == Config.bool.YES) { + sendCommand("scoreboard players set $hide_emissive ts.sa.settings 2", server); + } else if (Config.hide_emissive_mob_layers == Config.bool.NO) { + sendCommand("scoreboard players set $hide_emissive ts.sa.settings -1", server); + } else { + sendCommand("execute if score $hide_emissive ts.sa.settings matches -1 run scoreboard players set $hide_emissive ts.sa.settings 0", server); + sendCommand("execute if score $hide_emissive ts.sa.settings matches 2 run scoreboard players set $hide_emissive ts.sa.settings 1", server); + } + if (Config.reduce_enderman_particles == Config.bool.YES) { + sendCommand("scoreboard players set $enderman_hack ts.sa.settings 2", server); + } else if (Config.reduce_enderman_particles == Config.bool.NO) { + sendCommand("scoreboard players set $enderman_hack ts.sa.settings -1", server); + } else { + sendCommand("execute if score $enderman_hack ts.sa.settings matches -1 run scoreboard players set $enderman_hack ts.sa.settings 0", server); + sendCommand("execute if score $enderman_hack ts.sa.settings matches 2 run scoreboard players set $enderman_hack ts.sa.settings 1", server); + } if (Config.play_animation_on_unsupported_blocks == Config.bool.YES) { sendCommand("scoreboard players set $play_unsupport ts.sa.settings 2", server); } else if (Config.play_animation_on_unsupported_blocks == Config.bool.NO) { diff --git a/wiki/settings.svg b/wiki/settings.svg index 24a2408..7dd04ed 100644 --- a/wiki/settings.svg +++ b/wiki/settings.svg @@ -1,4 +1,4 @@ - +