-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prevent placing lobby bases too close to the worldborder and too clos…
…e to eachother
- Loading branch information
L_glandieres
authored and
L_glandieres
committed
Mar 30, 2024
1 parent
d528794
commit 8078e16
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...acks/Scaffolding Rush/data/scaffolding_rush/functions/villager/check_placement.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,30 @@ | ||
|
||
# Cancel lobby villager placement if too close to worldborder or too close to others bases | ||
|
||
|
||
# Worldborder proximity : | ||
execute store result score @s pos.x run data get entity @s Pos[0] | ||
execute store result score @s pos.z run data get entity @s Pos[2] | ||
|
||
scoreboard players operation WBGap data = WBbyTwo data | ||
scoreboard players operation WBGap data -= 2 const | ||
|
||
scoreboard players operation -WBGap data = -WBbyTwo data | ||
scoreboard players operation -WBGap data += 2 const | ||
|
||
execute if score @s pos.x > WBGap data run tag @s add worldborder_obstruction | ||
execute if score @s pos.x < -WBGap data run tag @s add worldborder_obstruction | ||
execute if score @s pos.z > WBGap data run tag @s add worldborder_obstruction | ||
execute if score @s pos.z < -WBGap data run tag @s add worldborder_obstruction | ||
|
||
execute if entity @s[tag=worldborder_obstruction] run tellraw @a[tag=player_place_base] ["",{"text":"[BS] ","color":"gold"},{"translate":"blazing_scaffolding.base.near_worldborder","color":"red"}] | ||
execute if entity @s[tag=worldborder_obstruction] run kill @s | ||
|
||
# other bases proximity | ||
execute if entity @e[type=villager,tag=respawn_villager, distance=..20] run tag @s add base_obstruction | ||
|
||
execute if entity @s[tag=base_obstruction] run tellraw @a[tag=player_place_base] ["",{"text":"[BS] ","color":"gold"},{"translate":"blazing_scaffolding.base.near_other_bases","color":"red"}] | ||
execute if entity @s[tag=base_obstruction] run kill @s | ||
|
||
#confirmation message | ||
execute if entity @s[tag=!worldborder_obstruction,tag=!base_obstruction] run tellraw @a[tag=player_place_base] ["",{"text":"[BS] ","color":"gold"},{"translate":"blazing_scaffolding.base.placement_set"}] |
9 changes: 8 additions & 1 deletion
9
datapacks/Scaffolding Rush/data/scaffolding_rush/functions/villager/placed_child.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