Added Stonghold, Village, and Spawn biome management helpers for PR 207

This commit is contained in:
LexManos 2012-10-28 07:38:38 -07:00
parent 31638a0697
commit 820d61d56d
4 changed files with 143 additions and 1 deletions

View file

@ -88,4 +88,8 @@ public xe.H # World/field_72993_I activeChunkSet
public ln.bc # EntityLiving/field_70728_aV experienceValue public ln.bc # EntityLiving/field_70728_aV experienceValue
# GuiFlatPresets # GuiFlatPresets
public asr.a(Ljava/lang/String;ILxz;Ljava/util/List;[Labm;)V # GuiFlatPresets/func_82294_a public asr.a(Ljava/lang/String;ILxz;Ljava/util/List;[Labm;)V # GuiFlatPresets/func_82294_a
public asr.a(Ljava/lang/String;ILxz;[Labm;)V # GuiFlatPresets/func_82297_a public asr.a(Ljava/lang/String;ILxz;[Labm;)V # GuiFlatPresets/func_82297_a
# BiomeGenBase
public xz.*() # Everything protected->public
# MapGenVillage
public-f aea.e # MapGenVillage/field_75055_e villageSpawnBiomes

View file

@ -0,0 +1,70 @@
package net.minecraftforge.common;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.src.BiomeGenBase;
import net.minecraft.src.ChunkProviderGenerate;
import net.minecraft.src.IChunkProvider;
import net.minecraft.src.MapGenStronghold;
import net.minecraft.src.MapGenVillage;
import net.minecraft.src.WorldChunkManager;
import com.google.common.collect.Lists;
public class BiomeManager
{
public static void addVillageBiome(BiomeGenBase biome, boolean canSpawn)
{
if (!MapGenVillage.villageSpawnBiomes.contains(biome))
{
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
biomes.add(biome);
MapGenVillage.villageSpawnBiomes = biomes;
}
}
public static void removeVillageBiome(BiomeGenBase biome)
{
if (MapGenVillage.villageSpawnBiomes.contains(biome))
{
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
biomes.remove(biome);
MapGenVillage.villageSpawnBiomes = biomes;
}
}
public static void addStrongholdBiome(BiomeGenBase biome)
{
if (!MapGenStronghold.allowedBiomes.contains(biome))
{
MapGenStronghold.allowedBiomes.add(biome);
}
}
public static void removeStrongholdBiome(BiomeGenBase biome)
{
if (MapGenStronghold.allowedBiomes.contains(biome))
{
MapGenStronghold.allowedBiomes.remove(biome);
}
}
public static void addSpawnBiome(BiomeGenBase biome)
{
if (!WorldChunkManager.allowedBiomes.contains(biome))
{
WorldChunkManager.allowedBiomes.add(biome);
}
}
public static void removeSpawnBiome(BiomeGenBase biome)
{
if (WorldChunkManager.allowedBiomes.contains(biome))
{
WorldChunkManager.allowedBiomes.remove(biome);
}
}
}

View file

@ -0,0 +1,36 @@
--- ../src_base/common/net/minecraft/src/MapGenStronghold.java
+++ ../src_work/common/net/minecraft/src/MapGenStronghold.java
@@ -1,6 +1,7 @@
package net.minecraft.src;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -10,6 +11,7 @@
public class MapGenStronghold extends MapGenStructure
{
+ public static ArrayList<BiomeGenBase> allowedBiomes = new ArrayList<BiomeGenBase>(Arrays.asList(BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.taiga, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.desertHills, BiomeGenBase.forestHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.jungle, BiomeGenBase.jungleHills));
public BiomeGenBase[] allowedBiomeGenBases;
/**
@@ -22,7 +24,7 @@
public MapGenStronghold()
{
- this.allowedBiomeGenBases = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.taiga, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.desertHills, BiomeGenBase.forestHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.jungle, BiomeGenBase.jungleHills};
+ this.allowedBiomeGenBases = allowedBiomes.toArray(new BiomeGenBase[0]);
this.structureCoords = new ChunkCoordIntPair[3];
this.field_82671_h = 32.0D;
this.field_82672_i = 3;
@@ -30,7 +32,7 @@
public MapGenStronghold(Map par1Map)
{
- this.allowedBiomeGenBases = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.taiga, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.desertHills, BiomeGenBase.forestHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.jungle, BiomeGenBase.jungleHills};
+ this.allowedBiomeGenBases = allowedBiomes.toArray(new BiomeGenBase[0]);
this.structureCoords = new ChunkCoordIntPair[3];
this.field_82671_h = 32.0D;
this.field_82672_i = 3;

View file

@ -0,0 +1,32 @@
--- ../src_base/common/net/minecraft/src/WorldChunkManager.java
+++ ../src_work/common/net/minecraft/src/WorldChunkManager.java
@@ -3,11 +3,14 @@
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Random;
+import static net.minecraft.src.BiomeGenBase.*;
public class WorldChunkManager
{
+ public static ArrayList<BiomeGenBase> allowedBiomes = new ArrayList<BiomeGenBase>(Arrays.asList(forest, plains, taiga, taigaHills, forestHills, jungle. jungleHills));
private GenLayer genBiomes;
/** A GenLayer containing the indices into BiomeGenBase.biomeList[] */
@@ -23,13 +26,7 @@
{
this.biomeCache = new BiomeCache(this);
this.biomesToSpawnIn = new ArrayList();
- this.biomesToSpawnIn.add(BiomeGenBase.forest);
- this.biomesToSpawnIn.add(BiomeGenBase.plains);
- this.biomesToSpawnIn.add(BiomeGenBase.taiga);
- this.biomesToSpawnIn.add(BiomeGenBase.taigaHills);
- this.biomesToSpawnIn.add(BiomeGenBase.forestHills);
- this.biomesToSpawnIn.add(BiomeGenBase.jungle);
- this.biomesToSpawnIn.add(BiomeGenBase.jungleHills);
+ this.biomesToSpawnIn.addAll(allowedBiomes);
}
public WorldChunkManager(long par1, WorldType par3WorldType)