Coding a New Natural Mob | (Ep. 3) Advanced 1.16.x Spigot Coding

Опубликовано: 18 Март 2026
на канале: CodedRed
13,858
303

In this episode, I talk about how to spawn a custom mob naturally into your world! It is very simple, just uses an event but you need to make sure you code it correctly or lag may occur. When making the "spawning chance" I recommend making it very low however, this ultimately depends on the mob! I hope you all enjoy this video, many more coming soon :)

[CHALLENGE CODE]
In this video, I challenged y'all to create the same feature I had at the beginning of the video. Make the wolf members follow the closest leader. The closest leader should be the only one since the Alpha Wolves fight each other. I do recommend attempting this challenge to better your skill! However, I do have the code that I used below for y'all to use/view :)
Hints:
- Created a custom pathfinder goal for wolf members
- Have it check whos the closest alpha (within a certain distance)
- If there is a close Alpha then when the locations compared (alpha and member) are more than x amount of blocks, navigate the member to the current alpha location.

Challenge Code Answer:
Like I said in the hints, I used a pathfinder goal to complete this task. Simply add the pathfinder goal to the wolf members and it should work fine :). The only thing you should need to pass into the Pathfinder goal is the Entity (this) and the speed at which the member goes to the alpha. (1.0)
https://pastebin.com/iJx4kydh
Example of use:
"this.goalSelector.a(1, new PathfinderGoalFollowLeader(this, 1.0));"

Need an MC server?
Need Cheap yet reliable Minecraft hosting? Check out Fallout-Hosting with their servers all around the globe, with some starting at $1/gb! Find all our plans and more at the website: https://clients.fallout-hosting.com/a...
P.S - This is what I use now to run my test server :D



Related Videos:
Custom Pathfinder goal video:    • Advanced Spigot Coding | Custom Pathfinder...  
Custom Mob video:    • Advanced Spigot Coding | Custom Mobs | (Ep...  
Multi-NMS versions video:    • Advanced Spigot Coding | Multiple Version ...  


Want more videos?
Become a Patreon support to gain access to more videos!

Patreon:
  / codedred  

Donate to me :)
https://www.paypal.me/CGMax

Join my discord:
  / discord  

Follow the Twitch Streams:
  / coded_red  

Follow my twitter for updates:
  / devcodedred  



Shoutout to Zephyr for the graphics!

----- Links -----

Download Eclipse: https://www.eclipse.org/downloads/pac...

Download Spigot: https://getbukkit.org/download/spigot

Build Spigot: https://www.spigotmc.org/wiki/buildto...

Check out my plugins:
https://www.spigotmc.org/resources/au...

[GITHUB CODE]
GitHub repo code is exclusively for Patron Supporters! For only $3 you can view all source code from videos!   / codedred  


Music:
Track: Minute Mix - ChillOutMedia
Music provided by Chill Out Records - No Copyright Music.
Listen: https://www.chilloutmedia.com/download