Skip to content

Commit

Permalink
Merge pull request #1 from Jiogo18/1.16.5
Browse files Browse the repository at this point in the history
Updated for 1.16.5
  • Loading branch information
Jiogo18 authored Feb 13, 2022
2 parents b3dee09 + ca2aceb commit bc7abcc
Show file tree
Hide file tree
Showing 50 changed files with 274 additions and 161 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
scoreboard objectives add health health
scoreboard objectives setdisplay list health
scoreboard objectives setdisplay list health
tellraw @a "Health are now displayed in the tab list"
12 changes: 5 additions & 7 deletions Death Swap Multi/data/death_swap_multi/functions/load.mcfunction
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
#est executé au chargement du monde (donc pas de reset)

scoreboard objectives add death_swap_t trigger
scoreboard objectives add death_swap_m dummy
scoreboard objectives add death_swap_join trigger
scoreboard objectives add death_swap_main dummy
scoreboard objectives add death_swap_id dummy
scoreboard objectives add random_timeout dummy
scoreboard objectives add death_swap_death deathCount

scoreboard objectives add const dummy
scoreboard players set second const 20
scoreboard players set 1 const 1
scoreboard players set 20 death_swap_main 20

execute unless score setuped death_swap_m matches 1 run function death_swap_multi:setup
execute unless score setuped death_swap_main matches 1 run function death_swap_multi:setup


tellraw @a {"text":" [ Death Swap Multi - By Jiogo18 ] ","bold":true,"color":"yellow","clickEvent":{"action":"run_command","value":"/function death_swap_multi:reset"},"hoverEvent":{"action":"show_text","value":{"translate":"Click to reset the datapack"}}}

function death_swap_multi:tellraw/start_game
function death_swap_multi:tellraw/game/start_info
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tag @s add death_swap_mega

function death_swap_multi:party/join

scoreboard players add mega_added death_swap_main 1
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
#toute entitée dans la partie mais trop loins (256 blocks = 16 chunks)
execute as @e[type=!player,tag=death_swap_mega] at @s unless entity @p[distance=..256] run function death_swap_multi:party/leave


#toute entitée non joueur proche d'un joueur (128 blocks = 8 chunks) qui est pas dans la partie
execute as @a at @s run tag @e[type=!player,tag=!death_swap_m,distance=..128] add death_swap_mega_n
tag @e[tag=death_swap_mega_n] add death_swap_mega

execute as @e[tag=death_swap_mega_n,type=!#death_swap_multi:mega_blacklist] run function death_swap_multi:party/join
execute as @a at @s as @e[type=#death_swap_multi:mega_whitelist,tag=!death_swap_m,distance=..128] run function death_swap_multi:mega/add_me

execute as @e[tag=death_swap_mega_n,tag=death_swap_m] run scoreboard players add mega_added death_swap_m 1
#après 50 ajouts (pour pas spam) ou plus car plusieurs ajoutés par tick
execute if score mega_added death_swap_m matches 50.. run function death_swap_multi:tellraw/mega_joined

tag @e[tag=death_swap_mega_n] remove death_swap_mega_n
execute if score mega_added death_swap_main matches 50.. run function death_swap_multi:tellraw/mega_joined
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
scoreboard players set mega death_swap_m 1
scoreboard players set enabled death_swap_main 1
scoreboard players enable @a death_swap_join
scoreboard players reset * death_swap_death

scoreboard players set mega death_swap_main 1

tellraw @a [{"translate":"[Death Swap]: "},{"translate":"Mega Death Swap has started! (with all entities in the world)"}]
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
scoreboard players reset mega death_swap_m
scoreboard players reset mega_added death_swap_m
scoreboard players reset mega death_swap_main
scoreboard players reset mega_added death_swap_main

#les entitées peuvent rester dans un chunk non chargé donc mieux vaut les retirer :
execute as @e[type=!player,tag=death_swap_mega] run function death_swap_multi:party/leave
tag @e[tag=death_swap_mega_n] remove death_swap_mega_n
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
scoreboard players set players death_swap_m 0
execute as @a[tag=death_swap_m] run scoreboard players add players death_swap_m 1
scoreboard players set players death_swap_main 0
execute as @a[tag=death_swap_m] run scoreboard players add players death_swap_main 1

scoreboard players set players_extra death_swap_m 0
execute as @e[tag=death_swap_m,type=!player] run scoreboard players add players_extra death_swap_m 1
scoreboard players set mobs death_swap_main 0
execute as @e[tag=death_swap_m,type=!player] run scoreboard players add mobs death_swap_main 1

scoreboard players operation players_total death_swap_m = players death_swap_m
scoreboard players operation players_total death_swap_m += players_extra death_swap_m
scoreboard players operation entities death_swap_main = players death_swap_main
scoreboard players operation entities death_swap_main += mobs death_swap_main
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ scoreboard players reset @s death_swap_death

#pour pas de tellraw leave:
tag @s remove death_swap_m
scoreboard players reset @s death_swap_t
scoreboard players reset @s death_swap_join
function death_swap_multi:party/leave

function death_swap_multi:tellraw/game_over
tellraw @a [{"translate":"[Death Swap]: "},{"selector":"@s"},{"translate":" lost"}]
tellraw @s [{"translate":"[Death Swap]: "},{"translate":"Try again","color":"yellow","clickEvent":{"action":"run_command","value":"/trigger death_swap_join set 1"},"hoverEvent":{"action":"show_text","value":{"translate":"Click to join the game"}},"italic":true}]
function death_swap_multi:tellraw/remaining_players
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#pas encore dans la partie && pas en tant que mega
execute if entity @s[tag=!death_swap_m,tag=!death_swap_mega] run function death_swap_multi:tellraw/joined

scoreboard players set @s[type=player] death_swap_t 1
scoreboard players enable @s[type=player] death_swap_t
execute if entity @s[type=player] run function death_swap_multi:party/join/if_player

execute unless entity @s[scores={death_swap_id=1..}] run scoreboard players add id death_swap_m 1
execute unless entity @s[scores={death_swap_id=1..}] run scoreboard players operation @s death_swap_id = id death_swap_m

scoreboard players set @s[type=player] death_swap_death 0
execute unless entity @s[scores={death_swap_id=1..}] run function death_swap_multi:party/join/add_id

tag @s add death_swap_m
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scoreboard players operation @s death_swap_id = next_id death_swap_main
scoreboard players add next_id death_swap_main 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
scoreboard players set @s[type=player] death_swap_join 1
scoreboard players enable @s[type=player] death_swap_join

scoreboard players set @s[type=player] death_swap_death 0
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#déjà dans la partie && pas en tant que mega
execute if entity @s[tag=death_swap_m,tag=!death_swap_mega] run function death_swap_multi:tellraw/left

scoreboard players reset @s death_swap_t
scoreboard players enable @s death_swap_t
scoreboard players reset @s death_swap_join
scoreboard players enable @s death_swap_join

scoreboard players reset @s death_swap_id

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
scoreboard players set enabled death_swap_m 0
scoreboard players set enabled death_swap_main 0

function death_swap_multi:tellraw/paused
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
scoreboard players remove * death_swap_death
scoreboard players set enabled death_swap_m 1

scoreboard players enable @a death_swap_t
scoreboard players set enabled death_swap_main 1
scoreboard players enable @a death_swap_join
scoreboard players reset * death_swap_death

function death_swap_multi:tellraw/started
function death_swap_multi:tellraw/game/start_info
#proposer de rejoindre ou dire si il est dans la partie
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
function death_swap_multi:tellraw/time_if_sec

execute if score timeout death_swap_m matches 0 run function death_swap_multi:swap/swap
execute if score timeout death_swap_m matches ..0 unless entity @e[tag=death_swap_ms] run function death_swap_multi:random/random
execute if score timeout death_swap_main matches 0 run function death_swap_multi:swap/swap
execute if score timeout death_swap_main matches ..0 unless entity @e[tag=death_swap_entity_to_tp] run function death_swap_multi:random/random

execute if entity @e[tag=death_swap_ms] run function death_swap_multi:swap/swap_everybody
execute unless entity @e[tag=death_swap_ms] run scoreboard players remove timeout death_swap_m 1
execute if entity @e[tag=death_swap_entity_to_tp] run function death_swap_multi:swap/swap_everybody
execute unless entity @e[tag=death_swap_entity_to_tp] run scoreboard players remove timeout death_swap_main 1

#mort = perdu
execute as @a[tag=death_swap_m,scores={death_swap_death=1..}] run function death_swap_multi:party/game_over

execute if score mega death_swap_m matches 1.. run function death_swap_multi:mega/process
execute if score mega death_swap_main matches 1.. run function death_swap_multi:mega/process
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ scoreboard players operation random random_timeout += z random_timeout

scoreboard players operation random_plage random_timeout = time_max random_timeout
scoreboard players operation random_plage random_timeout -= time_min random_timeout
scoreboard players operation random_plage random_timeout += 1 const
scoreboard players add random_plage random_timeout 1
scoreboard players operation random random_timeout *= random_plage random_timeout
scoreboard players operation random random_timeout /= random_max random_timeout
scoreboard players operation random random_timeout += time_min random_timeout
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ execute at @p run summon minecraft:area_effect_cloud ~ ~ ~ {Duration:10,Tags:["r
execute unless entity @p run scoreboard players operation random random_timeout = time_max random_timeout
execute as @e[type=area_effect_cloud,tag=random_timeout,limit=1] at @s run function death_swap_multi:random/make

scoreboard players operation timeout death_swap_m = random random_timeout
scoreboard players operation timeout death_swap_main = random random_timeout
16 changes: 2 additions & 14 deletions Death Swap Multi/data/death_swap_multi/functions/reset.mcfunction
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
#reset the datapack
scoreboard players reset * death_swap_m
scoreboard players set setuped death_swap_m 1
scoreboard players set timeout death_swap_m -1

scoreboard players reset * death_swap_t
scoreboard players enable @a death_swap_t
scoreboard players reset * death_swap_id
scoreboard players set id death_swap_m 0
scoreboard players reset * death_swap_death
tag @e[tag=death_swap_msa] remove death_swap_msa
tag @e[tag=death_swap_ms] remove death_swap_ms
tag @e[tag=death_swap_m] remove death_swap_m
function death_swap_multi:setup

tellraw @a [{"translate":"[Death Swap]: "},{"translate":"Datapack has been reseted"}]
function death_swap_multi:tellraw/start_game
function death_swap_multi:tellraw/game/start_info
17 changes: 13 additions & 4 deletions Death Swap Multi/data/death_swap_multi/functions/setup.mcfunction
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
#config (as time_min) are only reseted if enabled=0 (at the first loading and not at the reset)

#from 10s to 300s (5 min) editable
scoreboard players set time_min random_timeout 200
scoreboard players set time_max random_timeout 6000

scoreboard players set setuped death_swap_m 1
#reset the datapack
scoreboard players reset * death_swap_main
scoreboard players set setuped death_swap_main 1
scoreboard players set timeout death_swap_main -1
scoreboard players set 20 death_swap_main 20

function death_swap_multi:reset
scoreboard players reset * death_swap_join
scoreboard players enable @a death_swap_join
scoreboard players reset * death_swap_id
scoreboard players set next_id death_swap_main 0
scoreboard players reset * death_swap_death
kill @e[type=area_effect_cloud,tag=death_swap_aec]
tag @e[tag=death_swap_entity_to_tp] remove death_swap_entity_to_tp
tag @e[tag=death_swap_m] remove death_swap_m

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#remove old _aec
kill @e[type=area_effect_cloud,tag=death_swap_aec]

# Area Effect Cloud (One per Entity)
tag @e[tag=death_swap_aec] remove death_swap_aec

#la duration est sur du random: normalement tout se passe en 1 tick mais il peut etre plus long
#(il y a 98% de chance que ça se passe en 4 ticks max)
#si c'est plus de 20 ticks alors les areas disparaissent et on abandonne le tp (relance le timer)
execute as @e[tag=death_swap_entity_to_tp] at @s run function death_swap_multi:swap/create_area/for_me
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tag @e[tag=death_swap_aec_new] remove death_swap_aec_new
summon area_effect_cloud ~ ~ ~ {Duration:20,Tags:["death_swap_aec","death_swap_aec_new"],CustomName:["Death Swap Area"]}
scoreboard players operation @e[type=area_effect_cloud,tag=death_swap_aec_new,sort=nearest,distance=..1,limit=1] death_swap_id = @s death_swap_id
tag @e[tag=death_swap_aec_new] remove death_swap_aec_new

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#si plus de _arc (le tp a mis trop de temps = la dernière entitée n'a pas été tp)
#tellraw @a [{"translate":"[Death Swap]: ","color":"dark_red"},{"translate":"Tp has timeout"}]

tag @e[tag=death_swap_entity_to_tp] remove death_swap_entity_to_tp
kill @e[type=area_effect_cloud,tag=death_swap_aec]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#si plus de _ms (ils sont mort/ramassés)
tellraw @a [{"translate":"[Death Swap]: ","color":"dark_red"},{"translate":"Players disappeared during the tp"}]

tag @e[tag=death_swap_entity_to_tp] remove death_swap_entity_to_tp
kill @e[type=area_effect_cloud,tag=death_swap_aec]
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#players who swap:
tag @e[tag=death_swap_m] add death_swap_ms
tag @e[tag=death_swap_m] add death_swap_entity_to_tp

scoreboard players set debug_time_swap death_swap_m 0
scoreboard players set timeout death_swap_m -1
scoreboard players set debug_time_swap death_swap_main 0
scoreboard players set timeout death_swap_main -1

#area
function death_swap_multi:swap/create_area
function death_swap_multi:swap/create_area/create
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#si encore des _ms (joueurs) mais plus de _ma / si encore des _ma (area) mais plus de _ms
execute if entity @e[tag=death_swap_ms] unless entity @e[tag=death_swap_ma] run function death_swap_multi:swap/reset
execute if entity @e[tag=death_swap_ma] unless entity @e[tag=death_swap_ms] run function death_swap_multi:swap/reset
# si plus de _aec mais encore des _to_tp (le tp a mis trop de temps => la dernière entitée n'a pas été tp)
execute if entity @e[tag=death_swap_entity_to_tp] unless entity @e[tag=death_swap_aec] run function death_swap_multi:swap/reset/no_aec
# si plus de _to_tp mais encore des _arc (ils sont mort/déco)
execute if entity @e[tag=death_swap_aec] unless entity @e[tag=death_swap_entity_to_tp] run function death_swap_multi:swap/reset/no_to_tp

execute as @e[tag=death_swap_ms,sort=random] run function death_swap_multi:swap/tp_if
execute as @e[tag=death_swap_entity_to_tp,sort=random] run function death_swap_multi:swap/tp_if

#si il y a pas "2 _ms ou plus" alors il en reste 1 ou 0 => on tp le dernier joueur
execute unless entity @e[tag=death_swap_ms,limit=2] run function jio18_death_swap:swap/tp2mas

#debug: the Duration of areas (in swap/create_area) must be greater than debug_time_swap
scoreboard players add debug_time_swap death_swap_m 1
#debug: the Duration of areas (in swap/create_area/create) must be greater than debug_time_swap
scoreboard players add debug_time_swap death_swap_main 1

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#tp death_swap_entity_to_tp (this, the entity) to death_swap_target (area_effect_cloud)

execute at @e[tag=death_swap_target,limit=1] run tp @s ~ ~ ~
kill @e[tag=death_swap_target,limit=1,type=area_effect_cloud]
tag @s remove death_swap_entity_to_tp
execute at @s as @a[distance=..20] run playsound minecraft:entity.enderman.teleport player @s ~ ~ ~ 0.25
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#this == _msa (a player)
function death_swap_multi:swap/choose_area
# this == _entity (a player)

#si id !=
execute unless score @e[tag=death_swap_mas,limit=1] death_swap_id = @s death_swap_id run function death_swap_multi:swap/tp2mas
# Select an aec => the target
tag @e[tag=death_swap_target] remove death_swap_target
tag @e[tag=death_swap_aec,sort=random,limit=1] add death_swap_target

# if id target != id source
execute unless score @e[tag=death_swap_target,limit=1] death_swap_id = @s death_swap_id run function death_swap_multi:swap/tp2target
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tellraw @a [{"translate":"[Death Swap]: "},{"translate":"Start the game","color":"yellow","clickEvent":{"action":"run_command","value":"/function death_swap_multi:party/resume"},"hoverEvent":{"action":"show_text","value":{"translate":"Click to start the game"}},"italic":true}]
tellraw @a [{"translate":"[Death Swap]: "},{"translate":"Start Mega Death Swap","color":"yellow","clickEvent":{"action":"run_command","value":"/function death_swap_multi:mega/start"},"hoverEvent":{"action":"show_text","value":{"translate":"Click to start the mega death swap"}},"italic":true}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
execute unless score enabled death_swap_main matches 1 run function death_swap_multi:tellraw/game/start_game
execute if score enabled death_swap_main matches 1 run function death_swap_multi:tellraw/game/started
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tellraw @a[tag=death_swap_m] [{"translate":"[Death Swap]: "},{"translate":"The game has started"},". ",{"translate":"You are in the game"}]
tellraw @a[tag=!death_swap_m] [{"translate":"[Death Swap]: "},{"translate":"The game has started"},". ",{"translate":"Join the game","clickEvent":{"action":"run_command","value":"/trigger death_swap_t set 1"},"hoverEvent":{"action":"show_text","value":{"translate":"Click to join the game"}},"italic":true}]
function death_swap_multi:tellraw/remaining_players
tellraw @a[tag=death_swap_m] [{"translate":"[Death Swap]: "},{"translate":"The game has started"},". ",{"translate":"You are in the game"}]
tellraw @a[tag=!death_swap_m] [{"translate":"[Death Swap]: "},{"translate":"The game has started"},". ",{"translate":"Join the game","color":"yellow","clickEvent":{"action":"run_command","value":"/trigger death_swap_join set 1"},"hoverEvent":{"action":"show_text","value":{"translate":"Click to join the game"}},"italic":true}]
function death_swap_multi:tellraw/remaining_players
function death_swap_multi:tellraw/time
Loading

0 comments on commit bc7abcc

Please sign in to comment.