#Custom structures spawn entities with `/place`, but not when generating naturally.

1 messages · Page 1 of 1 (latest)

wheat kestrel
#

Afternoon, gamers. I'm working on a 1.20.1 datapack that will be a compatibility patch between Dungeons and Taverns and the Illager Invasion mod. I'm a big fan of both, so I'm adding the new illagers from that mod to Dungeons and Taverns structures like the illager camp, illager hideout, etc.

My strategy so far has been adding jigsaw blocks to existing Dungeons and Taverns structures that then attach to "structures" that are just illagers. This way, I can spawn from a pool of potential illagers for some randomization. This is what vanilla villages do for spawning golems and villagers, after all.
I got a problem though. Everything works 100% when using the /place command: vanilla pillagers spawn and some modded pillagers spawn from a template pool I made. However, naturally generated Dungeons and Taverns structures that I have modified do not spawn my new illagers. They're not even spawning the original vanilla illagers that are just entities in the structure .nbt and not "jigsaw"-ed in.

I have tested this in over a dozen generated worlds and /place always works, while a naturally spawned structure that I modified does not spawn illagers.

I've made several compatibility patches for Bethesda games, but I'm a newcomer to Minecraft datapack development, so here I am looking help. I thought I was maybe doing something wrong with my illager spawn .nbts, but they look just like the .nbts in minecraft:structures/villager/<biome>/villagers.

red smeltBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 If nobody has answered you by <t:1728935455:t>, feel free to use the Summon Helpers button to ping our helper team.

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

coarse flame
#

Are you certain you saved the structure blocks with Save Entities: On?

wheat kestrel
#

Here's some relevant datafiles.
illager_invasion_militia.json is the template pool of jigsaw structures that contains a handful of the modded illager spawning .nbts.
provoker.nbt is an example of one of those jigsaw structures that spawn an illager.
The illager_camp.jsons are the worldgen/structure and the worldgen/structure_set JSON found in the worldgen folder for the Illager Camp structure from DnT. I have not modified these files.
illager_camp_fire.nbt is the center piece of the Illager Camp structure. I have modified this structure to include two jigsaw blocks that pull structures from the illager_invasion_militia.json template pool.

wheat kestrel
coarse flame
#

Right right. When you're using /place, is that in the world you built/modified the builds in, or in new worlds?

#

It could also be a folder name issue. There's a bug right now that if you save a structure block, it gets saved to the generated folder in a folder called structures, but in 1.21, it actually needs to be called structure, so if you don't change it before adding it to the data pack, those structure NBT files are not going to be the ones that get used. However if you're in a world where those structure NBT files are still in the generated folder, it's possible they will because that's not actually in a data pack

wheat kestrel
coarse flame
#

And you are changing the folder name as I described when you're adding the generated structure NBT files to your data pack?

wheat kestrel
coarse flame
#

Ah if you're in 1.20.1 then no

wheat kestrel
#

I'm trying to make a 1.20.1 datapack for myself. Create 1.21 update can't come fast enough lol

coarse flame
#

Hm. I can't think of any reason entities would spawn with /place but not when generating naturally, especially if you're handling them like villages do. 🤔

#

Can we get some screenshots of the builds? The parent and child jigsaw blocks, where the entities are positioned, etc?

wheat kestrel
#

Absolutely. Let me get those for you

#

Figured it was worth sending the whole datapack. There's a whole bunch of content in here from the original DnT mod. The only structure I have modified so far is the nova_structures:illager_camp. I haven't worked on any of the other illager structures.

#

Here they are

#

First image is of the camp. The upfacing jigsaw blocks are the ones that spawn the modded illagers. Those structures are pictured in the second image.

#

You can see the pillager and vindicator that spawn with the camp. They are just saved as entities in the .nbt. These vanilla illagers do not spawn either when naturally generated.

#

Really appreciate the help so far, by the way. Would you believe me if I said this is the third server I've asked for help on? 😅

coarse flame
#

I would, unfortunately data pack knowledge is very splintered

#

Unfortunately I still struggle to see any reason /place would be behaving differently from natural generation.

harsh osprey
#

I know that they’ll generate over blocks that have already been placed, such as trees and player-made structures.

#

But I don’t think that would affect our situation here 🤔

wheat kestrel
#

I thought it might've been some other mods I was using when I created the structures that were causing issues, but I recreated all of them with zero mods (other than Illager Invasion, its dependencies, and the DnT datapack of course). Still no dice. I also checked the world logs when the structure generates and when I approach it. Nothing there.

wheat kestrel
#

I am going to try to create an entirely new structure starting from scratch with a new datapack, and attempt to spawn vanilla illagers within it just like how a vanilla village handles spawning. I will report back my results.

wheat kestrel
#

Followed an online tutorial on making a structure from scratch. Very helpful.
Currently, I have four jigsaw blocks on the campsite that spawn vanilla illagers (same chance for a vindicator or pillager).

It's spawning behavior was... inconsistent. For one, I would never see all four spawn. The most I saw was three. Sometimes, none spawned.

I decided to use a nuclear option and set their PersistenceRequired to True. Now, you see what's in the image: all four spawning at last.

I'm not happy that I had to enforce persistence for performance reasons, but my theory here is that there's some sort of hostile mob despawning behavior that's messing with my naturally spawning hostile mobs.

Thanks again to SNHU for sponsoring this video! https://snhu.edu/codeneon

In this video, I overhauled the Trial Chambers from the Minecraft 1.21 Tricky Trials Update.

GET THE TEMPLATE - https://drive.google.com/file/d/1KnHXb91neMh5ShWFVQDuPn3UwbTNmDct/view?usp=drivesdk

GET THE DATAPACK (Now publicly available for free!) - https://www.planetmi...

▶ Play video
#

Holyyyy just checked the structures that the Illager Invasion mod adds. These structures have spawns for modded illagers, and ALL of them have PersistenceRequired set to true!

#

It even has spawns for non-hostile mobs, and they have PersistenceRequired set to false.

#

I'm going to return to the structure I modified at the start of this thread and set every illager's persistence to true, and report back

#

Even structures that spawn vanilla illagers from the Dungeons and Taverns have PersistenceRequired set to True

#

Overwhelming success

#

You can see an Illager Marauder and Provoker in this shot :)

#

Lesson here I suppose is if you want to spawn hostile mobs reliably in your datapack, PersistenceRequired is your friend. Is this new information? Is this correct information? I dunno, but works for me!