Started by
TheDuckKnight_Mc
on
Topic category: Help with Minecraft modding (Java Edition)
Alright, let's get straight to the point: I am trying to make an item that when right clicked on a block spawns a mob. And that part is the easy part.
What I'm struggling to figure out how to do is how to make it so that once I spawn one mob, I can't spawn more. And once the spawned mob dies, I can spawn a new one.
Basically, I'm trying to make a spawn egg that only can spawn one mob at a time.
Is that even possible? I figured I'd have to use global variables (probably player_persistent)
Any and all help is appreciated, though the news of "it's impossible" would be quite disappointing.
Thank you :)
oh this is very easy, I had a problem with something that needed something similar. its not actually easy but more tedious I will send you the images soon I am testing it out first
It was more annoying then I expected but this is how its done
https://imgur.com/a/moc4ieI
(btw images are in order)
I will still give you a more detailed explanation though, first you make the variable in the picture, second for the item that spawns the mob, copy that trigger to spawn it, the next one is the mob you want to spawn (I'm treating this mob as a pet or summon that helps you fight) the third image should be copied to when the entity makes contact with the player, the forth image should be when the entity dies (copy the procedures exactly for this to work) and the last one should be a procedure by itself, just copy it and make sure the trigger is on player tick, I hope I helped.
if this mob was not supposed to be a mob you summon to fight for you then you will need to change things, but I'm afraid I wasn't able to work it out, so if you want this to be a summonable boss to fight or something then you will have to tweak most of it if not all.
also I had to make it so the mob will spawn in you for this to work, also remove the message boxes as well, I only had them for testing