If I understand this right, your using a dispenser to create an 'uncrafter' of sorts. Your trying to check for item combinations in that dispenser when a player is near it. If so then try a setup like what I describe below:
'1' is to create a marker type armor stand that's invisible and invulnerable. In other words a target to bounce commands off from that can't be interacted with directly.
'2' is the command to detect if the player is within 1 block of it. That would be standing next to the dispenser, on top of it, or on the block below it. Just put your 'testforblock' and commands that modify the dispenser's inventory in place of 'COMMAND'.
I'm not sure if testforblock or even testfor work this way though. They may not relay their results back to the command block but if they don't you could using a testfor immediate after it to test for command success in order to trigger a chain based on it's results.
i am working on a map where i want to have a custom crafting. with my codes it works but only when your standing on the top of the dispenser
" /execute @a ~ ~ ~ testforblock ~ ~-1 ~ dispenser 1 {CustomName:"The Un-Crafter",Items:[0:{Slot:4b,id:"minecraft:crafting_table",Count:1b,Damage:0s}],id:"Trap",Lock:""} "
is there a way so you dont have to stand on top but just stand near it??
YOUTUBE
That's what your target selector is for. Try @e[r=2] to test for a radius of 2 blocks. Adjust according to needs.
thats the radius of the player. (within 2 blocks of the executing command block)
i want to testforblock without a radius or a specific place where the player has to be at the moment of crafting something
YOUTUBE
If I understand this right, your using a dispenser to create an 'uncrafter' of sorts. Your trying to check for item combinations in that dispenser when a player is near it. If so then try a setup like what I describe below:
At the dispenser, summon an armor stand with:
1) summon ArmorStand ~ ~-0.5 ~ {CustomName:UncrafterDetector,Small:1,Invisible:1,Invulnerable:1,Marker:1,NoGravity:1}
2) execute @e[name=UncrafterDetector] ~ ~ ~ execute @p[r=2] ~ ~ ~ COMMAND
'1' is to create a marker type armor stand that's invisible and invulnerable. In other words a target to bounce commands off from that can't be interacted with directly.
'2' is the command to detect if the player is within 1 block of it. That would be standing next to the dispenser, on top of it, or on the block below it. Just put your 'testforblock' and commands that modify the dispenser's inventory in place of 'COMMAND'.
I'm not sure if testforblock or even testfor work this way though. They may not relay their results back to the command block but if they don't you could using a testfor immediate after it to test for command success in order to trigger a chain based on it's results.
i actualy used this
execute @e[name=UncrafterDetector] ~ ~ ~ COMMAND
it works now with the testforblock and the blockdata
thanks a lot!!!!!!!!
YOUTUBE