I'm using a lantern mechanic with oil and I want the timer to count down if the torch has been placed on the ground, the problem is getting it to search for the torch.
I know the testforblock command can be used to find a block on a specific point, but I have an entire castle to search for this torch in, so I can't be using that and using a command block for every single possible place the player could put a torch.
The current command I have is /testforblock ~ ~ ~ ~100 ~100 ~100 torch .
Can anyone correct this, because it reads the first ~100 as the block name and goes "There is no such block".
If anyone knows of how to search for the torch in an large area, I'd be much obliged.
Better way to do it is give the player one torch and tick down for each moment the player does not have a torch in their inventory. Otherwise you'd need one command block per space the player can place the torch.
Rollback Post to RevisionRollBack
Quote me to make sure I know you replied.
Useful stuff to help with commands in MC:
MCStacker <- The best /summon command generator out there. Also very useful for data tags on /give commands and /setblock and quite a few others.
minecraftjson <- Epic book/sign/title/tellraw creator. Turns hours of command creation into minutes!
Single command block <- Ever seen those epic single command block creations? This is how you make them!
Better way to do it is give the player one torch and tick down for each moment the player does not have a torch in their inventory. Otherwise you'd need one command block per space the player can place the torch.
Problem with that is that it's a multiplayer map, so the timer will count down if they pass it between each other. Also, if they accidentally out it in a chest or drop it, the timer starts then too.
Problem with that is that it's a multiplayer map, so the timer will count down if they pass it between each other. Also, if they accidentally out it in a chest or drop it, the timer starts then too.
You can make it so that if it's in a player inventory at all it won't count down if there's only 1 torch between them. Also you can add a stat.useItem.minecraft.torch objective so that it only increments if a player places the torch, rather than dropping it. It'd be a bit complex, but look something like this:
Use this to find if a player has a torch in their inventory
/scoreboard players set @a TORCHINVENTORY 1 {Inventory:[{id:"minecraft:torch"}]}
This will reduce the oil when all parameters are met
Using /fill on a fill clock (a bit confusing), constantly replace torches with a certain block. Have a comparator going out from the command block that replaces the torches. The comparator should turn on once it changes the torch. Then, make the comparator activate the timer, stop the command block that replaces the torches, and on a delay, turn the block back into a torch.
You can make it so that if it's in a player inventory at all it won't count down if there's only 1 torch between them. Also you can add a stat.useItem.minecraft.torch objective so that it only increments if a player places the torch, rather than dropping it. It'd be a bit complex, but look something like this:
Use this to find if a player has a torch in their inventory
This will reduce the oil when all parameters are met
Also a command to reset PLACEDTORCH if the torch is in a player's inventory:
Something like this stuff.
Aha, that's what I need. I can set up a block to block the timer as soon as the torch is back, yeah, that's great. Thanks very much.
I'm using a lantern mechanic with oil and I want the timer to count down if the torch has been placed on the ground, the problem is getting it to search for the torch.
I know the testforblock command can be used to find a block on a specific point, but I have an entire castle to search for this torch in, so I can't be using that and using a command block for every single possible place the player could put a torch.
The current command I have is /testforblock ~ ~ ~ ~100 ~100 ~100 torch .
Can anyone correct this, because it reads the first ~100 as the block name and goes "There is no such block".
If anyone knows of how to search for the torch in an large area, I'd be much obliged.
Better way to do it is give the player one torch and tick down for each moment the player does not have a torch in their inventory. Otherwise you'd need one command block per space the player can place the torch.
Quote me to make sure I know you replied.
Useful stuff to help with commands in MC:
MCStacker <- The best /summon command generator out there. Also very useful for data tags on /give commands and /setblock and quite a few others.
minecraftjson <- Epic book/sign/title/tellraw creator. Turns hours of command creation into minutes!
Single command block <- Ever seen those epic single command block creations? This is how you make them!
http://chunkbase.com/apps/spawn-chunks-reader <- Shows you the spawn chunks of your MC seed.
Problem with that is that it's a multiplayer map, so the timer will count down if they pass it between each other. Also, if they accidentally out it in a chest or drop it, the timer starts then too.
You can make it so that if it's in a player inventory at all it won't count down if there's only 1 torch between them. Also you can add a stat.useItem.minecraft.torch objective so that it only increments if a player places the torch, rather than dropping it. It'd be a bit complex, but look something like this:
Use this to find if a player has a torch in their inventory
This will reduce the oil when all parameters are met
Also a command to reset PLACEDTORCH if the torch is in a player's inventory:
Something like this stuff.
Quote me to make sure I know you replied.
Useful stuff to help with commands in MC:
MCStacker <- The best /summon command generator out there. Also very useful for data tags on /give commands and /setblock and quite a few others.
minecraftjson <- Epic book/sign/title/tellraw creator. Turns hours of command creation into minutes!
Single command block <- Ever seen those epic single command block creations? This is how you make them!
http://chunkbase.com/apps/spawn-chunks-reader <- Shows you the spawn chunks of your MC seed.
Using /fill on a fill clock (a bit confusing), constantly replace torches with a certain block. Have a comparator going out from the command block that replaces the torches. The comparator should turn on once it changes the torch. Then, make the comparator activate the timer, stop the command block that replaces the torches, and on a delay, turn the block back into a torch.
I'll post a picture later if you need one.
You people seem to want to this the hard way.
The easy way is to summon a noAI mob at the location of the lantern when it is placed (Thus only having to check a few blocks around the player)
Additionally, since there is now an entity, you can do scoreboard stuff to it (for example very easy tracking of burn time)
If you were to use spawn eggs called Lantern, you wouldn't need to run any testfors at all:
/entitydata @e[name=Lantern] {noAI:1}
/execute @e[name=Lantern] ~ ~ ~ /setblock ~ ~ ~ torch
/scoreboard players set @e[name=Lantern] BurnTime 100
On a clock:
/scoreboard players removet @e[name=Lantern,score_BurnTime_min=1] BurnTime 1
/execute @e[name=Lantern,score_BurnTime_min=0] ~ ~ ~ /setblock ~ ~ ~ air
I assume this is what you want, if not, then please disregard this post.
I make these things...
https://www.youtube.com/user/AwesomeSyd239
Aha, that's what I need. I can set up a block to block the timer as soon as the torch is back, yeah, that's great. Thanks very much.