ForgePatch/fml/patches/common/net/minecraft/src/WorldType.java.patch

111 lines
3.7 KiB
Diff

--- ../src-base/common/net/minecraft/src/WorldType.java
+++ ../src-work/common/net/minecraft/src/WorldType.java
@@ -1,10 +1,20 @@
package net.minecraft.src;
+
+import java.util.Arrays;
+import java.util.Random;
+import java.util.Set;
+
+import com.google.common.collect.ObjectArrays;
+import com.google.common.collect.Sets;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
public class WorldType
{
+ public static final BiomeGenBase[] base11Biomes = 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};
+ public static final BiomeGenBase[] base12Biomes = ObjectArrays.concat(base11Biomes, BiomeGenBase.field_76782_w);
+
public static final WorldType[] field_77139_a = new WorldType[16];
public static final WorldType field_77137_b = (new WorldType(0, "default", 1)).func_77129_f();
public static final WorldType field_77138_c = new WorldType(1, "flat");
@@ -14,6 +24,8 @@
private final int field_77134_g;
private boolean field_77140_h;
private boolean field_77141_i;
+
+ protected BiomeGenBase[] biomesForWorldType;
private WorldType(int p_i3737_1_, String p_i3737_2_)
{
@@ -26,6 +38,14 @@
this.field_77134_g = p_i3738_3_;
this.field_77140_h = true;
field_77139_a[p_i3738_1_] = this;
+ switch (p_i3738_1_)
+ {
+ case 8:
+ biomesForWorldType = base11Biomes;
+ break;
+ default:
+ biomesForWorldType = base12Biomes;
+ }
}
public String func_77127_a()
@@ -89,4 +109,63 @@
return null;
}
+
+ public WorldChunkManager getChunkManager(World world)
+ {
+ return this == field_77138_c ? new WorldChunkManagerHell(BiomeGenBase.field_76772_c, 0.5F, 0.5F) : new WorldChunkManager(world);
+ }
+
+ public IChunkProvider getChunkGenerator(World world)
+ {
+ return (this == field_77138_c ? new ChunkProviderFlat(world, world.func_72905_C(), world.func_72912_H().func_76089_r()) : new ChunkProviderGenerate(world, world.func_72905_C(), world.func_72912_H().func_76089_r()));
+ }
+
+ public int getMinimumSpawnHeight(World world)
+ {
+ return this == field_77138_c ? 4 : 64;
+ }
+
+ public double getHorizon(World world)
+ {
+ return this == field_77138_c ? 0.0D : 63.0D;
+ }
+
+ public boolean hasVoidParticles(boolean var1)
+ {
+ return this != field_77138_c && !var1;
+ }
+
+ public double voidFadeMagnitude()
+ {
+ return this == field_77138_c ? 1.0D : 0.03125D;
+ }
+
+ public BiomeGenBase[] getBiomesForWorldType() {
+ return biomesForWorldType;
+ }
+
+ public void addNewBiome(BiomeGenBase biome)
+ {
+ Set<BiomeGenBase> newBiomesForWorld = Sets.newIdentityHashSet();
+ newBiomesForWorld.addAll(Arrays.asList(biomesForWorldType));
+ newBiomesForWorld.add(biome);
+ biomesForWorldType = newBiomesForWorld.toArray(new BiomeGenBase[0]);
+ }
+
+ public void removeBiome(BiomeGenBase biome)
+ {
+ Set<BiomeGenBase> newBiomesForWorld = Sets.newIdentityHashSet();
+ newBiomesForWorld.addAll(Arrays.asList(biomesForWorldType));
+ newBiomesForWorld.remove(biome);
+ biomesForWorldType = newBiomesForWorld.toArray(new BiomeGenBase[0]);
+ }
+
+ public boolean handleSlimeSpawnReduction(Random random, World world)
+ {
+ return this == field_77138_c ? random.nextInt(4) != 1 : false;
+ }
+ /**
+ * Called when 'Create New World' button is pressed before starting game
+ */
+ public void onGUICreateWorldPress() { }
}