Closed Draco18s closed 5 years ago
Thanks for your continued help.
Doing what I can. Though I'm having to spend some time figuring out how the vanilla Structure
system works (mineshafts, villages, etc) before I can resolve the issues with the distribution objects. They were heavily tied into using a world
object which they no longer have a reference to (outside of one function, which so far I haven't managed to have called); like there's a whole chunk of vanilla code I can't find. I suspect that the structure blocks you can get with commands (and which appear in the workspace as data/structure nbt files) play a part, but Mineshafts don't have those.
I made some notes in a comment block at the top of WorldGenSubstitution
. I'm out of town right now but it sounds like there is a place()
method that a structure overrides. That must receive the necessary information to place the blocks.
I saw that comment, didn't think to check vanilla logic for what it does. There's still a lot of research before I can work out how to replicate the old functionality.
Edit:
That lead to some interesting places, the existing place
call invokes generateStructure
which uses a synchronized block to place pieces.
E2: Ah, no, place
is called for Features, not Structures. Or at least, I can get it to be called when I use addFeature
to a biome, but not when I use addStructure
. Using addStructure
I can't get anything with a world
parameter to get called, but I think I've narrowed it down to worldIn.getChunk(chunkpos.x, chunkpos.z).getStructureStart(this.getStructureName());
returning null (as to why, I'm not sure yet).
(And oh yeah, enjoy your trip)
(You probably didn't catch my edits, as you likely just saw the email notification; its mostly just stream of consciousness in my experimentation. Enjoy your trip and you can leave your thoughts when you get back)
Figured it out the problem I was having. Things need to be registered as both a structure and a feature to generate properly. Still not sure how to handle COG's stuff in the manner that vanilla has things set up (each structure has a "start" and keeps generating "pieces" until it stops (init
), each chunk then gets to figure out which pieces it needs to place in its own chunk (via place
) at a later time, calling generateStructure
when a piece needs to get placed (more or less? its hard to follow)).
The Structure
code only deals with mapping out which pieces to spawn where, later the Feature
code kicks in and actually places blocks.
https://github.com/Draco18s/ReasonableRealism/commit/859daa1f7c6ff1b4fc49539c915aff913de57b25
And some more understanding of how things work https://github.com/Draco18s/ReasonableRealism/commit/033da26f8ba4bcd25b0911aa9775764f12d7dbbe
Mainly the IStructureType helps hold references to parts (same as Blocks and Items), not a Forge registry and has a public register
method. Not strictly required, but probably helps. The int that has no good parameter name in the parts' constructor (p_i50452_2_
) is just a recursion depth counter, more than anything as far as I can tell.
buildComponent
definitely deals with figuring out which parts go where and addComponentParts
places blocks. Vanilla uses nbt structure files for the majority of block placement and uses addComponentParts
for decoration (spider webs around spawners, which can extend to other parts of the structure, etc), but utilizing it for all block placement seems to work fine.
Have you made any progress on this to share? I'm carving out some time to work on this, but I want to avoid duplicating effort.
Not much. I've got a sense of how the structure code works vanilla side (the above comments), but haven't had time to poke at the COG side. I'm headed to a convention this weekend, so I'll be out for a few days. I have a feeling that we might want to collaborate in a real-time space at least once in a while, but I understand that that could be difficult (scheduling, etc).
Still large swathes of errors, but this fixes up some things that got renamed that were still unfixed.