Merge pull request #1034 from Adubbz/master
Greatly simplified the addition of new biomes to the default world. If this breaks things blame Adubbz.
This commit is contained in:
commit
f3cbc6c262
3 changed files with 174 additions and 1 deletions
|
@ -30,7 +30,39 @@
|
||||||
GenLayer genlayer1 = GenLayerZoom.func_75915_a(1000L, genlayerriverinit, 2);
|
GenLayer genlayer1 = GenLayerZoom.func_75915_a(1000L, genlayerriverinit, 2);
|
||||||
GenLayerHills genlayerhills = new GenLayerHills(1000L, (GenLayer)object, genlayer1);
|
GenLayerHills genlayerhills = new GenLayerHills(1000L, (GenLayer)object, genlayer1);
|
||||||
genlayer = GenLayerZoom.func_75915_a(1000L, genlayerriverinit, 2);
|
genlayer = GenLayerZoom.func_75915_a(1000L, genlayerriverinit, 2);
|
||||||
@@ -204,4 +202,11 @@
|
@@ -145,6 +143,22 @@
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* ======================================== FORGE START =====================================*/
|
||||||
|
+ protected long nextLong(long par1)
|
||||||
|
+ {
|
||||||
|
+ long j = (this.field_75908_c >> 24) % par1;
|
||||||
|
+
|
||||||
|
+ if (j < 0)
|
||||||
|
+ {
|
||||||
|
+ j += par1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ this.field_75908_c *= this.field_75908_c * 6364136223846793005L + 1442695040888963407L;
|
||||||
|
+ this.field_75908_c += this.field_75907_b;
|
||||||
|
+ return j;
|
||||||
|
+ }
|
||||||
|
+ /* ========================================= FORGE END ======================================*/
|
||||||
|
+
|
||||||
|
public abstract int[] func_75904_a(int var1, int var2, int var3, int var4);
|
||||||
|
|
||||||
|
protected static boolean func_151616_a(final int p_151616_0_, final int p_151616_1_)
|
||||||
|
@@ -192,7 +206,7 @@
|
||||||
|
|
||||||
|
protected static boolean func_151618_b(int p_151618_0_)
|
||||||
|
{
|
||||||
|
- return p_151618_0_ == BiomeGenBase.field_76771_b.field_76756_M || p_151618_0_ == BiomeGenBase.field_150575_M.field_76756_M || p_151618_0_ == BiomeGenBase.field_76776_l.field_76756_M;
|
||||||
|
+ return BiomeManager.oceanBiomes.contains(BiomeGenBase.func_150568_d(p_151618_0_));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int func_151619_a(int ... p_151619_1_)
|
||||||
|
@@ -204,4 +218,11 @@
|
||||||
{
|
{
|
||||||
return p_151617_2_ == p_151617_3_ && p_151617_3_ == p_151617_4_ ? p_151617_2_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_3_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_3_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_2_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_4_ && p_151617_2_ != p_151617_3_ ? p_151617_1_ : (p_151617_2_ == p_151617_3_ && p_151617_1_ != p_151617_4_ ? p_151617_2_ : (p_151617_2_ == p_151617_4_ && p_151617_1_ != p_151617_3_ ? p_151617_2_ : (p_151617_3_ == p_151617_4_ && p_151617_1_ != p_151617_2_ ? p_151617_3_ : this.func_151619_a(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_}))))))))));
|
return p_151617_2_ == p_151617_3_ && p_151617_3_ == p_151617_4_ ? p_151617_2_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_3_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_3_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_2_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_4_ && p_151617_2_ != p_151617_3_ ? p_151617_1_ : (p_151617_2_ == p_151617_3_ && p_151617_1_ != p_151617_4_ ? p_151617_2_ : (p_151617_2_ == p_151617_4_ && p_151617_1_ != p_151617_3_ ? p_151617_2_ : (p_151617_3_ == p_151617_4_ && p_151617_1_ != p_151617_2_ ? p_151617_3_ : this.func_151619_a(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_}))))))))));
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
--- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java
|
||||||
|
+++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java
|
||||||
|
@@ -1,29 +1,49 @@
|
||||||
|
package net.minecraft.world.gen.layer;
|
||||||
|
|
||||||
|
+import java.util.ArrayList;
|
||||||
|
+import java.util.List;
|
||||||
|
+
|
||||||
|
+import net.minecraft.util.WeightedRandom;
|
||||||
|
import net.minecraft.world.WorldType;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
+import net.minecraftforge.common.BiomeManager;
|
||||||
|
+import net.minecraftforge.common.BiomeManager.BiomeEntry;
|
||||||
|
|
||||||
|
public class GenLayerBiome extends GenLayer
|
||||||
|
{
|
||||||
|
- private BiomeGenBase[] field_151623_c;
|
||||||
|
- private BiomeGenBase[] field_151621_d;
|
||||||
|
- private BiomeGenBase[] field_151622_e;
|
||||||
|
- private BiomeGenBase[] field_151620_f;
|
||||||
|
+ private List<BiomeEntry> desertBiomes = new ArrayList<BiomeEntry>();
|
||||||
|
+ private List<BiomeEntry> warmBiomes = new ArrayList<BiomeEntry>();
|
||||||
|
+ private List<BiomeEntry> coolBiomes = new ArrayList<BiomeEntry>();
|
||||||
|
+ private List<BiomeEntry> icyBiomes = new ArrayList<BiomeEntry>();
|
||||||
|
+
|
||||||
|
private static final String __OBFID = "CL_00000555";
|
||||||
|
|
||||||
|
public GenLayerBiome(long p_i2122_1_, GenLayer p_i2122_3_, WorldType p_i2122_4_)
|
||||||
|
{
|
||||||
|
super(p_i2122_1_);
|
||||||
|
- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.field_76769_d, BiomeGenBase.field_76769_d, BiomeGenBase.field_76769_d, BiomeGenBase.field_150588_X, BiomeGenBase.field_150588_X, BiomeGenBase.field_76772_c};
|
||||||
|
- this.field_151621_d = new BiomeGenBase[] {BiomeGenBase.field_76767_f, BiomeGenBase.field_150585_R, BiomeGenBase.field_76770_e, BiomeGenBase.field_76772_c, BiomeGenBase.field_150583_P, BiomeGenBase.field_76780_h};
|
||||||
|
- this.field_151622_e = new BiomeGenBase[] {BiomeGenBase.field_76767_f, BiomeGenBase.field_76770_e, BiomeGenBase.field_76768_g, BiomeGenBase.field_76772_c};
|
||||||
|
- this.field_151620_f = new BiomeGenBase[] {BiomeGenBase.field_76774_n, BiomeGenBase.field_76774_n, BiomeGenBase.field_76774_n, BiomeGenBase.field_150584_S};
|
||||||
|
+
|
||||||
|
this.field_75909_a = p_i2122_3_;
|
||||||
|
-
|
||||||
|
+
|
||||||
|
+ this.desertBiomes.addAll(BiomeManager.desertBiomes);
|
||||||
|
+ this.warmBiomes.addAll(BiomeManager.warmBiomes);
|
||||||
|
+ this.coolBiomes.addAll(BiomeManager.coolBiomes);
|
||||||
|
+ this.icyBiomes.addAll(BiomeManager.icyBiomes);
|
||||||
|
+
|
||||||
|
if (p_i2122_4_ == WorldType.field_77136_e)
|
||||||
|
{
|
||||||
|
- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.field_76769_d, BiomeGenBase.field_76767_f, BiomeGenBase.field_76770_e, BiomeGenBase.field_76780_h, BiomeGenBase.field_76772_c, BiomeGenBase.field_76768_g};
|
||||||
|
+ desertBiomes.add(new BiomeEntry(BiomeGenBase.field_76769_d, 10));
|
||||||
|
+ desertBiomes.add(new BiomeEntry(BiomeGenBase.field_76767_f, 10));
|
||||||
|
+ desertBiomes.add(new BiomeEntry(BiomeGenBase.field_76770_e, 10));
|
||||||
|
+ desertBiomes.add(new BiomeEntry(BiomeGenBase.field_76780_h, 10));
|
||||||
|
+ desertBiomes.add(new BiomeEntry(BiomeGenBase.field_76772_c, 10));
|
||||||
|
+ desertBiomes.add(new BiomeEntry(BiomeGenBase.field_76768_g, 10));
|
||||||
|
}
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ desertBiomes.add(new BiomeEntry(BiomeGenBase.field_76769_d, 30));
|
||||||
|
+ desertBiomes.add(new BiomeEntry(BiomeGenBase.field_150588_X, 20));
|
||||||
|
+ desertBiomes.add(new BiomeEntry(BiomeGenBase.field_76772_c, 10));
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] func_75904_a(int p_75904_1_, int p_75904_2_, int p_75904_3_, int p_75904_4_)
|
||||||
|
@@ -63,7 +83,7 @@
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- aint1[j1 + i1 * p_75904_3_] = this.field_151623_c[this.func_75902_a(this.field_151623_c.length)].field_76756_M;
|
||||||
|
+ aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.desertBiomes, (int)(this.nextLong(WeightedRandom.func_76272_a(this.desertBiomes) / 10) * 10))).biome.field_76756_M;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (k1 == 2)
|
||||||
|
@@ -74,7 +94,7 @@
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- aint1[j1 + i1 * p_75904_3_] = this.field_151621_d[this.func_75902_a(this.field_151621_d.length)].field_76756_M;
|
||||||
|
+ aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.warmBiomes, (int)(this.nextLong(WeightedRandom.func_76272_a(this.warmBiomes) / 10) * 10))).biome.field_76756_M;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (k1 == 3)
|
||||||
|
@@ -85,12 +105,12 @@
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- aint1[j1 + i1 * p_75904_3_] = this.field_151622_e[this.func_75902_a(this.field_151622_e.length)].field_76756_M;
|
||||||
|
+ aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.coolBiomes, (int)(this.nextLong(WeightedRandom.func_76272_a(this.coolBiomes) / 10) * 10))).biome.field_76756_M;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (k1 == 4)
|
||||||
|
{
|
||||||
|
- aint1[j1 + i1 * p_75904_3_] = this.field_151620_f[this.func_75902_a(this.field_151620_f.length)].field_76756_M;
|
||||||
|
+ aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.icyBiomes, (int)(this.nextLong(WeightedRandom.func_76272_a(this.icyBiomes) / 10) * 10))).biome.field_76756_M;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
|
@ -1,16 +1,50 @@
|
||||||
package net.minecraftforge.common;
|
package net.minecraftforge.common;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.util.WeightedRandom;
|
||||||
|
import net.minecraft.world.WorldType;
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
import net.minecraft.world.gen.structure.MapGenVillage;
|
import net.minecraft.world.gen.structure.MapGenVillage;
|
||||||
import net.minecraft.world.biome.WorldChunkManager;
|
import net.minecraft.world.biome.WorldChunkManager;
|
||||||
|
|
||||||
public class BiomeManager
|
public class BiomeManager
|
||||||
{
|
{
|
||||||
|
public static List<BiomeEntry> desertBiomes = new ArrayList<BiomeEntry>();
|
||||||
|
public static List<BiomeEntry> warmBiomes = new ArrayList<BiomeEntry>();
|
||||||
|
public static List<BiomeEntry> coolBiomes = new ArrayList<BiomeEntry>();
|
||||||
|
public static List<BiomeEntry> icyBiomes = new ArrayList<BiomeEntry>();
|
||||||
|
|
||||||
|
public static List<BiomeGenBase> oceanBiomes = new ArrayList<BiomeGenBase>();
|
||||||
|
|
||||||
public static ArrayList<BiomeGenBase> strongHoldBiomes = new ArrayList<BiomeGenBase>();
|
public static ArrayList<BiomeGenBase> strongHoldBiomes = new ArrayList<BiomeGenBase>();
|
||||||
public static ArrayList<BiomeGenBase> strongHoldBiomesBlackList = new ArrayList<BiomeGenBase>();
|
public static ArrayList<BiomeGenBase> strongHoldBiomesBlackList = new ArrayList<BiomeGenBase>();
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
warmBiomes.add(new BiomeEntry(BiomeGenBase.forest, 10));
|
||||||
|
warmBiomes.add(new BiomeEntry(BiomeGenBase.roofedForest, 10));
|
||||||
|
warmBiomes.add(new BiomeEntry(BiomeGenBase.extremeHills, 10));
|
||||||
|
warmBiomes.add(new BiomeEntry(BiomeGenBase.plains, 10));
|
||||||
|
warmBiomes.add(new BiomeEntry(BiomeGenBase.birchForest, 10));
|
||||||
|
warmBiomes.add(new BiomeEntry(BiomeGenBase.swampland, 10));
|
||||||
|
|
||||||
|
coolBiomes.add(new BiomeEntry(BiomeGenBase.forest, 10));
|
||||||
|
coolBiomes.add(new BiomeEntry(BiomeGenBase.extremeHills, 10));
|
||||||
|
coolBiomes.add(new BiomeEntry(BiomeGenBase.taiga, 10));
|
||||||
|
coolBiomes.add(new BiomeEntry(BiomeGenBase.plains, 10));
|
||||||
|
|
||||||
|
icyBiomes.add(new BiomeEntry(BiomeGenBase.icePlains, 30));
|
||||||
|
icyBiomes.add(new BiomeEntry(BiomeGenBase.coldTaiga, 10));
|
||||||
|
|
||||||
|
oceanBiomes.add(BiomeGenBase.ocean);
|
||||||
|
oceanBiomes.add(BiomeGenBase.deepOcean);
|
||||||
|
oceanBiomes.add(BiomeGenBase.frozenOcean);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static void addVillageBiome(BiomeGenBase biome, boolean canSpawn)
|
public static void addVillageBiome(BiomeGenBase biome, boolean canSpawn)
|
||||||
{
|
{
|
||||||
|
@ -64,4 +98,16 @@ public class BiomeManager
|
||||||
WorldChunkManager.allowedBiomes.remove(biome);
|
WorldChunkManager.allowedBiomes.remove(biome);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class BiomeEntry extends WeightedRandom.Item
|
||||||
|
{
|
||||||
|
public final BiomeGenBase biome;
|
||||||
|
|
||||||
|
public BiomeEntry(BiomeGenBase biome, int weight)
|
||||||
|
{
|
||||||
|
super(weight);
|
||||||
|
|
||||||
|
this.biome = biome;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue