a block generating another block

Started by TortugaTvzz on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
a block generating another block

I'm creating a mod to replace a function not added in the "chaos awakens" mod, it's the duplicating tree, I'm new to this world of programming and I wanted to know how I can add the main functionality of the mod which is "duplicating the blocks around it", For those who don't know, the duplicating tree duplicates blocks of minerals that were placed around it, for example: if I place a diamond block on wood, over time this block will multiply around the tree.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You'll need some sort of…
Sun, 10/01/2023 - 14:23

You'll need some sort of block that triggers on random tick update, and, on update tick, runs a procedure that duplicates blocks nearby.

You can use the 'search for block in 6*6*6 box' procedure template, which can locate blocks in a configurable area. Since you want to change blocks instead of detecting them, you can rip out the stuff in the middle, and replace it with a procedure that checks if they're a mineral block, and, if they are, places that same block somewhere nearby. (This will be the tricky bit, depending on where you want duplicated blocks to be placed.)

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I wanted them to be created…
Mon, 10/02/2023 - 01:44

I wanted them to be created around the tree, think of a circle where the central lines are 5 blocks away from the center (the center is the tree)
I will try to do what you said, if I have any problems I would like to be able to get back to you again

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Circle could be tricky;…
Mon, 10/02/2023 - 10:42

Circle could be tricky; depends on whether you want to actually do a circle, (which would require math), or just program in each block position individually. (You could have the procedure check if there's an air block at the first position in the circle, and, if there isn't, move on to the second position... and so on and so forth). If your circle has a five block radius though, it could be somewhat annoying to code in every single position individually. 

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
maybe a square shape would…
Mon, 10/02/2023 - 17:47


maybe a square shape would solve this headache?

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It'd be a similar thing; it…
Mon, 10/02/2023 - 17:49

It'd be a similar thing; it's just a matter of whether you want to code in and check for each individual block position. It'll work, it'll just take longer to write.

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This mod is for personal use…
Mon, 10/02/2023 - 17:57

This mod is for personal use, so I was looking for a solution that was at least functional, I was looking at the code and I was very lost, like, how can I make it check if the block is a mine and not just 1 specific block?

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can use an 'if' bracket,…
Mon, 10/02/2023 - 21:54

You can use an 'if' bracket, with a 'is target block the same as...' function to check for a specific block. If you need to check for a specific type of block instead, (such as mineral blocks), you can create a tag, assign blocks to that tag, and then instead of checking for a specific block, you would check if the block at that position is tagged in your custom tag.