aesefficio / DynamicVillageMod

Bring life and activity to your Create worlds.
MIT License
4 stars 4 forks source link

Train station nbt is too large and Miner nbt is too low #10

Closed TelepathicGrunt closed 8 months ago

TelepathicGrunt commented 10 months ago

The way the village house pieces knows they can spawn is if their x/z size stays within the boundaries of a village road's x/z bounds. That's why village roads reserve a space to their sides to spawn the houses. You can view village generation here to see what I mean: https://jigsaw.jacobsjo.eu/

Generally, jigsaw pieces can only spawn child pieces if the child piece is entirely within or entirely outside the bounding box of the parent piece. (With villages, they have a hack activated to temporarily stretch the road's height to enclose the the top of the child piece. For our purposes, the x/z bounds and minimum y bounds of roads is what is important when adding houses to villages) image

The issue here is the train station is 26 blocks long and no village road is large enough to hold it in vanilla. The solution is to not inject the train station nbt into the house pool. Instead, create a giant road nbt file that reserves enough space for the train station. Have this road target a special template pool file for just the train station alone. Inject that road with a low weight into vanilla's road template pool. Now when your road is picked, it reserves a large enough space and will spawn the trains station without issue.

A similar issue faces the mining camp nbt too. This nbt is too low so it cuts down below the road's bounding box which makes the game not spawn the nbt as far as I know. You can do a similar fix here with a road that does not reserve any bounds to the side. Like what is shown below. Meaning the road can spawn any size nbt no matter how large nor how low it goes. This would spawn the mining camp nbt properly (and can spawn train station too if wanting to reuse this for that) image

This will let you actually see your village pieces in villages and no longer need to inject the pieces with a high weight into the house pool anymore.

a0a7 commented 8 months ago

This issue was incredibly helpful to me and I really appreciate you sharing this information. Should be fixed in the newest release!