Minecraft Maps / Redstone Device

Block Position Detection

  • 677 views, 2 today
  • 1
  • 0
Nilstyle's Avatar Nilstyle
Level 38 : Artisan Engineer
31
NOTE:You need to put your creation in your spawnchunks for it to work everywhere in your world!

People have made amazing custom blocks and multi-blocks before but...Every single one I've seen requires you to do something to detect the position of the block, whether it's placing it while jumping, or throwing an item on it, or rather using a spawn egg to spawn a mob with a custom name, then summoning a block at it...This system removes the need to do that!


Commands:
execute @a[score_detect_min=1] ~ ~ ~ /summon ArmorStand ~ ~7 ~ {CustomName:Detector11,NoGravity:true,Invisible:true} --
Summons first set of armor stands, I have 11 of these each summoning an armorstand with a different name at a different y position, all the way from ~-3 to ~7

execute @e[type=ArmorStand,name=Detector] ~ ~ ~ /scoreboard players set @e[type=ArmorStand,NoGravity=true,dy=10] detect 0 --Makes the lowest armorstand set the score of the armor stands to 0

/stats entity @e[name=Detector,type=ArmorStand] set SuccessCount @e[name=Detector,type=ArmorStand] detect
--Again, I have 11 variations of these commands, all of them set the stats of their respective armor stand to their score

execute @e[type=ArmorStand,score_detect_min=0] ~ ~ ~ /fill ~5 ~ ~5 ~-5 ~ ~-5 double_stone_slab 8 replace crafting_table --each armorstands will then try to fill a 5x5 area around them, by replacing a crafting table

execute @e[type=ArmorStand,score_detect_min=0] ~ ~ ~ /fill ~5 ~ ~5 ~-5 ~ ~-5 crafting_table 0 replace double_stone_slab 8 --This places the table back

execute @e[score_detect_min=1,type=ArmorStand] ~ ~ ~ /summon ArmorStand ~ ~ ~-5 {CustomName:DetectorZ,NoGravity:true,Invisible:true} --Summons second set of armorstands, same as first set but with different name, and on the Z axis from ~-5 to ~5

/stats entity @e[name=DetectorZ11,type=ArmorStand] set SuccessCount @e[name=DetectorZ11,type=ArmorStand] detect --This sets the second sets' stats to their score BEFORE they get a score.

/kill @e[type=ArmorStand,score_detect_min=0] --kills the first set

execute @e[type=ArmorStand,name=DetectorZ] ~ ~ ~ /scoreboard players set @e[type=ArmorStand,NoGravity=true,dz=10] detect 0 --The armorstand on the most -z co-ord then sets the second sets' score to 0

execute @e[type=ArmorStand,score_detect_min=0] ~ ~ ~ /fill ~5 ~ ~ ~-5 ~ ~ double_stone_slab 8 replace crafting_table
                                                                                                and
execute @e[type=ArmorStand,score_detect_min=0] ~ ~ ~ /fill ~5 ~ ~ ~-5 ~ ~ crafting_table 0 replace double_stone_slab
 8 --basically same as above

execute @e[score_detect_min=1,type=ArmorStand] ~ ~ ~ /summon ArmorStand ~-5 ~ ~ {CustomName:DetectorX,NoGravity:true,Invisible:true} --Summons the third set 

/kill @e[type=ArmorStand,score_detect_min=0]
 --kills old set

execute @e[type=ArmorStand,name=DetectorX] ~ ~ ~ /scoreboard players set @e[type=ArmorStand,NoGravity=true,dx=10] detect 0  --The armorstand on the most -x co-ord sets the sets' score to 0

execute @e[type=ArmorStand,score_detect_min=0] ~ ~ ~ detect ~ ~ ~ crafting_table 0 /summon ArmorStand ~ ~-2 ~ {Invulnerable:true,NoGravity:true,CustomName:BenchLocator,Invisible:true,Marker:1}  --Replace the /summon command with the command you want to run at the position of the block
 
/kill @e[type=ArmorStand,score_detect_min=0] --kills the last set

scoreboard players set @a detect 0 --set the player's score back
CreditMusic: "Legend of One", "Ouroboros", "Your Call" Kevin MacLeod (incompetech.com) Licensed under Creative Commons: By Attribution 3.0 http://creativecommons.org/licenses/by/3.0/
Progress100% complete
Tags

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome