2

How to naturally spawn custom mobs?

Flamarine's Avatar Flamarine3/31/20 10:09 pm
2 emeralds 2.4k 5
12/18/2020 12:41 pm
Galdeveer's Avatar Galdeveer
I'm creating a new mob for my datapack, but I want it to naturally spawn.
How can I do this? pls help
Sorry about my poor English. I'm a Chinese.
Posted by Flamarine's Avatar
Flamarine
Level 43 : Master Modder
24

Create an account or sign in to comment.

5

2
04/04/2020 6:49 amhistory
Level 29 : Expert Explorer
GParcade
GParcade's Avatar
You can use tags to find new mobs, it is desirable that this mob is the same as your modified one and change it NBT to yours, this is the most optimal way in view of its compactness and low load. If you are going to use all entities then do as Galdevear.

"/summon" heavier than hundred commands
2
03/31/2020 10:56 pmhistory
Level 44 : Master Wisp
Galdeveer
Galdeveer's Avatar
---Note: I forgot that you cannot edit exp drops with loot tables. My mistake.



You can leach off of the current mob spawning system. What you want to do is tag new mobs when they spawn so you know which ones are new. You can test for this tag to make sure you don't process the mobs a second time. Then, (using loot tables so you can add random chance) summon a mob at the location of the newly spawned mob. Make sure you use a loot table to keep this from happening every time. You don't want to double the number of mobs. Optionally, you can kill the original mob after doing this to swap them out, but then you would need to either edit the nbt to keep a said entity from dropping the loot, or change the loot tables of every entity you do this with to check for a tag which tells it not to drop anything. Do not use the first option due to the resource impact of editing nbt. The third option would be to teleport the mob you want to swap out directly into the void so you kill it without ending up with drops, but I have yet to test the performance impact of this option. For now, I suggest you just leave the original entity, but eventually, you will want to do it properly by editing the loot tables. Keep in mind that you don't want to inflate the overall entity count too much, as this will slow down performance. This is why I suggested getting rid of the original entity



Furthermore, I suggest you split passive and hostile mobs into two tags which you can test for. These two groups have drastically different spawning patterns from each other and you will want to pick carefully.



As you can tell, I've spent the last nine or so months of my life studying this stuff XD.



Feel free to pick my brain.
2
03/31/2020 11:33 pm
Level 43 : Master Modder
Flamarine
Flamarine's Avatar
Thanks!
I'll try later!
1
12/18/2020 12:41 pm
Level 44 : Master Wisp
Galdeveer
Galdeveer's Avatar
It's so embarrassing I got stuff wrong on this. Sorry for being confusing. Every once and awhile I forget something really basic like how loot tables don't have 'rewards' fields like advancements.
1
03/31/2020 10:49 pm
Level 52 : Grandmaster Blob
HoboMaggot
HoboMaggot's Avatar
Find a random mob/same type of actual mob and replace it with the custom mob
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome