Minecraft – How to make a command block give/summon chest every morning (minecraft time)? 1.7.10

minecraft-commandsminecraft-java-edition

I'm wondering what script would be need to do to give a player who presses a button a set amount of resources every time an amount of time has passed. Base on how much time has passed the player would get more.

Example: Player joins Minecraft on day 1 on a multiplayer server and builds a quarry. Admin approves of the building and sets up a command block in the build that the player can press to get stone. The Player pushes the button on day 2 and gets a stack of 1 stack (64 blocks of) stone. The player skips a day; on day 4 presses the button and gets 2 stacks of stone.

The command script for the command block needs to be compatible with 1.7.10 and if vanilla commands don't work I will be using Lord of the Rings mod which has additional commands.
link > http://lotrminecraftmod.wikia.com/wiki/Commands

Best Answer

Use a daylight sensor. By using redstone to check the output of the lamp, you can trigger an output line each dawn and evening. Use a T-flip-flop to reduce those 2 pulses to one long pulse every dawn. Connect that to a command block which summons an item into a hopper which points into a chest.

When the player presses the button, another hopper will take the items out of the chest. Run a comparator out of that hopper into a redstone clock. Set up the clock correctly so each item that passes through the hopper will turn the clock on and off once. Connect the clock to a commend block, set up to give whatever item to the player, or to summon it on the ground, or whatever other action.

The result: The number of dawns that have passed since the button was last pressed will be counted. When the button is pressed, the command block will run once for each dawn that passed. The recording of how many dawns have passed will be set to 0, ready for the next button press.

I saw in a comment that you had trouble with people griefing the daylight sensor. If that is a problem, just move the entire command block setup somewhere that no one can reach. For example, very high up, or a million blocks away. Even though there are no barrier blocks in 1.7, you can still use bedrock to stop players getting in. If they are able to reach the daylight sensor still, then add a command block which executes every tick and places a daylight sensor if there isn't one already there. The result: The daylight sensor cannot be permanently broken and no other parts can be reached.

EDIT: The command to place a new daylight sensor only if it has been removed should be:

setblock x y z minecraft:daylight_sensor 0 replace minecraft:air

Of course, replace x y z with the correct coordinates of where the daylight sensor should go. Also, that command will need to be executed every tick. If you need instructions, read this article http://minecraft.gamepedia.com/Clock_circuit and scroll to the section "Setblock clock". Good luck!