Fixing bugs with island gen
This commit is contained in:
parent
75f50a80a4
commit
e35847726a
|
@ -198,7 +198,7 @@ public class ModBiomes implements BOPBiomes.IBiomeRegistry
|
|||
public static Map<Integer, List<Integer>> subBiomesMap;
|
||||
public static Map<Integer, List<Integer>> mutatedBiomesMap;
|
||||
|
||||
public static ArrayList<WeightedBiomeEntry> islandBiomesList = new ArrayList<WeightedBiomeEntry>();
|
||||
public static Map<Integer, Integer> islandBiomesMap = new HashMap<Integer, Integer>();
|
||||
public static int totalIslandBiomesWeight;
|
||||
|
||||
public static void init()
|
||||
|
@ -396,7 +396,6 @@ public class ModBiomes implements BOPBiomes.IBiomeRegistry
|
|||
canyon_ravine = registerBOPBiome(new BiomeGenCanyon(BiomeGenCanyon.CanyonType.RAVINE), "Canyon Ravine");
|
||||
coral_reef = registerBOPBiome(new BiomeGenCoralReef(), "Coral Reef");
|
||||
kelp_forest = registerBOPBiome(new BiomeGenKelpForest(), "Kelp Forest");
|
||||
tropical_island = registerBOPBiome(new BiomeGenTropicalIsland(), "Tropical Island");
|
||||
|
||||
setSubBiome(canyon, canyon_ravine);
|
||||
setSubBiome(Optional.of(BiomeGenBase.ocean), BOPBiomes.coral_reef);
|
||||
|
@ -404,6 +403,9 @@ public class ModBiomes implements BOPBiomes.IBiomeRegistry
|
|||
|
||||
// island biomes
|
||||
|
||||
tropical_island = registerBOPBiome(new BiomeGenTropicalIsland(), "Tropical Island");
|
||||
|
||||
addIslandBiome(tropical_island, 10);
|
||||
}
|
||||
|
||||
private static void registerBiomeDictionaryTags()
|
||||
|
@ -574,10 +576,13 @@ public class ModBiomes implements BOPBiomes.IBiomeRegistry
|
|||
}
|
||||
}
|
||||
|
||||
private static void addIslandBiome(BiomeGenBase biome, int weight)
|
||||
private static void addIslandBiome(Optional<BiomeGenBase> biome, int weight)
|
||||
{
|
||||
totalIslandBiomesWeight += weight;
|
||||
islandBiomesList.add(new WeightedBiomeEntry(weight, biome));
|
||||
if (biome.isPresent())
|
||||
{
|
||||
totalIslandBiomesWeight += weight;
|
||||
islandBiomesMap.put(biome.get().biomeID, weight);
|
||||
}
|
||||
}
|
||||
|
||||
private static void configureBiome(IExtendedBiome biome, String idName)
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.world.gen.layer.GenLayer;
|
|||
import net.minecraft.world.gen.layer.IntCache;
|
||||
import net.minecraftforge.common.BiomeManager.BiomeType;
|
||||
import biomesoplenty.common.enums.BOPClimates;
|
||||
import biomesoplenty.common.init.ModBiomes;
|
||||
import biomesoplenty.common.world.BOPWorldSettings;
|
||||
|
||||
public class GenLayerBiomeBOP extends BOPGenLayer
|
||||
|
@ -55,10 +56,10 @@ public class GenLayerBiomeBOP extends BOPGenLayer
|
|||
{
|
||||
out[index] = climate.getRandomOceanBiome(this, true).biomeID;
|
||||
}
|
||||
else if (landSeaVal == BiomeGenBase.mushroomIsland.biomeID && climate.biomeType != BiomeType.ICY)
|
||||
else if ((landSeaVal == BiomeGenBase.mushroomIsland.biomeID || ModBiomes.islandBiomesMap.containsKey(landSeaVal)) && climate.biomeType != BiomeType.ICY)
|
||||
{
|
||||
// keep mushroom islands, unless it's in an icy climate in which case, replace
|
||||
out[index] = BiomeGenBase.mushroomIsland.biomeID;
|
||||
// keep islands, unless it's in an icy climate in which case, replace
|
||||
out[index] = landSeaVal;
|
||||
}
|
||||
else if (landSeaVal == 0)
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
package biomesoplenty.common.world.layer;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import biomesoplenty.common.enums.BOPClimates.WeightedBiomeEntry;
|
||||
import biomesoplenty.common.init.ModBiomes;
|
||||
|
@ -42,7 +43,7 @@ public class GenLayerLargeIsland extends BOPGenLayer
|
|||
|
||||
this.initChunkSeed((long)(x + areaX), (long)(z + areaY));
|
||||
|
||||
if (centerVal == 0 && northWestVal == 0 && northEastVal == 0 && southWestVal == 0 && southEastVal == 0 && this.nextInt(50) == 0)
|
||||
if (centerVal == 0 && northWestVal == 0 && northEastVal == 0 && southWestVal == 0 && southEastVal == 0 && this.nextInt(75) == 0)
|
||||
{
|
||||
out[x + z * areaWidth] = getRandomIslandBiome();
|
||||
}
|
||||
|
@ -59,14 +60,15 @@ public class GenLayerLargeIsland extends BOPGenLayer
|
|||
public int getRandomIslandBiome()
|
||||
{
|
||||
int weight = this.nextInt(ModBiomes.totalIslandBiomesWeight);
|
||||
Iterator<WeightedBiomeEntry> iterator = ModBiomes.islandBiomesList.iterator();
|
||||
WeightedBiomeEntry item;
|
||||
Iterator<Entry<Integer, Integer>> iterator = ModBiomes.islandBiomesMap.entrySet().iterator();
|
||||
|
||||
Entry<Integer, Integer> item;
|
||||
do
|
||||
{
|
||||
item = iterator.next();
|
||||
weight -= item.weight;
|
||||
weight -= item.getValue();
|
||||
}
|
||||
while (weight >= 0);
|
||||
return item.biome.biomeID;
|
||||
return item.getKey();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue