BiomeList
:::
package fr.thm.ThemoderneEquipment.common;
import net.minecraft.world.biome.BiomeGenBase;
public class BiomeListAltar
{
public static WorldTypeAltar worldTypeAltar;
public static BiomeGenBase altarMountain;
protected static final BiomeGenBase.Height height_MidHills = new BiomeGenBase.Height(1.3F, 0.8F);
public static void BiomeList()
{
altarMountain = new AlatarMountainBiomes(51, true).setBiomeName(“Altar Mountain”).setHeight(height_MidHills).setTemperatureRainfall(1.7F, 2.6F);
}
}
:::
WorldType
:::
package fr.thm.ThemoderneEquipment.common;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.WorldChunkManager;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.GenLayerBiomeEdge;
import net.minecraft.world.gen.layer.GenLayerZoom;
import net.minecraftforge.common.DimensionManager;
public class WorldTypeAltar extends WorldType
{
public WorldTypeAltar()
{
super(“WorldTypeAltar”);
DimensionManager.unregisterProviderType(276);
DimensionManager.registerProviderType(276, WorldProviderAltar.class, true);
}
public GenLayer getBiomeLayer(long worldSeed, GenLayer parentLayer)
{
GenLayer ret = new BiomeGenLayerAltar(200L, parentLayer);
ret = GenLayerZoom.magnify(1000L, ret, 2);
ret = new GenLayerBiomeEdge(1000L, ret);
return ret;
}
public WorldChunkManager getChunkManager(World world)
{
return new WorldChunkManagerAltar(world);
}
}
:::
WorldProvideur
:::
package fr.thm.ThemoderneEquipment.common;
import net.minecraft.init.Blocks;
import net.minecraft.world.WorldProviderSurface;
public class WorldProviderAltar extends WorldProviderSurface
{
public boolean canCoordinateBeSpawn(int par1, int par2)
{
return this.worldObj.getTopBlock(par1, par2) == Blocks.grass || this.worldObj.getTopBlock(par1, par2) == Blocks.stone || this.worldObj.getTopBlock(par1, par2) == Blocks.stone;
}
public String getDimensionName()
{
return “altar”;
}
public String getSaveFolder()
{
return “Altar”;
}
}
:::
BiomeGenLayer
:::
package fr.thm.ThemoderneEquipment.common;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.IntCache;
public class BiomeGenLayerAltar extends GenLayer
{
protected BiomeGenBase[] baseBiomes = {BiomeListAltar.altarMountain};;
public BiomeGenLayerAltar(long seed, GenLayer genlayer)
{
super(seed);
this.parent = genlayer;
}
public BiomeGenLayerAltar(long seed)
{
super(seed);
}
@SuppressWarnings(“unused”)
@Override
public int[] getInts(int x, int z, int width, int depth)
{
int[] dest = IntCache.getIntCache(width * depth);
for(int dz = 0; dz < depth; dz++)
{
for(int dx = 0; dx < width; dx++)
{
this.initChunkSeed(dx + x, dz + z);
dest[(dx + dz * width)] = this.baseBiomes[nextInt(this.baseBiomes.length)].biomeID;
}
return dest;
}
return dest;
}
}
:::
GenLayer
:::
package fr.thm.ThemoderneEquipment.common;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.GenLayerVoronoiZoom;
import net.minecraft.world.gen.layer.GenLayerZoom;
public abstract class GenLayerAltar extends GenLayer
{
public GenLayerAltar(long seed)
{
super(seed);
}
public static GenLayer[] makeTheWorld(long seed)
{
GenLayer biomes = new BiomeGenLayerAltar(1L);
biomes = new GenLayerZoom(1000L, biomes);
biomes = new GenLayerZoom(1001L, biomes);
biomes = new GenLayerZoom(1002L, biomes);
biomes = new GenLayerZoom(1003L, biomes);
biomes = new GenLayerZoom(1004L, biomes);
biomes = new GenLayerZoom(1005L, biomes);
GenLayer genlayervoronoizoom = new GenLayerVoronoiZoom(10L, biomes);
biomes.initWorldGenSeed(76133290);
genlayervoronoizoom.initWorldGenSeed(76133290);
return new GenLayer[] {biomes, genlayervoronoizoom};
}
}
:::
WorldChunckManager
:::
package fr.thm.ThemoderneEquipment.common;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeCache;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManager;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.IntCache;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class WorldChunkManagerAltar extends WorldChunkManager
{
private GenLayer myGenBiomes;
private GenLayer myBiomeIndexLayer;
private BiomeCache myBiomeCache;
private List <biomegenbase>myBiomesToSpawnIn;
public WorldChunkManagerAltar()
{
this.myBiomeCache = new BiomeCache(this);
this.myBiomesToSpawnIn = new ArrayList<biomegenbase>();
this.myBiomesToSpawnIn.add(BiomeListAltar.altarMountain);
}
public WorldChunkManagerAltar(long seed, WorldType worldtype)
{
this();
GenLayer[] agenlayer = GenLayerAltar.makeTheWorld(seed);
this.myGenBiomes = agenlayer[0];
this.myBiomeIndexLayer = agenlayer[1];
}
public WorldChunkManagerAltar(World world)
{
this(world.getSeed(), world.provider.terrainType);
}
public List <biomegenbase>getBiomesToSpawnIn()
{
return this.myBiomesToSpawnIn;
}
public BiomeGenBase getBiomeGenAt(int x, int z)
{
BiomeGenBase biome = this.myBiomeCache.getBiomeGenAt(x, z);
if(biome == null)
{
return BiomeListAltar.altarMountain;
}
return biome;
}
public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5)
{
if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5)
{
par1ArrayOfFloat = new float[par4 * par5];
}
Arrays.fill(par1ArrayOfFloat, 0, par4 * par5, 0.0F);
return par1ArrayOfFloat;
}
@SideOnly(Side.CLIENT)
public float getTemperatureAtHeight(float par1, int par2)
{
return par1;
}
public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5)
{
IntCache.resetIntCache();
if(par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5)
{
par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
}
int[] aint = this.myGenBiomes.getInts(par2, par3, par4, par5);
for(int i = 0; i < par4 * par5; ++i)
{
if(aint* >= 0)
{
par1ArrayOfBiomeGenBase* = BiomeGenBase.getBiome(aint*);
}
else
{
par1ArrayOfBiomeGenBase* = BiomeListAltar.altarMountain;
}
}
return par1ArrayOfBiomeGenBase;
}
public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5)
{
return this.getBiomeGenAt(par1ArrayOfBiomeGenBase, par2, par3, par4, par5, true);
}
public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] par1ArrayOfBiomeGenBase, int x, int y, int width, int length, boolean cacheFlag)
{
IntCache.resetIntCache();
if(par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < width * length)
{
par1ArrayOfBiomeGenBase = new BiomeGenBase[width * length];
}
if(cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (y & 15) == 0)
{
BiomeGenBase[] abiomegenbase1 = this.myBiomeCache.getCachedBiomes(x, y);
System.arraycopy(abiomegenbase1, 0, par1ArrayOfBiomeGenBase, 0, width * length);
return par1ArrayOfBiomeGenBase;
}
else
{
int[] aint = this.myBiomeIndexLayer.getInts(x, y, width, length);
for(int i = 0; i < width * length; ++i)
{
if(aint* >= 0)
{
par1ArrayOfBiomeGenBase* = BiomeGenBase.getBiome(aint*);
}
else
{
par1ArrayOfBiomeGenBase* = BiomeListAltar.altarMountain;
}
}
return par1ArrayOfBiomeGenBase;
}
}
public boolean areBiomesViable(int par1, int par2, int par3, List par4List)
{
IntCache.resetIntCache();
int l = par1 - par3 >> 2;
int i1 = par2 - par3 >> 2;
int j1 = par1 + par3 >> 2;
int k1 = par2 + par3 >> 2;
int l1 = j1 - l + 1;
int i2 = k1 - i1 + 1;
int[] aint = this.myGenBiomes.getInts(l, i1, l1, i2);
for(int j2 = 0; j2 < l1 * i2; ++j2)
{
BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[j2]);
if(!par4List.contains(biomegenbase))
{
return false;
}
}
return true;
}
public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random)
{
IntCache.resetIntCache();
int l = par1 - par3 >> 2;
int i1 = par2 - par3 >> 2;
int j1 = par1 + par3 >> 2;
int k1 = par2 + par3 >> 2;
int l1 = j1 - l + 1;
int i2 = k1 - i1 + 1;
int[] aint = this.myGenBiomes.getInts(l, i1, l1, i2);
ChunkPosition chunkposition = null;
int j2 = 0;
for(int k2 = 0; k2 < l1 * i2; ++k2)
{
int l2 = l + k2 % l1 << 2;
int i3 = i1 + k2 / l1 << 2;
BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[k2]);
if(par4List.contains(biomegenbase) && (chunkposition == null || par5Random.nextInt(j2 + 1) == 0))
{
chunkposition = new ChunkPosition(l2, 0, i3);
++j2;
}
}
return chunkposition;
}
public void cleanupCache()
{
this.myBiomeCache.cleanupCache();
}
}
:::
Mon Biome
:::
package fr.thm.ThemoderneEquipment.common;
import java.util.Random;
import fr.thm.ThemoderneEquipment.common.altarmob.EntityCreeperAltar;
import fr.thm.ThemoderneEquipment.common.altarmob.EntitySkeletonAltar;
import fr.thm.ThemoderneEquipment.common.altarmob.EntityZombiAltar;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
import net.minecraft.world.gen.feature.WorldGenBigTree;
import net.minecraft.world.gen.feature.WorldGenTrees;
public class AlatarMountainBiomes extends BiomeGenBase
{
private boolean field_150614_aC;
public AlatarMountainBiomes(int par1, boolean par2)
{
super(par1, par2);
this.topBlock = Blocks.grass;
this.fillerBlock = Blocks.dirt;
this.theBiomeDecorator.treesPerChunk = 2;
this.field_150614_aC = par2;
if (par2)
{
this.theBiomeDecorator.treesPerChunk = 2;
}
else
{
this.theBiomeDecorator.treesPerChunk = 3;
}
this.spawnableCreatureList.add(new SpawnListEntry(EntityCreeperAltar.class, 5, 2, 10));
this.spawnableCreatureList.add(new SpawnListEntry(EntitySkeletonAltar.class, 5, 2, 10));
this.spawnableCreatureList.add(new SpawnListEntry(EntityZombiAltar.class, 5, 2, 10));
}
public WorldGenAbstractTree func_150567_a(Random p_150567_1_)
{
return (WorldGenAbstractTree)(p_150567_1_.nextInt(10) == 0 ? new WorldGenBigTree(false) : (!this.field_150614_aC && p_150567_1_.nextInt(3) == 0 ? new WorldGenTrees(false) : new WorldGenTrees(false)));
}
public void genTerrainBlocks(World p_150573_1_, Random p_150573_2_, Block[] p_150573_3_, byte[] p_150573_4_, int p_150573_5_, int p_150573_6_, double p_150573_7_)
{
this.generateBiomeTerrain(p_150573_1_, p_150573_2_, p_150573_3_, p_150573_4_, p_150573_5_, p_150573_6_, p_150573_7_);
}
public final void generateBiomeTerrain(World world, Random rand, Block[] BLOCK, byte[] BYTE, int x, int z, double p_150560_7_)
{
boolean flag = true;
Block block = this.topBlock;
byte b0 = (byte)(this.field_150604_aj & 255);
Block block1 = this.fillerBlock;
int k = -1;
int l = (int)(p_150560_7_ / 3.0D + 3.0D + rand.nextDouble() * 0.25D);
int i1 = x & 15;
int j1 = z & 15;
int k1 = BLOCK.length / 256;
for (int l1 = 255; l1 >= 0; –l1)
{
int i2 = (j1 * 16 + i1) * k1 + l1;
if (l1 <= 0 + rand.nextInt(5))
{
BLOCK[i2] = Blocks.bedrock;
}
else
{
Block block2 = BLOCK[i2];
if (block2 != null && block2.getMaterial() != Material.air)
{
if (block2 == Blocks.stone)
{
if (k == -1)
{
if (l <= 0)
{
block = null;
b0 = 0;
block1 = Blocks.stone;
}
else if (l1 >= 59 && l1 <= 64)
{
block = this.topBlock;
b0 = (byte)(this.field_150604_aj & 255);
block1 = this.fillerBlock;
}
if (l1 < 63 && (block == null || block.getMaterial() == Material.air))
{
if (this.getFloatTemperature(x, l1, z) < 0.15F)
{
}
else
{
}
}
k = l;
if (l1 >= 58)
{
BLOCK[i2] = block;
BYTE[i2] = b0;
}
else if (l1 < 56 - l)
{
block = null;
block1 = Blocks.stone;
BLOCK[i2] = Blocks.stone;
}
else
{
BLOCK[i2] = block1;
}
}
else if (k > 0)
{
–k;
BLOCK[i2] = block1;
if (k == 0 && block1 == Blocks.stone)
{
k = rand.nextInt(4) + Math.max(0, l1 - 63);
block1 = Blocks.stone;
}
}
}
}
else
{
k = -1;
}
}
}
}
}
:::
Enfaite je voudrai que mon biome spawn plus souvent dans l’overworld.
Et qu’il n’y ai pas la génération du biome avec les obtion avancé, celle ou il y a (Amplifier, plat, etc)
Merci Diangle de m’avoir aider :)</biomegenbase></biomegenbase></biomegenbase>