Skip to content

Commit ec3b495

Browse files
committed
Add settings for poof animation, sounds, and emissive layers
- Added config options to enable/disable poof animation (#40), animation sounds (closes #39), and hiding emissive mob layers - Added partial support for Pehkui <3.4.0
1 parent b3a5754 commit ec3b495

File tree

60 files changed

+326
-96
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+326
-96
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
- **Entities with emissive layers are now properly hidden** (Endermen, Spiders, and Cave Spiders) (closes [#25](https://github.com/Tschipcraft/spawnanimations/issues/25))
22
- 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
3+
- Added config options to enable/disable poof animation ([#40](https://github.com/Tschipcraft/spawnanimations/issues/40)), animation sounds (closes [#39](https://github.com/Tschipcraft/spawnanimations/issues/39)), and hiding emissive mob layers
34
- Improved performance by refactoring entity activation distance calculations to bundle and cache position data retrieval calls, and updating batch activation logic (the whole data pack is now up to 1ms (~45%ish) faster per tick!)
45
- 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
56
- Added an activation distance recommendation message when using the vanilla activation mode

assets/spawnanimations/lang/en_us.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,29 @@
55

66
"spawnanimations.midnightconfig.title": "Spawn Animations Configuration",
77
"spawnanimations.midnightconfig.empty": "",
8-
"spawnanimations.midnightconfig.configure_ingame": "§dℹ Info:§f To configure this data pack on a world-to-world basis,",
8+
"spawnanimations.midnightconfig.configure_ingame": "§dℹ Info:§f To configure this data pack on a world-to-world basis,",
99
"spawnanimations.midnightconfig.configure_ingame2": "join a world and execute the command §o/function spawnanimations:settings§r.",
1010
"spawnanimations.midnightconfig.empty2": "",
1111
"spawnanimations.midnightconfig.global_settings": "§n§l-=- Global Settings -=-",
12-
"spawnanimations.midnightconfig.info": "§dℹ Info:§f These settings will be applied globally to all worlds.",
12+
"spawnanimations.midnightconfig.info": "§dℹ Info:§f These settings will be applied globally to all worlds.",
1313
"spawnanimations.midnightconfig.info2": "Please make sure to rejoin any world for the global settings to take effect.",
1414
"spawnanimations.midnightconfig.empty3": "",
1515
"spawnanimations.midnightconfig.empty4": "",
1616

1717
"spawnanimations.midnightconfig.activation_distance": "Activation Distance",
1818
"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.",
1919
"spawnanimations.midnightconfig.activation_mode": "Activation Mode",
20-
"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\nWhen set to Vanilla, it is recommended to set the activation distance to at least 25 blocks to see the animation",
21-
"spawnanimations.midnightconfig.hide_worn_armor_and_tools": "Hide worn armor and tools",
22-
"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.",
23-
"spawnanimations.midnightconfig.play_animation_on_unsupported_blocks": "Play block break animation on unsupported blocks",
24-
"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.",
20+
"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.",
21+
"spawnanimations.midnightconfig.enable_poof_animation": "Enable Poof Animation",
22+
"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.",
23+
"spawnanimations.midnightconfig.play_animation_sounds": "Play Animation Sounds",
24+
"spawnanimations.midnightconfig.play_animation_sounds.tooltip": "Default: §aYes§f\nIf enabled, sounds will be played during the animation.",
25+
"spawnanimations.midnightconfig.hide_worn_armor_and_tools": "Hide Worn Armor and Tools",
26+
"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.",
27+
"spawnanimations.midnightconfig.hide_emissive_mob_layers": "Hide Emissive Mob Layers",
28+
"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 installed and the feature is enabled.",
29+
"spawnanimations.midnightconfig.play_animation_on_unsupported_blocks": "Play Block Break Animation on Unsupported Blocks",
30+
"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.",
2531

2632
"spawnanimations.midnightconfig.enum.bool.WORLD": "§bWorld-Specific",
2733
"spawnanimations.midnightconfig.enum.bool.YES": "§a[✔] Yes",

data/spawnanimations/function/internal/animation/dig_up/sound/sound.mcfunction

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## by Tschipcraft
22

3-
execute if block ~ ~ ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/sound/play_sound
4-
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
3+
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
4+
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
55

66
# Update stage + adjust animation speed
77
scoreboard players add @s ts.sa.e.stage 1
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## by Tschipcraft
22

3-
execute if block ~ ~ ~ #spawnanimations:supported run function spawnanimations:internal/animation/dig_up/sound/play_sound2
4-
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
3+
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
4+
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
55

66
scoreboard players reset @s ts.sa.e.stage
77
scoreboard players reset @s ts.sa.e.speed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
## by Tschipcraft
2+
# The "Poof" animation
23

34
tag @s remove ts.sa.verify
45
tag @s remove ts.sa.to_verify
56
function spawnanimations:internal/entity/unhide
67
function spawnanimations:internal/entity/unprotect
7-
particle minecraft:spit ~ ~1 ~ 0 0.3 0 0.2 15 normal
8-
playsound minecraft:entity.llama.spit hostile @a ~ ~ ~ 0.75 0
8+
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
9+
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
910
function spawnanimations:internal/animation/dig_up/verify

data/spawnanimations/function/internal/entity/ehs/hide.mcfunction

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ tag @s add ts.sa.to_hide
99
effect give @s invisibility 10 0 true
1010

1111
# Pehkui integration (overlay_pre_49)
12-
function spawnanimations:internal/entity/ehs/pehkui/hide
12+
execute if score $hide_emissive ts.sa.settings matches 1..2 run function spawnanimations:internal/entity/ehs/pehkui/hide

data/spawnanimations/function/internal/entity/ehs/hide_exec.mcfunction

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ execute if score $hide_armor ts.sa.settings matches 1..2 as @s[type=#spawnanimat
1010

1111
# Entity specific
1212
execute if entity @s[type=minecraft:creeper] run function spawnanimations:internal/entity/ehs/entity_specific/creeper/hide
13-
execute 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
13+
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
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
##by Tschipcraft
22

3-
tellraw @s ["",{"text":"\n-> Set activation mode to "},{"text":"[classic]","color":"yellow"}]
3+
tellraw @s ["",{"text":"\n-> Set Activation Mode to "},{"text":"[Classic]","color":"yellow"}]
44
scoreboard players set $activation_mode ts.sa.settings 1
55
function #spawnanimations:settings

0 commit comments

Comments
 (0)