help with evolveing mobs

Started by DeRokerij on

Topic category: Help with modding (Java Edition)

Last seen on 11:58, 17. Nov 2023
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
help with evolveing mobs

hi, I'm trying to make a mod with a mob that evolves over time, like once every minecraft day till its final evolution

so basically i want it to change to a different entity after a certain amount of ticks

 

any help you guys can offer with this would be great

Last seen on 10:49, 24. Jun 2024
Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Well this would be quite…
Wed, 01/11/2023 - 17:47

Well this would be quite difficult and scuffed without custom code, but you would basically need to make a speperate mob for every stage and then despawn the old one and spawn the new one in the same place. (You could better hide this using particles maybe...)

Last seen on 11:58, 17. Nov 2023
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
thank you very much ill try…
Fri, 01/13/2023 - 13:22

thank you very much ill try that

 

Last seen on 11:58, 17. Nov 2023
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
anyone have any idea how to…
Fri, 01/13/2023 - 13:33

anyone have any idea how to make an entity do something a specific amount of time after spawning?

Last seen on 15:32, 24. Jun 2024
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You're going to want to use…
Thu, 01/19/2023 - 18:00

You're going to want to use NBT tags for that. It sounds like what you're wanting to do is similar to how baby mobs grow up in vanilla, just with multiple stages. You'll have to have multiple individual mobs for that, like woodcraft mentioned.

"On initial entity spawn" you'll want a procedure that sets a custom number NBT tag of however long you want to wait before that entity evolves. The number you input is in ticks, with 20 ticks equal to a second.

Then on "On entity tick update" you'll want a procedure that gets that same tag and checks to see if it's equal to or below zero; if it isn't, set it to itself minus one. Once it does reach zero, you'll want to spawn the evolved form at the same x, y, z location, and preferably with the same 'direction yaw' and 'head pitch' as the pre-evolution as well. That way when it evolves, the new mob will be turned the same direction and its head will be looking the same direction as its predecessor. There are a bunch of other things you can try carrying over as well, like name, velocity, status effects, or damage taken, but that's up to you. After you spawn the new mob and carry over any values you want, just put in a despawn block to remove the old entity.

Also take into consideration if your entity evolves into something larger than it used to be. If it's too close to blocks when it evolves the evolution may spawn partially inside them and start suffocating. You may want to add a check to see if there's enough room around the entity before you spawn its evolved form.

If you haven't used NBT tags before they're actually very simple to use. In the text box you can put anything and that will be the name for your tag. The tag will be on the entity itself so you are able to use different procedures to check for a tag on an entity without the procedures needing to get variables from each other.