How to make a Block that generates items in it's storage?

Started by BonnieRobloxRIP on

Topic category: Help with modding (Java Edition)

Last seen on 22:19, 4. Nov 2023
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make a Block that generates items in it's storage?

The idea is that i want to make a custom block that can generate a specific item (for example diamonds) every 5 seconds and use it with a hopper to extract the generated diamonds to a chest. The block is capable of holding up to only 1 item at a time. like 1 slot with only 1 item count of anything...

 

I don't know how to do it and there's no such topic in the forum anywhere to my knowledge so it'll be nice if

someone can shed some light on how this can be done. 

Last seen on 20:44, 28. Mar 2024
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make a procedure for the …
Tue, 04/18/2023 - 17:56

Make a procedure for the "Update tick", and open it. Create a local variable, call it time, and set the variable type to number. Make the blocks like this:

 

Set {Local variable: Time} to {{Get {Local variable: Time}} + {1}}

If {Get {Local variable: Time} = <Something>}:

     Set {1} {Diamond item} in slot {0} of the currently open GUI of {Event/target entity}

     Set {Local variable: Time} to {0}

 

Where I typed <Something>, you can enter the number of game ticks before it generates a diamond.

Here's an image of the procedure: wait a sec...

Last seen on 20:44, 28. Mar 2024
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh wait! I wrote it wrong!…
Tue, 04/18/2023 - 18:39

Oh wait! I wrote it wrong! Just a moment...

Last seen on 20:44, 28. Mar 2024
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make the blocks like this…
Tue, 04/18/2023 - 18:51

Make the blocks like this instead:

 

Set {Local variable: Time} to {{Get {Local variable: Time}} + {1}}

If {Get {Local variable: Time} = 100}:

     Execute command /"data merge block ~ ~ ~ {Items:[{id:diamond,Slot:0,Count:1}]}" at x: {x} y: {y} z: {z}

     Set {Local variable: Time} to {0}

 

Where I typed 100 I think that's equal to 5 seconds.

Here's an image of the procedure: https://ibb.co/ZW3hgMS

Last seen on 20:44, 28. Mar 2024
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh, and you can type any…
Wed, 04/19/2023 - 13:53

Oh, and you can type any minecraft item id after the "id:" insead of "diamond".