2
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.
How can I do this? pls help
Sorry about my poor English. I'm a Chinese.
Create an account or sign in to comment.
5
2
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
"/summon" heavier than hundred commands
2
---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.
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
Thanks!
I'll try later!
I'll try later!
1
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
Find a random mob/same type of actual mob and replace it with the custom mob