Implement addBiome, hopefully. Pushes biome list to the WorldType field. Sorry Bioxx.

This commit is contained in:
Christian Weeks 2012-05-03 14:05:13 -04:00
parent db1f432dbf
commit 071d54feaf
5 changed files with 90 additions and 18 deletions

View file

@ -25,21 +25,19 @@
this.field_6033_f = new ServerConfigurationManager(this);
this.field_6028_k[0] = new EntityTracker(this, 0);
this.field_6028_k[1] = new EntityTracker(this, -1);
@@ -444,6 +448,8 @@
private void func_6018_h()
{
+ FMLServerHandler.instance().onPreTick();
+
long var1 = System.nanoTime();
ArrayList var3 = new ArrayList();
Iterator var4 = field_6037_b.keySet().iterator();
@@ -533,6 +539,8 @@
this.field_48076_G = Packet.field_48101_l;
this.field_48082_x[this.field_9014_h % 100] = Packet.field_48102_m - this.field_48077_H;
this.field_48077_H = Packet.field_48102_m;
+
+ FMLServerHandler.instance().onPostTick();
@@ -370,6 +374,7 @@
var7 = 0L;
}
public void func_6010_a(String p_6010_1_, ICommandListener p_6010_2_)
+ FMLServerHandler.instance().onPreTick();
var3 += var7;
var1 = var5;
@@ -386,6 +391,7 @@
this.func_6018_h();
}
}
+ FMLServerHandler.instance().onPostTick();
}
}
else

View file

@ -0,0 +1,17 @@
--- ../src-base/minecraft_server/net/minecraft/src/GenLayerBiome.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src-work/minecraft_server/net/minecraft/src/GenLayerBiome.java 0000-00-00 00:00:00.000000000 -0000
@@ -7,13 +7,8 @@
public GenLayerBiome(long p_i1078_1_, GenLayer p_i1078_3_, WorldType p_i1078_4_)
{
super(p_i1078_1_);
- this.field_35029_b = new BiomeGenBase[] {BiomeGenBase.field_4293_h, BiomeGenBase.field_4297_d, BiomeGenBase.field_35518_e, BiomeGenBase.field_4299_b, BiomeGenBase.field_35520_c, BiomeGenBase.field_4294_g, BiomeGenBase.field_48443_w};
+ this.field_35029_b = p_i1078_4_.getBiomesForWorldType();
this.field_35023_a = p_i1078_3_;
-
- if (p_i1078_4_ == WorldType.field_48456_d)
- {
- this.field_35029_b = new BiomeGenBase[] {BiomeGenBase.field_4293_h, BiomeGenBase.field_4297_d, BiomeGenBase.field_35518_e, BiomeGenBase.field_4299_b, BiomeGenBase.field_35520_c, BiomeGenBase.field_4294_g};
- }
}
public int[] func_35018_a(int p_35018_1_, int p_35018_2_, int p_35018_3_, int p_35018_4_)

View file

@ -0,0 +1,47 @@
--- ../src-base/minecraft_server/net/minecraft/src/WorldType.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src-work/minecraft_server/net/minecraft/src/WorldType.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,5 +1,8 @@
package net.minecraft.src;
+import java.util.Arrays;
+import java.util.List;
+
public class WorldType
{
public static final WorldType[] field_48459_a = new WorldType[16];
@@ -11,9 +14,20 @@
private boolean field_48455_g;
private boolean field_48460_h;
+ private BiomeGenBase[] biomesForWorldType;
+
private WorldType(int p_i1025_1_, String p_i1025_2_)
{
this(p_i1025_1_, p_i1025_2_, 0);
+ switch (p_i1025_1_) {
+ case 8:
+ biomesForWorldType = new BiomeGenBase[] { BiomeGenBase.field_4293_h, BiomeGenBase.field_4297_d, BiomeGenBase.field_35518_e,
+ BiomeGenBase.field_4299_b, BiomeGenBase.field_35520_c, BiomeGenBase.field_4294_g };
+ break;
+ default:
+ biomesForWorldType = new BiomeGenBase[] { BiomeGenBase.field_4293_h, BiomeGenBase.field_4297_d, BiomeGenBase.field_35518_e,
+ BiomeGenBase.field_4299_b, BiomeGenBase.field_35520_c, BiomeGenBase.field_4294_g, BiomeGenBase.field_48443_w };
+ }
}
private WorldType(int p_i1026_1_, String p_i1026_2_, int p_i1026_3_)
@@ -68,4 +82,14 @@
return null;
}
+
+ public BiomeGenBase[] getBiomesForWorldType() {
+ return biomesForWorldType;
+ }
+
+ public void addNewBiome(BiomeGenBase biome) {
+ List<BiomeGenBase> biomes=Arrays.asList(biomesForWorldType);
+ biomes.add(biome);
+ biomesForWorldType=biomes.toArray(new BiomeGenBase[0]);
+ }
}

View file

@ -36,6 +36,7 @@ import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.Packet3Chat;
import net.minecraft.src.ServerRegistry;
import net.minecraft.src.World;
import net.minecraft.src.WorldType;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.IFMLSidedHandler;
import cpw.mods.fml.common.Loader;
@ -537,4 +538,12 @@ public class FMLServerHandler implements IFMLSidedHandler
}
}
}
/**
* @param biome
*/
public void addBiomeToDefaultWorldGenerator(BiomeGenBase biome)
{
WorldType.field_48457_b.addNewBiome(biome);
}
}

View file

@ -33,6 +33,7 @@ public class ModLoader
*/
public static void addAchievementDesc(Achievement achievement, String name, String description)
{
}
/**
@ -62,13 +63,13 @@ public class ModLoader
}
/**
* This method does not work. Creation of a BiomeGenBase is sufficient to populate this array. Using this method will likely corrupt worlds.
* This method adds the supplied biome to the set of candidate biomes for the default world generator type.
*
* @param biome
*/
@Deprecated
public static void addBiome(BiomeGenBase biome)
{
FMLServerHandler.instance().addBiomeToDefaultWorldGenerator(biome);
}
/**