From ab451c95658b043aaaa10a45cc15d14559d55a2d Mon Sep 17 00:00:00 2001 From: Amnet Date: Sat, 21 Sep 2013 15:05:26 +0200 Subject: [PATCH] Fixing the crash with villages - hopefully. --- .../configuration/BOPStructures.java | 2 - .../worldgen/structure/BOPMapGenVillage.java | 3 +- .../BOPStructureScatteredFeatureStart.java | 2 + .../structure/BOPStructureVillageStart.java | 82 ------------------- 4 files changed, 4 insertions(+), 85 deletions(-) delete mode 100644 common/biomesoplenty/worldgen/structure/BOPStructureVillageStart.java diff --git a/common/biomesoplenty/configuration/BOPStructures.java b/common/biomesoplenty/configuration/BOPStructures.java index cd0add4fe..5b156c23c 100644 --- a/common/biomesoplenty/configuration/BOPStructures.java +++ b/common/biomesoplenty/configuration/BOPStructures.java @@ -2,13 +2,11 @@ package biomesoplenty.configuration; import net.minecraft.world.gen.structure.MapGenStructureIO; import biomesoplenty.worldgen.structure.BOPStructureScatteredFeatureStart; -import biomesoplenty.worldgen.structure.BOPStructureVillageStart; public class BOPStructures { public static void init() { - MapGenStructureIO.func_143034_b(BOPStructureVillageStart.class, "BOPVillage"); MapGenStructureIO.func_143034_b(BOPStructureScatteredFeatureStart.class, "BOPTemple"); } } diff --git a/common/biomesoplenty/worldgen/structure/BOPMapGenVillage.java b/common/biomesoplenty/worldgen/structure/BOPMapGenVillage.java index 1c548d14b..88602a426 100644 --- a/common/biomesoplenty/worldgen/structure/BOPMapGenVillage.java +++ b/common/biomesoplenty/worldgen/structure/BOPMapGenVillage.java @@ -12,6 +12,7 @@ import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.structure.MapGenStructure; import net.minecraft.world.gen.structure.MapGenVillage; import net.minecraft.world.gen.structure.StructureStart; +import net.minecraft.world.gen.structure.StructureVillageStart; import biomesoplenty.configuration.configfile.BOPConfigurationTerrainGen; public class BOPMapGenVillage extends MapGenStructure @@ -96,6 +97,6 @@ public class BOPMapGenVillage extends MapGenStructure @Override protected StructureStart getStructureStart(int par1, int par2) { - return new BOPStructureVillageStart(worldObj, rand, par1, par2, terrainType); + return new StructureVillageStart(worldObj, rand, par1, par2, terrainType); } } diff --git a/common/biomesoplenty/worldgen/structure/BOPStructureScatteredFeatureStart.java b/common/biomesoplenty/worldgen/structure/BOPStructureScatteredFeatureStart.java index d60da56f9..92424328b 100644 --- a/common/biomesoplenty/worldgen/structure/BOPStructureScatteredFeatureStart.java +++ b/common/biomesoplenty/worldgen/structure/BOPStructureScatteredFeatureStart.java @@ -12,6 +12,8 @@ import biomesoplenty.api.Biomes; public class BOPStructureScatteredFeatureStart extends StructureStart { + public BOPStructureScatteredFeatureStart() {} + public BOPStructureScatteredFeatureStart(World world, Random random, int x, int z) { BiomeGenBase biome = world.getBiomeGenForCoords(x * 16 + 8, z * 16 + 8); diff --git a/common/biomesoplenty/worldgen/structure/BOPStructureVillageStart.java b/common/biomesoplenty/worldgen/structure/BOPStructureVillageStart.java deleted file mode 100644 index f9f8726b5..000000000 --- a/common/biomesoplenty/worldgen/structure/BOPStructureVillageStart.java +++ /dev/null @@ -1,82 +0,0 @@ -package biomesoplenty.worldgen.structure; - -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -import net.minecraft.nbt.NBTTagCompound; -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; - -public class BOPStructureVillageStart extends StructureStart -{ - /** well ... thats what it does */ - private boolean hasMoreThanTwoComponents = false; - - public BOPStructureVillageStart(World par1World, Random par2Random, int par3, int par4, int par5) - { - List list = StructureVillagePieces.getStructureVillageWeightedPieceList(par2Random, par5); - ComponentVillageStartPiece componentvillagestartpiece = new ComponentVillageStartPiece(par1World.getWorldChunkManager(), 0, par2Random, (par3 << 4) + 2, (par4 << 4) + 2, list, par5); - components.add(componentvillagestartpiece); - componentvillagestartpiece.buildComponent(componentvillagestartpiece, components, par2Random); - List list1 = componentvillagestartpiece.field_74930_j; - List list2 = componentvillagestartpiece.field_74932_i; - int l; - - while (!list1.isEmpty() || !list2.isEmpty()) - { - StructureComponent structurecomponent; - - if (list1.isEmpty()) - { - l = par2Random.nextInt(list2.size()); - structurecomponent = (StructureComponent)list2.remove(l); - structurecomponent.buildComponent(componentvillagestartpiece, this.components, par2Random); - } - else - { - l = par2Random.nextInt(list1.size()); - structurecomponent = (StructureComponent)list1.remove(l); - structurecomponent.buildComponent(componentvillagestartpiece, this.components, par2Random); - } - } - - this.updateBoundingBox(); - l = 0; - Iterator iterator = components.iterator(); - - while (iterator.hasNext()) - { - StructureComponent structurecomponent1 = (StructureComponent)iterator.next(); - - if (!(structurecomponent1 instanceof ComponentVillageRoadPiece)) - { - ++l; - } - } - - hasMoreThanTwoComponents = l > 2; - } - - @Override - public boolean isSizeableStructure() - { - return hasMoreThanTwoComponents; - } - - public void func_143022_a(NBTTagCompound par1NBTTagCompound) - { - super.func_143022_a(par1NBTTagCompound); - par1NBTTagCompound.setBoolean("Valid", this.hasMoreThanTwoComponents); - } - - public void func_143017_b(NBTTagCompound nbttagcompound) - { - super.func_143017_b(nbttagcompound); - this.hasMoreThanTwoComponents = nbttagcompound.getBoolean("Valid"); - } -}