mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 07:19:56 +03:00
94 lines
5.5 KiB
Diff
94 lines
5.5 KiB
Diff
--- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java
|
|
+++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java
|
|
@@ -7,10 +7,8 @@
|
|
|
|
public class GenLayerBiome extends GenLayer
|
|
{
|
|
- private Biome[] warmBiomes = new Biome[] {Biomes.DESERT, Biomes.DESERT, Biomes.DESERT, Biomes.SAVANNA, Biomes.SAVANNA, Biomes.PLAINS};
|
|
- private final Biome[] mediumBiomes = new Biome[] {Biomes.FOREST, Biomes.ROOFED_FOREST, Biomes.EXTREME_HILLS, Biomes.PLAINS, Biomes.BIRCH_FOREST, Biomes.SWAMPLAND};
|
|
- private final Biome[] coldBiomes = new Biome[] {Biomes.FOREST, Biomes.EXTREME_HILLS, Biomes.TAIGA, Biomes.PLAINS};
|
|
- private final Biome[] iceBiomes = new Biome[] {Biomes.ICE_PLAINS, Biomes.ICE_PLAINS, Biomes.ICE_PLAINS, Biomes.COLD_TAIGA};
|
|
+ @SuppressWarnings("unchecked")
|
|
+ private java.util.List<net.minecraftforge.common.BiomeManager.BiomeEntry>[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length];
|
|
private final ChunkGeneratorSettings settings;
|
|
|
|
public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, ChunkGeneratorSettings p_i45560_5_)
|
|
@@ -18,9 +16,30 @@
|
|
super(p_i45560_1_);
|
|
this.parent = p_i45560_3_;
|
|
|
|
+ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values())
|
|
+ {
|
|
+ com.google.common.collect.ImmutableList<net.minecraftforge.common.BiomeManager.BiomeEntry> biomesToAdd = net.minecraftforge.common.BiomeManager.getBiomes(type);
|
|
+ int idx = type.ordinal();
|
|
+
|
|
+ if (biomes[idx] == null) biomes[idx] = new java.util.ArrayList<net.minecraftforge.common.BiomeManager.BiomeEntry>();
|
|
+ if (biomesToAdd != null) biomes[idx].addAll(biomesToAdd);
|
|
+ }
|
|
+
|
|
+ int desertIdx = net.minecraftforge.common.BiomeManager.BiomeType.DESERT.ordinal();
|
|
+
|
|
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.DESERT, 30));
|
|
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.SAVANNA, 20));
|
|
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.PLAINS, 10));
|
|
+
|
|
if (p_i45560_4_ == WorldType.DEFAULT_1_1)
|
|
{
|
|
- this.warmBiomes = new Biome[] {Biomes.DESERT, Biomes.FOREST, Biomes.EXTREME_HILLS, Biomes.SWAMPLAND, Biomes.PLAINS, Biomes.TAIGA};
|
|
+ biomes[desertIdx].clear();
|
|
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.DESERT, 10));
|
|
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.FOREST, 10));
|
|
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.EXTREME_HILLS, 10));
|
|
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.SWAMPLAND, 10));
|
|
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.PLAINS, 10));
|
|
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.TAIGA, 10));
|
|
this.settings = null;
|
|
}
|
|
else
|
|
@@ -70,7 +89,7 @@
|
|
}
|
|
else
|
|
{
|
|
- aint1[j + i * areaWidth] = Biome.getIdForBiome(this.warmBiomes[this.nextInt(this.warmBiomes.length)]);
|
|
+ aint1[j + i * areaWidth] = Biome.getIdForBiome(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome);
|
|
}
|
|
}
|
|
else if (k == 2)
|
|
@@ -81,7 +100,7 @@
|
|
}
|
|
else
|
|
{
|
|
- aint1[j + i * areaWidth] = Biome.getIdForBiome(this.mediumBiomes[this.nextInt(this.mediumBiomes.length)]);
|
|
+ aint1[j + i * areaWidth] = Biome.getIdForBiome(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM).biome);
|
|
}
|
|
}
|
|
else if (k == 3)
|
|
@@ -92,12 +111,12 @@
|
|
}
|
|
else
|
|
{
|
|
- aint1[j + i * areaWidth] = Biome.getIdForBiome(this.coldBiomes[this.nextInt(this.coldBiomes.length)]);
|
|
+ aint1[j + i * areaWidth] = Biome.getIdForBiome(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL).biome);
|
|
}
|
|
}
|
|
else if (k == 4)
|
|
{
|
|
- aint1[j + i * areaWidth] = Biome.getIdForBiome(this.iceBiomes[this.nextInt(this.iceBiomes.length)]);
|
|
+ aint1[j + i * areaWidth] = Biome.getIdForBiome(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY).biome);
|
|
}
|
|
else
|
|
{
|
|
@@ -108,4 +127,12 @@
|
|
|
|
return aint1;
|
|
}
|
|
+
|
|
+ protected net.minecraftforge.common.BiomeManager.BiomeEntry getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType type)
|
|
+ {
|
|
+ java.util.List<net.minecraftforge.common.BiomeManager.BiomeEntry> biomeList = biomes[type.ordinal()];
|
|
+ int totalWeight = net.minecraft.util.WeightedRandom.getTotalWeight(biomeList);
|
|
+ int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type)?nextInt(totalWeight):nextInt(totalWeight / 10) * 10;
|
|
+ return (net.minecraftforge.common.BiomeManager.BiomeEntry)net.minecraft.util.WeightedRandom.getRandomItem(biomeList, weight);
|
|
+ }
|
|
}
|