Hello fellow modders. I have been re working my old mod to do what I had originally intended and that is to naturally generate the new villages in the world. I have setup all the necessary classes and it works fine if I choose to only generate one village overriding the original mapgenvillage class. I have no issues with this to this end. However, I do not wish to only generate one new village type. In addition to the normal minecraft village, I would like several other village types to generate as well. I have not seen any other examples of this being done with exception of a WIP mod that uses an overly complicated way of doing this, its also not updated to 1.8 and is not very willing to help. SO I have tried several attempts at finding a solution to this and have come close but need some help to figure out why its only generating the well to each village and nothing more. If you look at the normal MapGenVillage class, you will see this in the start class section of the code....
public static class Start extends StructureStart
{
/** well ... thats what it does */
private boolean hasMoreThanTwoComponents;
private static final String __OBFID = "CL_00000515";
public Start() {}
public Start(World worldIn, Random p_i2092_2_, int p_i2092_3_, int p_i2092_4_, int p_i2092_5_)
{
super(p_i2092_3_, p_i2092_4_);
List list = StructureVillagePieces.getStructureVillageWeightedPieceList(p_i2092_2_, p_i2092_5_);
StructureVillagePieces.Start start = new StructureVillagePieces.Start(worldIn.getWorldChunkManager(), 0, p_i2092_2_, (p_i2092_3_ << 4) + 2, (p_i2092_4_ << 4) + 2, list, p_i2092_5_);
this.components.add(start);
start.buildComponent(start, this.components, p_i2092_2_);
List list1 = start.field_74930_j;
List list2 = start.field_74932_i;
int l;
while (!list1.isEmpty() || !list2.isEmpty())
{
StructureComponent structurecomponent;
if (list1.isEmpty())
{
l = p_i2092_2_.nextInt(list2.size());
structurecomponent = (StructureComponent)list2.remove(l);
structurecomponent.buildComponent(start, this.components, p_i2092_2_);
}
else
{
l = p_i2092_2_.nextInt(list1.size());
structurecomponent = (StructureComponent)list1.remove(l);
structurecomponent.buildComponent(start, this.components, p_i2092_2_);
}
}
this.updateBoundingBox();
l = 0;
Iterator iterator = this.components.iterator();
while (iterator.hasNext())
{
StructureComponent structurecomponent1 = (StructureComponent)iterator.next();
if (!(structurecomponent1 instanceof StructureVillagePieces.Road))
{
++l;
}
}
this.hasMoreThanTwoComponents = l > 2;
}
and looking at the MapGenScattered feature class you can see that each structure is based on biome as I wish to recreate for the village map gen I have got this to work as so located here on mygithub repo
Youll notice I had stopped at
this.components.add(start);
If I try, and no matter which way of adding
start.buildComponent(start, this.components, p_i2092_2_);
List list1 = start.field_74930_j;
List list2 = start.field_74932_i;
or adding a new method to handle the rest of the code or even pointing to an entirely new class it always ends in a crash. This is the crash and its the same every time no matter how I go about adding the code.
GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
Profiler Position: N/A (disabled)
Player Count: 0 / 8; []
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
Anyhow, Id really like some help. As I said the code on my github works, no crash, just stops generating the village at the well, I get not path or houses at all. Id really appreciate positive help, been stuck on this for a few days now.
Sorry in advance if I misunderstood what you want but I think you want a way to generate a new village type, independent from the vanilla villages?
I actually did something similar for my RPG mod I'm working on the other day.
Basically I just told the game to generate my type of village when it wants to generate a vanilla village, but this can be expanded to include multiple village types (Which Ill do myself eventually)
In your PreInit event you'll want something like this;
This registers your structure, the classes are just modified versions of the vanilla village classes
Next you need to actually generate the village, in an event handler under the TERRAIN_GEN_BUS, you'll need an InitMapGenEvent event, this is called when a structure is generated what I have is this:
@SubscribeEvent
public void InitMapGen(InitMapGenEvent event)
{
if(event.type.name() == event.type.VILLAGE.name())
{
event.newGen = new MapGenMYVILLAGE);
}
}
What it does is replace the generation of the vanilla village with my own, but can easily be modified to include vanilla villages and more like so:
@SubscribeEvent
public void initmapgen(InitMapGenEvent event)
{
Random random = new Random();
if(event.type.name() == event.type.VILLAGE.name())
{
switch(random.nextInt(3))
{
case 0:
event.newGen = new MapGenNPCVillage(); //First new village type
break;
case 1:
event.newGen = MapGenNPCVillage2(); //2nd village type
break;
default:
break; //vanilla village
}
}
}
You can probably modify which village is generated via biome as well.
I think that's what you're asking, if not well - there's a little tutorial on adding a new village.
You are correct, I am trying to a new village types to the generation. The first and second part of your response I had already done and worked just fine for loading one village only. However, I tried the third part, and while there was no crash, there were also no generated villages. Were you able to get this to work for your mod this way? Perhaps I am missing something. Thank you for your response I will keep trying.
Hello fellow modders. I have been re working my old mod to do what I had originally intended and that is to naturally generate the new villages in the world. I have setup all the necessary classes and it works fine if I choose to only generate one village overriding the original mapgenvillage class. I have no issues with this to this end. However, I do not wish to only generate one new village type. In addition to the normal minecraft village, I would like several other village types to generate as well. I have not seen any other examples of this being done with exception of a WIP mod that uses an overly complicated way of doing this, its also not updated to 1.8 and is not very willing to help. SO I have tried several attempts at finding a solution to this and have come close but need some help to figure out why its only generating the well to each village and nothing more. If you look at the normal MapGenVillage class, you will see this in the start class section of the code....
and looking at the MapGenScattered feature class you can see that each structure is based on biome as I wish to recreate for the village map gen I have got this to work as so located here on mygithub repo
Youll notice I had stopped at
If I try, and no matter which way of adding
or adding a new method to handle the rest of the code or even pointing to an entirely new class it always ends in a crash. This is the crash and its the same every time no matter how I go about adding the code.
Anyhow, Id really like some help. As I said the code on my github works, no crash, just stops generating the village at the well, I get not path or houses at all. Id really appreciate positive help, been stuck on this for a few days now.
Thanks in advance.....micro
Find out how I generate....coolAlias...world structure generation and rotation tool...
Sorry in advance if I misunderstood what you want but I think you want a way to generate a new village type, independent from the vanilla villages?
I actually did something similar for my RPG mod I'm working on the other day.
Basically I just told the game to generate my type of village when it wants to generate a vanilla village, but this can be expanded to include multiple village types (Which Ill do myself eventually)
In your PreInit event you'll want something like this;
This registers your structure, the classes are just modified versions of the vanilla village classes
Next you need to actually generate the village, in an event handler under the TERRAIN_GEN_BUS, you'll need an InitMapGenEvent event, this is called when a structure is generated what I have is this:
What it does is replace the generation of the vanilla village with my own, but can easily be modified to include vanilla villages and more like so:
You can probably modify which village is generated via biome as well.
I think that's what you're asking, if not well - there's a little tutorial on adding a new village.
You are correct, I am trying to a new village types to the generation. The first and second part of your response I had already done and worked just fine for loading one village only. However, I tried the third part, and while there was no crash, there were also no generated villages. Were you able to get this to work for your mod this way? Perhaps I am missing something. Thank you for your response I will keep trying.
Find out how I generate....coolAlias...world structure generation and rotation tool...
Thanks for trying to help, I solved the issue.
Find out how I generate....coolAlias...world structure generation and rotation tool...