Started by
bmccahon
on
Topic category: Help with MCreator software
Hello all!
I'm currently working on a Java Edition mod feature that adds silkworms and silk moths into the game. I'm wanting the silkworms to spawn in naturally to start, and then change into a silk moth after a certain amount of time. I found a code template for this, which I have used (please see a photo of my code here), but when trialling the feature in-game I have found that after placing one silkworm down, it will change into several silk moths at the allotted time. Is there any way to include a limit in the code so that only 1 silk moth spawns in?
Thanks for any help!
Edited by bmccahon on Wed, 07/19/2023 - 04:38
I had this issue with one of my entities as well. I found adding the "If world not client side" fixed the issue - https://imgur.com/a/QdG5mjW
Thanks so much for your help! I tried this and I think it partially worked, however I am still having issues with multiple silk moths spawning in following the silkworm despawn. I've noticed the number of silk moths that spawn matches the number of ticks in the wait procedure, so for example <Wait 20 ticks then on server-side> would spawn 20 silk moths.
Would you have any idea how to resolve this?
You could check how many of such entities are in range and despawn them too
If the issue is the wait condition, you could also try creating an NBT timer. "On entity tock update" -> if timer # is greater than 0 subtract one from the timer
An "on entity spawn" procedure set the timer to your amount (20 ticks per your image)
On your current procedure, remove the wait and replace it with an if timer is = to 0 then run procedure.
Using an NBT timer worked perfectly! No more excess moths spawning in.
For anyone who needs help with this in future, I followed NorthWestTrees tutorial to learn how to make the process: https://www.youtube.com/watch?v=gTbWiMu-M-0
Thanks Stitch and Klemen for your help!