2013-05-03 13:00:44 +00:00
|
|
|
package biomesoplenty.worldgen.structure;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.Random;
|
2013-05-29 01:05:27 +00:00
|
|
|
|
2013-05-03 13:00:44 +00:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
import net.minecraft.world.gen.structure.ComponentVillageRoadPiece;
|
|
|
|
import net.minecraft.world.gen.structure.ComponentVillageStartPiece;
|
|
|
|
import net.minecraft.world.gen.structure.StructureComponent;
|
|
|
|
import net.minecraft.world.gen.structure.StructureStart;
|
|
|
|
import net.minecraft.world.gen.structure.StructureVillagePieces;
|
|
|
|
|
|
|
|
class BOPStructureVillageStart extends StructureStart
|
|
|
|
{
|
2013-05-31 10:34:02 +00:00
|
|
|
/** well ... thats what it does */
|
|
|
|
private boolean hasMoreThanTwoComponents = false;
|
2013-05-03 13:00:44 +00:00
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
public BOPStructureVillageStart(World par1World, Random par2Random, int par3, int par4, int par5)
|
|
|
|
{
|
|
|
|
ArrayList arraylist = StructureVillagePieces.getStructureVillageWeightedPieceList(par2Random, par5);
|
|
|
|
ComponentVillageStartPiece componentvillagestartpiece = new ComponentVillageStartPiece(par1World.getWorldChunkManager(), 0, par2Random, (par3 << 4) + 2, (par4 << 4) + 2, arraylist, par5);
|
|
|
|
components.add(componentvillagestartpiece);
|
|
|
|
componentvillagestartpiece.buildComponent(componentvillagestartpiece, components, par2Random);
|
|
|
|
ArrayList arraylist1 = componentvillagestartpiece.field_74930_j;
|
|
|
|
ArrayList arraylist2 = componentvillagestartpiece.field_74932_i;
|
|
|
|
int l;
|
2013-05-03 13:00:44 +00:00
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
while (!arraylist1.isEmpty() || !arraylist2.isEmpty())
|
|
|
|
{
|
|
|
|
StructureComponent structurecomponent;
|
2013-05-03 13:00:44 +00:00
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
if (arraylist1.isEmpty())
|
|
|
|
{
|
|
|
|
l = par2Random.nextInt(arraylist2.size());
|
|
|
|
structurecomponent = (StructureComponent)arraylist2.remove(l);
|
|
|
|
structurecomponent.buildComponent(componentvillagestartpiece, components, par2Random);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
l = par2Random.nextInt(arraylist1.size());
|
|
|
|
structurecomponent = (StructureComponent)arraylist1.remove(l);
|
|
|
|
structurecomponent.buildComponent(componentvillagestartpiece, components, par2Random);
|
|
|
|
}
|
|
|
|
}
|
2013-05-03 13:00:44 +00:00
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
this.updateBoundingBox();
|
|
|
|
l = 0;
|
|
|
|
Iterator iterator = components.iterator();
|
2013-05-03 13:00:44 +00:00
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
while (iterator.hasNext())
|
|
|
|
{
|
|
|
|
StructureComponent structurecomponent1 = (StructureComponent)iterator.next();
|
2013-05-03 13:00:44 +00:00
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
if (!(structurecomponent1 instanceof ComponentVillageRoadPiece))
|
|
|
|
{
|
|
|
|
++l;
|
|
|
|
}
|
|
|
|
}
|
2013-05-03 13:00:44 +00:00
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
hasMoreThanTwoComponents = l > 2;
|
|
|
|
}
|
2013-05-03 13:00:44 +00:00
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
/**
|
|
|
|
* currently only defined for Villages, returns true if Village has more than 2 non-road components
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public boolean isSizeableStructure()
|
|
|
|
{
|
|
|
|
return hasMoreThanTwoComponents;
|
|
|
|
}
|
2013-05-03 13:00:44 +00:00
|
|
|
}
|