Skip to content

Instantly share code, notes, and snippets.

@A2va
Created January 17, 2020 17:11
Show Gist options
  • Save A2va/5fd68d2b4597587174307f57889d86d5 to your computer and use it in GitHub Desktop.
Save A2va/5fd68d2b4597587174307f57889d86d5 to your computer and use it in GitHub Desktop.
scoreboard players set Rand Spreadplayers 0
#Set Center
scoreboard players set CenterX Spreadplayers 0
scoreboard players set CenterZ Spreadplayers 0
#Set Radius
scoreboard players set Radius Spreadplayers 1000
scoreboard players set Radius2 Spreadplayers 0
scoreboard players operation Radius2 Spreadplayers = Radius Spreadplayers
scoreboard players operation Radius2 Spreadplayers *= #2 Spreadplayers
scoreboard players operation Radius2 Spreadplayers += #1 Spreadplayers
#Rand
summon area_effect_cloud ~ ~1 ~ {Tags:["random"],Age:1}
execute store result score Rand Spreadplayers run data get entity @e[type=area_effect_cloud,tag=random,limit=1] UUIDMost 0.00000000023283064
scoreboard players operation Rand Spreadplayers %= Radius2 Spreadplayers
kill @e[type=area_effect_cloud,tag=random]
scoreboard players set @s TpX 0
execute if score Rand Spreadplayers > Radius Spreadplayers run scoreboard players operation @s TpX -= Rand Spreadplayers
execute if score Rand Spreadplayers > Radius Spreadplayers run scoreboard players operation @s TpX /= #2 Spreadplayers
execute if score Rand Spreadplayers <= Radius Spreadplayers run scoreboard players operation @s TpX = Rand Spreadplayers
scoreboard players operation @s TpX += CenterX Spreadplayers
#Rand
summon area_effect_cloud ~ ~1 ~ {Tags:["random"],Age:1}
execute store result score Rand Spreadplayers run data get entity @e[type=area_effect_cloud,tag=random,limit=1] UUIDMost 0.00000000023283064
scoreboard players operation Rand Spreadplayers %= Radius2 Spreadplayers
kill @e[type=area_effect_cloud,tag=random]
scoreboard players set @s TpZ 0
execute if score Rand Spreadplayers > Radius Spreadplayers run scoreboard players operation @s TpZ -= Rand Spreadplayers
execute if score Rand Spreadplayers > Radius Spreadplayers run scoreboard players operation @s TpZ /= #2 Spreadplayers
execute if score Rand Spreadplayers <= Radius Spreadplayers run scoreboard players operation @s TpZ = Rand Spreadplayers
scoreboard players operation @s TpZ += CenterZ Spreadplayers
#Tp your entity with score TpX and TpZ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment