Need help in creating a mob

Started by ApertureMax on

Topic category: Help with modding (Java Edition)

Last seen on 11:12, 29. Nov 2023
Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Need help in creating a mob

So i need to create a flying mob that drinks glow berries, after that changes texture, and then you can use a bottle on it to get glowberry juice it changes the texture back and starts to seek out glowberries again. How can i programm this?

Last seen on 21:55, 20. Feb 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You would probably want to…
Mon, 10/30/2023 - 11:20

You would probably want to use the 'search for block in 6*6 box' procedure template, modified to probably use a larger radius, and to then use a 'make entity pathfind to location' function once the correct block has been found. 

On update tick, if the entity is inside glow berries, give it high levels of ambient slowness using the 'give entity potion effect' function, (so it doesn't leave), and stop its pathfinding. For each tick the entity is inside a glow berry vine, increase a custom NBT tag, (I'll call it 'juice_level'), by one, and if it's not in a glow berry vine and juice_level is greater than zero, decrease juice_level by one.

If Juice_level reaches your desired level, (it's measured in ticks, so every twenty points it accumulates is one second in a glow berry vine), spawn in a new entity, (the juicy version), and despawn the old entity. (If you want to make the transition more seamless, you can save the yaw/rotation and velocities of the original entity as local number variables, and apply them to the new one. If you really want to be fancy, you could also try transitioning any custom names to the new one.) Essentially, you want to make a copy of the entity with similar AI, but a different texture and slightly different behaviors, so you can distinguish between the two states.

To transition the new one back to the non-juicy version when a player right clicks the entity with a bottle, just make a procedure that triggers with the 'player right clicks entity' global trigger. Check if the item in the player's main hand is an empty bottle, and, if it is, shrink the itemstack for one and set a bottle of glowberry juice in the player's inventory; then do the same thing you did for the previous transition, just to a different entity.

Last seen on 11:12, 29. Nov 2023
Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
thanks mindthemoods i'm…
Mon, 10/30/2023 - 13:08

thanks mindthemoods i'm going to try that

Last seen on 11:12, 29. Nov 2023
Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
but i'm not sure if i'll…
Mon, 10/30/2023 - 13:12

but i'm not sure if i'll figure out which commands to use