Started by
TortugaTvzz
on
Topic category: Help with Minecraft modding (Java Edition)
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.
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.)
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
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.
maybe a square shape would solve this headache?
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.
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?
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.