Skip to content

Commit ba06e9e

Browse files
Update Datapack
Didn't use github when modifying the pack, so I'm uploading the updated pack now
1 parent 65d2f4d commit ba06e9e

24 files changed

Lines changed: 142 additions & 43 deletions

data/olddragons/function/ai.mcfunction

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,26 @@ execute at @s unless entity @e[tag=DragonChargeRotation,distance=..20,type=marke
99
execute at @s as @e[type=marker,limit=1,sort=nearest,tag=DragonChargeRotation,distance=..20] rotated as @s run tp ~ ~ ~
1010
function olddragons:velocitymarker
1111

12+
execute if score UseEnhancedAI Settings matches 1 run function olddragons:customai/enhancedai
13+
execute if score UseEnhancedAI Settings matches 0 run scoreboard players operation @s EnhancedAIPhase = @s DragonPhase
1214
#Prevent the 1.9 mechanics from occurring, unless it is enabled
1315
execute if score Allow1.9Behavior Settings matches 0 unless entity @s[nbt=!{DragonPhase:1},nbt=!{DragonPhase:2},nbt=!{DragonPhase:10},nbt=!{DragonPhase:3},nbt=!{DragonPhase:5},nbt=!{DragonPhase:6},nbt=!{DragonPhase:7}] unless entity @s[nbt=!{HurtTime:0s}] run data merge entity @s {DragonPhase:0}
1416

1517
#Prevent perching, if disabled
16-
execute if score DisablePerch Settings matches 1 unless entity @s[nbt=!{DragonPhase:3},nbt=!{DragonPhase:5},nbt=!{DragonPhase:6},nbt=!{DragonPhase:7}] unless entity @s[nbt=!{HurtTime:0s}] run data merge entity @s {DragonPhase:0}
18+
execute if score DisablePerching Settings matches 1 unless entity @s[nbt=!{DragonPhase:3},nbt=!{DragonPhase:5},nbt=!{DragonPhase:6},nbt=!{DragonPhase:7}] unless entity @s[nbt=!{HurtTime:0s}] run data merge entity @s {DragonPhase:0}
1719

1820
#Store motion in scores for reference when starting a charge
1921
execute if score @s DragonChargeTimer matches ..0 store result score @s XVel run data get entity @s Motion[0] 1000
2022
execute if score @s DragonChargeTimer matches ..0 store result score @s YVel run data get entity @s Motion[1] 1000
2123
execute if score @s DragonChargeTimer matches ..0 store result score @s ZVel run data get entity @s Motion[2] 1000
2224
execute if score @s DragonChargeTimer matches ..0 run scoreboard players set @s RVel 0
25+
execute if score @s DragonChargeTimer matches ..0 store result score @s Rotation run data get entity @s Rotation[0] 100
2326

2427
#Randomly charge at the player, if it is enabled
25-
execute at @s if score DragonCharging Settings matches 1 if entity @s[nbt=!{DragonPhase:4},nbt=!{DragonPhase:5},nbt=!{DragonPhase:6},nbt=!{DragonPhase:7},nbt=!{DragonPhase:3}] if score @s RNG <= ChargeRate Settings unless entity @s[nbt=!{HurtTime:0s}] unless score @s DragonChargeTimer matches 1.. store result score @s ChargeTargetX run data get entity @e[limit=1,sort=nearest,type=player,gamemode=!creative,gamemode=!spectator] Pos[0] 100
26-
execute at @s if score DragonCharging Settings matches 1 if entity @s[nbt=!{DragonPhase:4},nbt=!{DragonPhase:5},nbt=!{DragonPhase:6},nbt=!{DragonPhase:7},nbt=!{DragonPhase:3}] if score @s RNG <= ChargeRate Settings unless entity @s[nbt=!{HurtTime:0s}] unless score @s DragonChargeTimer matches 1.. store result score @s ChargeTargetY run data get entity @e[limit=1,sort=nearest,type=player,gamemode=!creative,gamemode=!spectator] Pos[1] 100
27-
execute at @s if score DragonCharging Settings matches 1 if entity @s[nbt=!{DragonPhase:4},nbt=!{DragonPhase:5},nbt=!{DragonPhase:6},nbt=!{DragonPhase:7},nbt=!{DragonPhase:3}] if score @s RNG <= ChargeRate Settings unless entity @s[nbt=!{HurtTime:0s}] unless score @s DragonChargeTimer matches 1.. store result score @s ChargeTargetZ run data get entity @e[limit=1,sort=nearest,type=player,gamemode=!creative,gamemode=!spectator] Pos[2] 100
28-
execute at @s if entity @e[limit=1,sort=nearest,type=player,gamemode=!creative,gamemode=!spectator,distance=..125] if score DragonCharging Settings matches 1 if entity @s[nbt=!{DragonPhase:4},nbt=!{DragonPhase:5},nbt=!{DragonPhase:6},nbt=!{DragonPhase:7},nbt=!{DragonPhase:3}] if score @s RNG <= ChargeRate Settings unless entity @s[nbt=!{HurtTime:0s}] unless score @s DragonChargeTimer matches 1.. run scoreboard players set @s DragonChargeTimer 8
28+
execute at @s if score DragonCharging Settings matches 1 if entity @s[nbt=!{DragonPhase:4},nbt=!{DragonPhase:5},nbt=!{DragonPhase:6},nbt=!{DragonPhase:7},nbt=!{DragonPhase:3}] if score @s RNG <= ChargeRate Settings unless entity @s[nbt=!{HurtTime:0s}] unless score @s DragonChargeTimer matches 4.. store result score @s ChargeTargetX run data get entity @e[limit=1,sort=nearest,type=player,gamemode=!creative,gamemode=!spectator] Pos[0] 100
29+
execute at @s if score DragonCharging Settings matches 1 if entity @s[nbt=!{DragonPhase:4},nbt=!{DragonPhase:5},nbt=!{DragonPhase:6},nbt=!{DragonPhase:7},nbt=!{DragonPhase:3}] if score @s RNG <= ChargeRate Settings unless entity @s[nbt=!{HurtTime:0s}] unless score @s DragonChargeTimer matches 4.. store result score @s ChargeTargetY run data get entity @e[limit=1,sort=nearest,type=player,gamemode=!creative,gamemode=!spectator] Pos[1] 100
30+
execute at @s if score DragonCharging Settings matches 1 if entity @s[nbt=!{DragonPhase:4},nbt=!{DragonPhase:5},nbt=!{DragonPhase:6},nbt=!{DragonPhase:7},nbt=!{DragonPhase:3}] if score @s RNG <= ChargeRate Settings unless entity @s[nbt=!{HurtTime:0s}] unless score @s DragonChargeTimer matches 4.. store result score @s ChargeTargetZ run data get entity @e[limit=1,sort=nearest,type=player,gamemode=!creative,gamemode=!spectator] Pos[2] 100
31+
execute at @s if entity @e[limit=1,sort=nearest,type=player,gamemode=!creative,gamemode=!spectator,distance=..125] if score DragonCharging Settings matches 1 if entity @s[nbt=!{DragonPhase:4},nbt=!{DragonPhase:5},nbt=!{DragonPhase:6},nbt=!{DragonPhase:7},nbt=!{DragonPhase:3}] if score @s RNG <= ChargeRate Settings unless entity @s[nbt=!{HurtTime:0s}] unless score @s DragonChargeTimer matches 4.. run scoreboard players set @s DragonChargeTimer 8
2932

3033
execute at @s if score MimicVanillaCharge Settings matches 0 store result score @s ChargeTargetX run data get entity @e[limit=1,sort=nearest,type=player,gamemode=!creative,gamemode=!spectator] Pos[0] 100
3134
execute at @s if score MimicVanillaCharge Settings matches 0 store result score @s ChargeTargetY run data get entity @e[limit=1,sort=nearest,type=player,gamemode=!creative,gamemode=!spectator] Pos[1] 100
@@ -49,13 +52,14 @@ execute if score ReplaceVanillaCharging Settings matches 1 if entity @s[nbt={Dra
4952
execute unless score @s DragonChargeTimer matches 1.. run tp @e[type=marker,limit=1,sort=nearest,tag=DragonChargeRotation,distance=..20] ^ ^ ^ ~180 ~
5053
execute unless score @s DragonChargeTimer matches 1.. store result score @s Rotation run data get entity @s Rotation[0] 100
5154
#Stop dragon charging if it is currently in phase 9 (flying to the portal to die)
52-
execute if entity @s[nbt={DragonPhase:9}] run scoreboard players set @s DragonChargeTimer -999
55+
execute unless score UseEnhancedAI Settings matches 1 if entity @s[nbt={DragonPhase:9}] run scoreboard players set @s DragonChargeTimer -999
5356

5457
#Stop dragon charging if it is currently in phase 3 (flying to the portal to perch)
55-
execute if entity @s[nbt={DragonPhase:3}] run scoreboard players set @s DragonChargeTimer 0
58+
execute unless score UseEnhancedAI Settings matches 1 if entity @s[nbt={DragonPhase:3}] run scoreboard players set @s DragonChargeTimer 0
5659

5760
#Stop the dragon charging if it takes damage
58-
execute if entity @s[nbt=!{HurtTime:0s}] run scoreboard players set @s DragonChargeTimer 0
61+
execute if score StopChargeOnHurt Settings matches 1 if entity @s[nbt={HurtTime:9s}] run scoreboard players set @s DragonChargeTimer 0
62+
5963
data merge storage charge {Pos:[0d,0d,0d]}
6064
execute store result storage charge Pos[0] double 0.01 run scoreboard players get @s ChargeTargetX
6165
execute store result storage charge Pos[1] double 0.01 run scoreboard players get @s ChargeTargetY
@@ -75,7 +79,7 @@ execute if data entity @s {DragonPhase:9} at @s run tag @e[type=marker,limit=1,t
7579

7680
#Stop charging if too far away from target position or is done charging
7781
execute at @s if entity @e[limit=1,sort=nearest,distance=..5,tag=DragonChargeTarget] run scoreboard players remove @s DragonChargeTimer 1
78-
execute at @s unless entity @e[limit=1,sort=nearest,distance=..125,tag=DragonChargeTarget] run scoreboard players set @s DragonChargeTimer 0
82+
execute unless score UseEnhancedAI Settings matches 1 at @s unless entity @e[limit=1,sort=nearest,distance=..125,tag=DragonChargeTarget] run scoreboard players set @s DragonChargeTimer 0
7983

8084
#Charge
8185
execute unless data entity @s {DragonPhase:5} unless data entity @s {DragonPhase:6} unless data entity @s {DragonPhase:7} at @s if score @s DragonChargeTimer matches 1.. run function olddragons:charging/calcfly with storage olddragons
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
tellraw @s "§5Old Dragon Mechanics BETA Configuration"
2+
tellraw @s [{"text":"§7Presets:\n"},{"text":"[1.0-1.8] ","clickEvent":{"action":"run_command","value":"/function olddragons:settings/1.8"},"hoverEvent":{"action":"show_text","contents":{"text":"Dragon randomly charges at the nearest player, won't perch or shoot fireballs."}}},{"text":"[1.9-1.13] ","clickEvent":{"action":"run_command","value":"/function olddragons:settings/1.9"},"hoverEvent":{"action":"show_text","contents":{"text":"Normal Ender Dragon, but can move up and down better. This is the default preset, and is enabled when the datapack loads."}}},{"text":"[1.14+] ","clickEvent":{"action":"run_command","value":"/function olddragons:settings/1.14"},"hoverEvent":{"action":"show_text","contents":{"text":"Vanilla Ender Dragon, disables most datapack features."}}},{"text":"[Mixed] ","clickEvent":{"action":"run_command","value":"/function olddragons:settings/mixed"},"hoverEvent":{"action":"show_text","contents":{"text":"Dragon randomly charges at the nearest player, AND can perch or shoot fireballs. Also perches more often."}}},{"text":"[Bedrock] ","clickEvent":{"action":"run_command","value":"/function olddragons:settings/bedrock"},"hoverEvent":{"action":"show_text","contents":{"text":"Dragon moves up and down even faster than the 1.9-1.13 preset, and perches more often. Designed to act like Bedrock's Ender Dragon."}}},{"text":"[Passive] ","clickEvent":{"action":"run_command","value":"/function olddragons:settings/passive"},"hoverEvent":{"action":"show_text","contents":{"text":"Dragon will NEVER perch or shoot fireballs, and will not charge at the player. Makes the dragon mostly passive. Flies like the 1.9-1.13 preset."}}}]
3+
#tellraw @s "§7Individual Settings:"
4+
function olddragons:configmenu/booleaninput {returnto:"olddragons:betaconfig",name:"Use Custom AI",id:"UseEnhancedAI",hovertext:"Use a different Ender Dragon AI that this datapack adds instead of the vanilla AI.",extrajson:""}
5+
6+
tellraw @s [{"text":"[Normal Config]","hoverEvent":{"action":"show_text","contents":"Return to the normal config."},"clickEvent":{"action":"run_command","value":"/function olddragons:config"}}]
7+
8+
tellraw @s [{"text":"[Reload Config Screen]","hoverEvent":{"action":"show_text","contents":"Re-opens the config. Use this in certain cases where the config doesn't update itself."},"clickEvent":{"action":"run_command","value":"/function olddragons:config"}},{"text":" "},{"text":"§4[Reload ALL Datapacks]§r","hoverEvent":{"action":"show_text","contents":"Reloads ALL datapacks, including this one. Doesn't do anything on bukkit/spigot/purpur/paper/etc. servers, as this runs /reload, triggering bukkit's plugins reload warning instead, you'll need to use /minecraft:reload instead."},"clickEvent":{"action":"run_command","value":"/reload"}}]

data/olddragons/function/charging/charge.mcfunction

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ execute if score EnableDebug Settings matches 1 as @e[tag=SmoothTurn,type=marker
1414
execute at @s as @e[tag=DragonChargeTarget,limit=1,sort=nearest] at @s run tag @e[tag=SmoothTurn,type=marker,limit=1,sort=nearest] add Closest
1515
#execute at @s as @e[tag=DragonChargeRotation,type=marker] facing entity @e[tag=SmoothTurn,type=marker,limit=1,sort=nearest,tag=Closest] eyes rotated ~180 ~ run tp @s ^ ^ ^ ~ ~
1616
execute at @s as @e[tag=DragonChargeRotation,type=marker,limit=1,sort=nearest] facing entity @e[tag=DragonChargeTarget] eyes rotated ~180 ~ run tp @s ^ ^ ^ ~ ~
17-
execute if entity @e[type=marker,tag=SmoothTurn,tag=Closest,tag=Right,tag=Far] at @s run scoreboard players add @s RVel 150
18-
execute if entity @e[type=marker,tag=SmoothTurn,tag=Closest,tag=Right] at @s run scoreboard players add @s RVel 50
19-
execute if entity @e[type=marker,tag=SmoothTurn,tag=Closest,tag=Left] at @s run scoreboard players remove @s RVel 50
20-
execute if entity @e[type=marker,tag=SmoothTurn,tag=Closest,tag=Left,tag=Far] at @s run scoreboard players remove @s RVel 150
17+
execute if entity @e[type=marker,tag=SmoothTurn,tag=Closest,tag=Right,tag=Far] at @s run scoreboard players add @s RVel 75
18+
execute if entity @e[type=marker,tag=SmoothTurn,tag=Closest,tag=Right] at @s run scoreboard players add @s RVel 45
19+
execute if entity @e[type=marker,tag=SmoothTurn,tag=Closest,tag=Left] at @s run scoreboard players remove @s RVel 45
20+
execute if entity @e[type=marker,tag=SmoothTurn,tag=Closest,tag=Left,tag=Far] at @s run scoreboard players remove @s RVel 75
2121
scoreboard players operation @s RVel *= B Temp
2222
scoreboard players operation @s RVel /= F Temp
2323
execute if entity @e[type=marker,tag=SmoothTurn,tag=Closest,tag=NoTurn] at @s run scoreboard players operation @s RVel *= B Temp

0 commit comments

Comments
 (0)