add stationary ghast datapack

This commit is contained in:
2025-12-24 23:28:09 +00:00
parent 1d3e80bea7
commit 43f615850c
10 changed files with 82 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
{
"values": [
"stationary_happy_ghast:load"
]
}

View File

@@ -0,0 +1,5 @@
{
"values": [
"stationary_happy_ghast:tick"
]
}

View File

@@ -0,0 +1,32 @@
{
"display": {
"icon": {
"id": "minecraft:dried_ghast"
},
"title": "Stationary Happy Ghasts",
"description": [
"",
{
"text": "Makes happy ghasts not wander when dismounted. Also disables their ability to follow snowballs.\n",
"color": "gold"
},
{
"text": "/trigger stationary_happy_ghast while near a happy ghast to toggle this behavior.\n",
"color": "yellow"
}
],
"show_toast": false,
"announce_to_chat": false
},
"parent": "minecraft:root",
"criteria": {
"tick": {
"trigger": "minecraft:tick"
}
},
"requirements": [
[
"tick"
]
]
}

View File

@@ -0,0 +1,2 @@
scoreboard objectives add ghastflymode trigger
scoreboard objectives add ghast_parking_state dummy

View File

@@ -0,0 +1 @@
scoreboard players set @s ghast_parking_state 1

View File

@@ -0,0 +1,3 @@
execute as @s[nbt={still_timeout:10}] as @s[nbt={NoAI:1b}] run data modify entity @s NoAI set value 0b
execute unless entity @s[nbt={still_timeout:10}] unless entity @s[nbt={NoAI:1b}] run data modify entity @s NoAI set value 1b

View File

@@ -0,0 +1,5 @@
execute as @a[scores={ghastflymode=1..}] at @s run function stationary_happy_ghast:trigger
scoreboard players enable @a ghastflymode
#parked
execute as @e[type=happy_ghast,scores={ghast_parking_state=1}] at @s run function stationary_happy_ghast:parkedghast

View File

@@ -0,0 +1,17 @@
execute as @e[type=happy_ghast,distance=..10,sort=nearest,limit=1] if score @s ghast_parking_state matches 1 run tag @s add _was1
execute as @e[type=happy_ghast,distance=..10,sort=nearest,limit=1] unless score @s ghast_parking_state matches 1 run tag @s add _was0
execute as @e[type=happy_ghast,tag=_was1,limit=1,sort=nearest] run function stationary_happy_ghast:unpark
execute as @e[type=happy_ghast,tag=_was0,limit=1,sort=nearest] run function stationary_happy_ghast:park
execute if entity @e[type=happy_ghast,distance=..10,sort=nearest,limit=1,tag=_was1] run tellraw @a[scores={ghastflymode=1..}] {"text":"Your ghast is now wandering. It will move freely when you dismount.","color":"yellow"}
execute if entity @e[type=happy_ghast,distance=..10,sort=nearest,limit=1,tag=_was0] run tellraw @a[scores={ghastflymode=1..}] {"text":"Your ghast is now stationary. It will no longer wander when you dismount.","color":"yellow"}
tag @e[type=happy_ghast,tag=_was1] remove _was1
tag @e[type=happy_ghast,tag=_was0] remove _was0
execute unless entity @e[type=happy_ghast,distance=..10] run tellraw @s {"text":"You need to be close with your ghast to use this command.","color":"red"}
scoreboard players reset @s ghastflymode

View File

@@ -0,0 +1,3 @@
scoreboard players reset @s ghast_parking_state
data modify entity @s NoAI set value 0b

View File

@@ -0,0 +1,9 @@
{
"pack": {
"pack_format": 48,
"supported_formats": {"min_inclusive": 48, "max_inclusive": 88},
"min_format": 48,
"max_format": 88,
"description": [{"text":"Prevents your happy ghast from flying away from you!","color":"gold"}]
}
}