Skip to content

Commit

Permalink
Merge pull request #3 from petersv5/dragon_health
Browse files Browse the repository at this point in the history
make dragon health configurable
  • Loading branch information
petersv5 authored Sep 22, 2023
2 parents 2751846 + ded6a9f commit b89097d
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 7 deletions.
1 change: 1 addition & 0 deletions Changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ rev 0.2

- Clean up the temporary tags from the dragon and the armor stand
- Add player launched dragon fireballs
- Initial health of the dragon can be configured via the admin menu (/function ridedragon:admin)


21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,34 @@ This datapack enables players to summon and ride Ender Dragons.
The data pack is server side only and not needed on clients. It also works for single player worlds.
It is safe to use by multiple players at the same time.

Players can use "/trigger rd_help" for more information.

Dragons are summoned using the Book of Dragons. As an alterantive the player can uise the command
"/trigger rd_summon". The summoned dragon will be passive and float down to the ground. The dragon
is then mounted by right clicking its neck close to the body with an empty hand.

Players can use "/trigger rd_help" for mor information.

OPs can configure if the Book Of dragons is required to summon a dragon as well as how the book
can be obtained via the admin interface which is opened with the command "/function ridedragon:admin".
If enabled, players can fire dragon fireballs while mounted by holding an end crystal. Fireballs
are limited to one per 10 seconds per dragon and can only be fired in a downwards direction.

OPs can also control if the players are able to trigger dragon fireballs while mounted by holding
an end crystal. Fireballs are limited to one per 10 seconds per dragon and can only be fired in a
downwards direction.
The datapack can be configured by an OP via the "/function ridedragon:admin" command. This opens
the admin interface.
- if the Book Of dragons is required to summon a dragon
- how the book can be obtained via the admin
- if the players are able to trigger dragon fireballs
- initial health of summoned dragons.

