-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from petersv5/dragon_fireballs
players can trigger dragon fireballs
- Loading branch information
Showing
12 changed files
with
107 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
rev 0.2 | ||
------- | ||
|
||
- Clean up the temporary tags from the dragon and the armor stand | ||
- Add player launched dragon fireballs | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
data/ridedragon/functions/z_admin/can_fire_toggle.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# | ||
# Description: Disable fireing of dragon fireballs | ||
# Called by: ridedragon:admin via chat link | ||
# Entity @s: player | ||
# | ||
execute store success score #rd_success rd_help run data modify storage ridedragon:settings rd_admin.can_fire set value "Disabled" | ||
execute unless score #rd_success rd_help matches 1 run data modify storage ridedragon:settings rd_admin.can_fire set value "Enabled" | ||
# | ||
tellraw @s [{"text":"Player fireing of dragon fireballs has been ","color":"aqua"},{"storage":"ridedragon:settings", "nbt":"rd_admin.can_fire"}] | ||
# | ||
function ridedragon:admin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
data/ridedragon/functions/z_fireball_get_motion.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Extraction looking direction to compute motion for the fireball. Inspired by | ||
# https://www.reddit.com/r/MinecraftCommands/wiki/questions/shootfacing/ | ||
|
||
# this function is executed as the marker entity, positioned at 0 0 0 and still rotated as the player | ||
# (as that wasn't changed with the function call) | ||
|
||
# teleport the entity forward by 0.2 block (based on the player rotation and the position 0 0 0). | ||
# this will form the "power" of the dragon fireball | ||
tp @s ^ ^ ^0.1 | ||
|
||
# store the current position in the worlds NBT storage so we don't loose it | ||
data modify storage ridedragon:tmp Motion set from entity @s Pos | ||
|
||
# teleport the entity forward by another 0.6 block | ||
# this will form the "direction" of the dragon fireball | ||
tp @s ^ ^ ^0.6 | ||
|
||
# store the current position in the worlds NBT storage so we don't loose it | ||
data modify storage ridedragon:tmp Motion2 set from entity @s Pos | ||
|
||
# we don't need this entity anymore | ||
kill @s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Summon a new dragon fireball | ||
#summon minecraft:dragon_fireball ~ ~4 ~ {Tags:["dragon_fireball_selected","dragon_fireball"],direction:[0.5,0.0,0.0],power:[0.1,-0.1,0.0],Owner:[I;1,1,1,1]} | ||
summon minecraft:dragon_fireball ^ ^ ^8 {Tags:["dragon_fireball_selected","dragon_fireball"]} | ||
|
||
# Mark the dragon as the owner so that the dragon's breath can be collected from the | ||
# area_effect_cloud after the dragon fireball lands | ||
data modify entity @e[tag=dragon_fireball_selected,distance=..10,limit=1] Owner set from entity @e[tag=dragonvisible_selected,distance=..10,limit=1] UUID | ||
|
||
# Start the cooldown to 10 seconds = 200 ticks for the dragon | ||
scoreboard players set @e[tag=dragonvisible_selected,limit=1] rd_fire_cooldown 200 | ||
|
||
# Set up motion. Inspired by | ||
# https://www.reddit.com/r/MinecraftCommands/wiki/questions/shootfacing/ | ||
# summon the temporary entity at the players position | ||
summon marker ~ ~ ~ {Tags:["direction_marker"]} | ||
|
||
# execute the below function as the marker entity, so it doesn't get lost from being unloaded | ||
# run positioned at the world zero point. this will remove the marker | ||
execute as @e[tag=direction_marker,distance=..10,limit=1] positioned 0.0 0.0 0.0 run function ridedragon:z_fireball_get_motion | ||
|
||
# store the previously stored Motion into the projectile entity | ||
# Note that dragon fireballs use "direction" for the initial direction and | ||
# "power" for the constant acceleration countering drag. | ||
data modify entity @e[tag=dragon_fireball_selected,limit=1] power set from storage ridedragon:tmp Motion | ||
data modify entity @e[tag=dragon_fireball_selected,limit=1] direction set from storage ridedragon:tmp Motion2 | ||
# clean up the tag | ||
tag @e[tag=dragon_fireball_selected] remove dragon_fireball_selected | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"condition": "minecraft:entity_properties", | ||
"entity": "this", | ||
"predicate": { | ||
"type": "minecraft:player", | ||
"equipment": { | ||
"mainhand": { | ||
"items": [ | ||
"minecraft:end_crystal" | ||
] | ||
} | ||
} | ||
} | ||
} |