I will take a look through your code this night at work and see what I can find, but if its like the above solution it may not help as I am generating structures instantly and this all has to be done in the worldgenerator class, so there is not much I can do with out rewriting the code from scratch for this....
Thanks for the look into your code, however, as I said above I am using world gen for my structures not a component setup the way MC does it. Basically this is because this is essentially an instant structure type mod. Though the basic intentions for the mod was for map makers and those who just wish to spawn and create villages the way they want to and in some pattern they want to. And for each of the different types of villages I have, I wanted to spawn a villager for the structure type they fit to best. I have villagers spawning, just not the villager I want. So I guess what I am after is how to set this up to spawn the exact villager I want without having to code in the structures in the way MC does it as this confuses me.
Take a look at the setProfession function in villager. You're getting a basic villager because a profession isn't set in the constructor for villagers. You have to make a call to the function after the villagers created.
Edit: Well, I just looked at the code for spawning villagers in the village code, in there when it created a new villager it supposively ownly spawns default villagers
* Spawns a number of villagers in this component. Parameters: world, component bounding box, x offset, y offset, z
* offset, number of villagers
protected void spawnVillagers(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6)
if (this.villagersSpawned < par6)
for (int var7 = this.villagersSpawned; var7 < par6; ++var7)
int var8 = this.getXWithOffset(par3 + var7, par5);
int var9 = this.getYWithOffset(par4);
int var10 = this.getZWithOffset(par3 + var7, par5);
if (!par2StructureBoundingBox.isVecInside(var8, var9, var10))
EntityVillager var11 = new EntityVillager(par1World, this.getVillagerType(var7));
var11.setLocationAndAngles((double)var8 + 0.5D, (double)var9, (double)var10 + 0.5D, 0.0F, 0.0F);
* Returns the villager type to spawn in this component, based on the number of villagers already spawned.
protected int getVillagerType(int par1)
I figured getVillagerType would have been some sort of function determining which type of mob to spawn but apperantly they just return it to default. Thats probably why you get bad villager trades when you first find them.
im not quite sure how that will help. The get and set profession is set by datawatcher so I really dont think that will help at all. As I said this is all being done upon generation of the structure. I am also extending WorldGenerator, not making a component so, do you have an example on how to use the code you referenced, that may help.
There was some interesting work done by Lunatrius on a project called Schematica (github) where he was generating a sort of overlay world within the world. Might be of some use to you, as it uses a file format that some other tools also use.
I have villagers spawning, just not the villager I want. ...And for each of the different types of villages I have, I wanted to spawn a villager for the structure type they fit to best.
I haven't worked with worldgen extensions, so I'm not sure what all goes into that. But lots of mods add buildings, and those buildings have a public function ComponentVillageWhatever.getVillagerType(int) which returns an int specifying the type of villager. I haven't gone looking for a list of vanilla villager types, but mods that add villager types are gonna have custom VillageHandlerMyNewVillager classes for their new villager types.
Right, I got that much, but I am trying to spawn vanilla villagers, not custom. I actually looked into the VillageHandler and it wasnt of any real usefulness for me as most of the code there is for custom stuff. I will look into the other method though when I get home as I havent seen that one yet so it may help some. I hope I can get this because I am no good at recreating the components, I have tried and failed many times which is why I went this route where I just generate the structure from a block click or activation. If I can figure out which method works for me, I can always just modify the code I have now to suit. I would hate to have to abandon the idea all together. The link for schematica will help me some as well I hope as I am trying to find some way to generate the structures and also give the ability to rotate them to be placed they way the player wants. My aim is to make an instant structure mod unlike any other....