This repository has been archived by the owner on Sep 6, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimise carrot-on-a-stick-item durability management
- Loading branch information
Showing
21 changed files
with
83 additions
and
82 deletions.
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
6 changes: 3 additions & 3 deletions
6
...ta/data/ttb/functions/block/eckspei_locker/output_experience/eckspei_rod_check.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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# called by block/eckspei_locker/tick | ||
|
||
execute store result score @s ttb_durab run data get block ~ ~ ~ Items[{Slot:12b}].tag.ttb.durability | ||
execute store result score @s ttb_durab_max run data get block ~ ~ ~ Items[{Slot:12b}].tag.ttb.max_durability | ||
execute store result score #durability ttb_data run data get block ~ ~ ~ Items[{Slot:12b}].tag.ttb.durability | ||
execute store result score #durability_max ttb_data run data get block ~ ~ ~ Items[{Slot:12b}].tag.ttb.max_durability | ||
|
||
execute unless score @s ttb_durab >= @s ttb_durab_max run function ttb:block/eckspei_locker/output_experience/eckspei_rod | ||
execute unless score #durability ttb_data >= #durability_max ttb_data run function ttb:block/eckspei_locker/output_experience/eckspei_rod |
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
17 changes: 17 additions & 0 deletions
17
ttb_data/data/ttb/functions/item/carrot_on_a_stick/durability/replace_hand.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,17 @@ | ||
# called by item/carrot_on_a_stick/durability/update positioned ~ ~-1 ~ | ||
|
||
# set shulker box | ||
setblock ~ ~ ~ yellow_shulker_box{Items:[{Slot:0b,id:"barrier",Count:1b,tag:{CustomModelData:6830001}}]} | ||
|
||
# get if offhand | ||
execute store result score #is_usage_offhand ttb_data run data remove storage ttb:temp item_durability_update.Slot | ||
|
||
# set shulker box item | ||
data modify block ~ ~ ~ Items[0] set from storage ttb:temp item_durability_update | ||
|
||
# loot to respective hand | ||
execute unless score #is_usage_offhand ttb_data matches 1 run loot replace entity @s weapon.mainhand 1 mine ~ ~ ~ air{drop_contents:1b} | ||
execute if score #is_usage_offhand ttb_data matches 1 run loot replace entity @s weapon.offhand 1 mine ~ ~ ~ air{drop_contents:1b} | ||
|
||
# remove shulker box | ||
setblock ~ ~ ~ air |
2 changes: 1 addition & 1 deletion
2
...ata/data/ttb/functions/item/carrot_on_a_stick/durability/set_custom_model_data.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# called by item/carrot_on_a_stick/durability/update | ||
|
||
scoreboard players add @s ttb_model_cmd 6830000 | ||
execute store result block ~ ~-1 ~ Items[0].tag.CustomModelData int 1 run scoreboard players get @s ttb_model_cmd | ||
execute store result storage ttb:temp item_durability_update.tag.CustomModelData int 1 run scoreboard players get @s ttb_model_cmd | ||
scoreboard players reset @s ttb_model_cmd |
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
4 changes: 2 additions & 2 deletions
4
ttb_data/data/ttb/functions/item/eckspei_rod/add_experience.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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# called by item/eckspei_rod/use | ||
|
||
xp add @s 1 points | ||
scoreboard players remove @s ttb_durab 1 | ||
scoreboard players remove #durability ttb_data 1 | ||
scoreboard players remove #eckspei_rod_xp_loop ttb_data 1 | ||
|
||
execute unless score #eckspei_rod_xp_loop ttb_data matches 0 unless score @s ttb_durab matches 0 run function ttb:item/eckspei_rod/add_experience | ||
execute unless score #eckspei_rod_xp_loop ttb_data matches 0 unless score #durability ttb_data matches 0 run function ttb:item/eckspei_rod/add_experience |
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
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
7 changes: 3 additions & 4 deletions
7
ttb_data/data/ttb/functions/item/staff/durability/check.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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
# called by entity/player/used_item/carrot_on_a_stick | entity/player/hurt_entity | ||
|
||
# usage | ||
execute if score @s[tag=ttb_use_crtstck] ttb_durab matches 1.. run function ttb:item/staff/use_right | ||
execute if score @s[tag=ttb_hurt_entity] ttb_durab matches 1.. run function ttb:item/staff/use_left | ||
execute if entity @s[tag=ttb_use_crtstck] if score #durability ttb_data matches 1.. run function ttb:item/staff/use_right | ||
execute if entity @s[tag=ttb_hurt_entity] if score #durability ttb_data matches 1.. run function ttb:item/staff/use_left | ||
|
||
# depletion | ||
execute in overworld positioned 29999984 255 29999984 run function ttb:item/carrot_on_a_stick/durability/update | ||
execute if data storage ttb:temp item_durability_update{tag:{ttb:{durability:0}}} run function ttb:item/staff/break | ||
execute if entity @s[gamemode=!creative,gamemode=!spectator] run function ttb:item/staff/durability/deplete |
5 changes: 5 additions & 0 deletions
5
ttb_data/data/ttb/functions/item/staff/durability/deplete.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,5 @@ | ||
# called by item/staff/durability/check | ||
|
||
scoreboard players remove #durability ttb_data 1 | ||
execute if score #durability ttb_data matches 1.. in overworld positioned 29999984 255 29999984 run function ttb:item/carrot_on_a_stick/durability/update | ||
execute unless score #durability ttb_data matches 1.. run function ttb:item/staff/break |
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
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
Oops, something went wrong.