----- important -----
It is recommended to use the "Anti Ender Dragon Grief" data pack
(https://www.planetminecraft.com/member/dragon3025/) by Dragon3025 to prevent the dragons from
erasing parts of the world as they are flown around.
---------------------

This datapack was inspired by the video https://www.youtube.com/watch?v=vBUknTYjylc&t=284s by John
Paul Inso. That design was not safe for multiple simultaneous players which inspired me to make my
own version.

The admin interface was inspired by the Armor Statues datapack.

For further support or questions please use the Discord at: https://discord.gg/6eJxzG5jkA or
visit the github repository: https://github.com/petersv5/RideDragon

1 change: 1 addition & 0 deletions data/ridedragon/functions/admin.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ tellraw @s [{"text":"Get book from help: ","color":"aqua"},{"storage":"ridedrago
tellraw @s [{"text":"Survival players can summon dragons: ","color":"aqua"},{"storage":"ridedragon:settings", "nbt":"rd_admin.can_summon", "color":"green", "clickEvent":{"action":"run_command", "value":"/function ridedragon:z_admin/can_summon_toggle"}, "hoverEvent":{"action":"show_text", "contents":{"text":"Click to toggle", "color":"yellow"}}}]
tellraw @s [{"text":"Summon without the ","color":"aqua"},{"text":"Book of Dragons","color":"light_purple"},{"text":": ","color":"aqua"},{"storage":"ridedragon:settings", "nbt":"rd_admin.summon_without_book", "color":"green", "clickEvent":{"action":"run_command", "value":"/function ridedragon:z_admin/summon_without_book_toggle"}, "hoverEvent":{"action":"show_text", "contents":{"text":"Click to toggle", "color":"yellow"}}}]
tellraw @s [{"text":"Players can fire dragon fireballs: ","color":"aqua"},{"storage":"ridedragon:settings", "nbt":"rd_admin.can_fire", "color":"green", "clickEvent":{"action":"run_command", "value":"/function ridedragon:z_admin/can_fire_toggle"}, "hoverEvent":{"action":"show_text", "contents":{"text":"Click to toggle", "color":"yellow"}}}]
tellraw @s [{"text":"Initial dragon health : ","color":"aqua"},{"storage":"ridedragon:settings", "nbt":"rd_admin.dragon_health"},{"text":" (","color":"aqua"},{"text":" + ", "color":"green","clickEvent":{"action":"run_command", "value":"/function ridedragon:z_admin/dragon_health_increase"},"hoverEvent":{"action":"show_text", "contents":{"text":"Click to increase", "color":"yellow"}}},{"text":"/","color":"aqua"},{"text":" - ", "color":"green","clickEvent":{"action":"run_command", "value":"/function ridedragon:z_admin/dragon_health_decrease"},"hoverEvent":{"action":"show_text", "contents":{"text":"Click to decrease", "color":"yellow"}}},{"text":")","color":"aqua"}]
tellraw @s [{"text":"Vanish all tame tragons", "color":"red", "clickEvent":{"action":"run_command", "value":"/function ridedragon:z_admin/vanish_all"}, "hoverEvent":{"action":"show_text", "contents":{"text":"Click to vanish all loaded tame dragons", "color":"red"}}}]
tellraw @s [{"text":"--------------------------","color":"yellow","bold":"true"}]
1 change: 1 addition & 0 deletions data/ridedragon/functions/summon_dragon.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ tag @e[type=minecraft:marker,tag=dragon_temp,distance=..2,limit=1] remove dragon

# Set HurtTime to -1 to keep the knockback effect of the dragon disabled.
summon minecraft:ender_dragon ~ ~0.15 ~ {Tags:["dragonvisible","dragon_temp"],Health:5,HurtTime:-1}
data modify entity @e[tag=dragon_temp,limit=1] Health set from storage ridedragon:settings rd_admin.dragon_health
scoreboard players operation @e[type=minecraft:ender_dragon,tag=dragon_temp,distance=..2,limit=1] rd_id = #rd_global_cnt rd_id
scoreboard players set @e[tag=dragon_temp,limit=1] rd_fire_cooldown 0
tag @e[type=minecraft:ender_dragon,tag=dragon_temp,distance=..2,limit=1] remove dragon_temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Description: Disable fireing of dragon fireballs
# Called by: ridedragon:admin via chat link
# Entity @s: player
#

execute store result score #rd_math rd_help run data get storage ridedragon:settings rd_admin.dragon_health
execute if score #rd_math rd_help matches 11.. store result storage ridedragon:settings rd_admin.dragon_health int 1.0 run scoreboard players remove #rd_math rd_help 10

function ridedragon:admin

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Description: Disable fireing of dragon fireballs
# Called by: ridedragon:admin via chat link
# Entity @s: player
#

execute store result score #rd_math rd_help run data get storage ridedragon:settings rd_admin.dragon_health
execute if score #rd_math rd_help matches ..600 store result storage ridedragon:settings rd_admin.dragon_health int 1.0 run scoreboard players add #rd_math rd_help 10

function ridedragon:admin

1 change: 1 addition & 0 deletions data/ridedragon/functions/z_init.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ execute unless data storage ridedragon:settings rd_admin.book_help run data modi
execute unless data storage ridedragon:settings rd_admin.can_summon run data modify storage ridedragon:settings rd_admin.can_summon set value "Disabled"
execute unless data storage ridedragon:settings rd_admin.summon_without_book run data modify storage ridedragon:settings rd_admin.summon_without_book set value "Disabled"
execute unless data storage ridedragon:settings rd_admin.can_fire run data modify storage ridedragon:settings rd_admin.can_fire set value "Disabled"
execute unless data storage ridedragon:settings rd_admin.dragon_health run data modify storage ridedragon:settings rd_admin.dragon_health set value 5

# Schedule function to remove orphaned dragon components every 1 seconds (use a prime number of ticks)
schedule function ridedragon:z_dragon_cleanup 23t

0 comments on commit b89097d

Please sign in to comment.