-
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.
- Loading branch information
Showing
9 changed files
with
61 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Create a new objective to detect player rejoin the game. | ||
scoreboard objectives add gmbmiwir.leave minecraft.custom:minecraft.leave_game | ||
|
||
# Create a new objective to record the player's remaining invincibility time. | ||
scoreboard objectives add gmbmiwir.timer dummy | ||
|
||
# Create new objectives to keep track of how long the player has had the effect. | ||
scoreboard objectives add gmbmiwir.potion.level dummy | ||
scoreboard objectives add gmbmiwir.potion.time dummy | ||
# scoreboard objectives add gmbmiwir.potion.hideParticles dummy | ||
scoreboard players set $-1 gmbmiwir.potion.time -1 | ||
scoreboard players set $20 gmbmiwir.potion.time 20 | ||
scoreboard players set $0 gmbmiwir.potion.level 0 |
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,3 @@ | ||
scoreboard players set @s gmbmiwir.timer 60 | ||
effect clear @s resistance | ||
effect give @s resistance 3 255 true |
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,9 @@ | ||
effect clear @s resistance | ||
scoreboard players operation @s gmbmiwir.potion.time /= $20 gmbmiwir.potion.time | ||
data remove storage gmbmiwir:resistance_store duration | ||
data remove storage gmbmiwir:resistance_store level | ||
execute store result storage gmbmiwir:resistance_store duration int 1 run scoreboard players get @s gmbmiwir.potion.time | ||
execute store result storage gmbmiwir:resistance_store level int 1 if score @s gmbmiwir.potion.level matches 0..127 run scoreboard players get @s gmbmiwir.potion.level | ||
# 懒得修 | ||
# execute store result storage gmbmiwir:resistance_store hideParticles int 1 run scoreboard players get @s gmbmiwir.potion.hideParticles | ||
execute as @s run function gmbmiwir:resistance_regive_true with storage gmbmiwir:resistance_store |
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,3 @@ | ||
$effect give @s resistance $(duration) $(level) | ||
# 懒得修 | ||
# $(hideParticles) |
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,4 @@ | ||
execute store result score @s gmbmiwir.potion.time run data get entity @s active_effects[{id:"minecraft:resistance"}].duration | ||
execute store result score @s gmbmiwir.potion.level run data get entity @s active_effects[{id:"minecraft:resistance"}].amplifier | ||
# execute store result score @s gmbmiwir.potion.hideParticles run data get entity @s active_effects[{id:"minecraft:resistance"}].show_particles | ||
# scoreboard players set @s[scores={gmbmiwir.potion.hideParticles=0}] gmbmiwir.potion.hideParticles 1 |
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,10 @@ | ||
# Prevents the value from being null | ||
scoreboard players add @a gmbmiwir.leave 0 | ||
scoreboard players add @a gmbmiwir.timer 0 | ||
# If rejoin | ||
execute as @a[scores={gmbmiwir.leave=0,gmbmiwir.timer=-2}] run function gmbmiwir:resistance_store | ||
execute as @a[scores={gmbmiwir.leave=1}] run function gmbmiwir:resistance_give | ||
# Regive resistance | ||
scoreboard players remove @a[scores={gmbmiwir.timer=-1..}] gmbmiwir.timer 1 | ||
execute as @a[scores={gmbmiwir.timer=-1,gmbmiwir.potion.level=0..127,gmbmiwir.potion.time=1..}] run function gmbmiwir:resistance_regive | ||
scoreboard players set @a gmbmiwir.leave 0 |
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,4 @@ | ||
{ | ||
"values": ["gmbmiwir:load"], | ||
"replace": false | ||
} |
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,4 @@ | ||
{ | ||
"values": ["gmbmiwir:tick"], | ||
"replace": false | ||
} |
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,11 @@ | ||
{ | ||
"pack": { | ||
"pack_format": 59, | ||
"supported_formats": { | ||
"min_inclusive": 59, | ||
"max_inclusive": 100 | ||
}, | ||
"description": "Give me back my InvulnerableTime when I rejoin" | ||
} | ||
} | ||
|