1 août 2015, 23:25

Ligne 114 et 220 dans AncientChunkProvider :

package mod.common.world.type;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mod.common.world.structure.DimensionRegister;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldProvider;

public class AncientWorldProvider extends WorldProvider
{
public void registerWorldChunkManager()
{
this.worldChunkMgr = new AncientWorldChunkManager(worldObj.getSeed(), terrainType);
this.dimensionId = DimensionRegister.tutoDimAncient4;
}

public String getDimensionName()
{
return "Ancient World";
}

public String getSaveFolder()
{
return "AncientWorld";
}
public boolean canRespawnHere()
{
return true;
}
public boolean getWorldHasVoidParticles()
{
return true;
}
public int getHeight()
{
return 256;
}

public boolean canCoordinateBeSpawn(int par1, int par2)
{
return this.worldObj.getTopBlock(par1, par2) == Blocks.grass;
}

protected void generateLightBrightnessTable()
{
float f = 0.2F;

for(int i = 0; i <= 15; ++i)
{
float f1 = 1.0F - (float)i / 15.0F;
this.lightBrightnessTable* = (1.0F - f1) / (f1 * 3.0F + 1.0F) * (1.0F - f) + f;
}
}
public float calculateCelestialAngle(long par1, float par2)
{
int j = (int)(par1 % 24000L);
float f1 = ((float)j + par2) / 24000.0F - 0.25F;

if(f1 < 0.0F)
{
++f1;
}
if(f1 > 1.0F)
{
–f1;
}
float f2 = f1;
f1 = 1.0F - (float)((Math.cos((double)f1 * Math.PI) + 1.0D) / 2.0D);
f1 = f2 + (f1 - f2) / 3.0F;
return f1;
}
public int getMoonPhase(long par1)
{
return (int)(par1 / 24000L % 8L + 8L) % 8;
}
public String getWelcomeMessage()
{
if(this instanceof AncientWorldProvider)
{
return "Entering the Ancient Dimension";
}
return null;
}

public String getDepartMessage()
{
if(this instanceof AncientWorldProvider)
{
return "Leaving the Ancient Dimension";
}
return null;
}

@SideOnly(Side.CLIENT)
public boolean isSkyColored()
{
return true;
}

@Override
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
{ //à modifier pour changer la couleur
return Vec3.createVectorHelper(2.8, 1.1, 1.7);
}
}

Dans la classe WorldChunkManager du coup x) :


package mod.common.world.type;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mod.common.world.biome.BiomeRegister;
import mod.common.world.generator.AncientGenLayer;
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;

public class AncientWorldChunkManager extends WorldChunkManager
{
/**
* GenLayer = classe de GenLayer si vous utiliser un GenLayer qui n’hérite
* pas de la classe GenLayer alors il faut changer par votre classe
*/
private GenLayer genBiomes;
private GenLayer biomeIndexLayer;
/** L'objet du BiomeCache pour le monde */
private BiomeCache biomeCache;
/** List des biome ou le joueur peu spawn */
private List <biomegenbase>biomesToSpawnIn;

protected AncientWorldChunkManager()
{
this.biomeCache = new BiomeCache(this);
// liste des biomes ou nous spawons
this.biomesToSpawnIn = new ArrayList<biomegenbase>();
// Ce biome n'est pas le biome ou vous spawner forcement, mais dans
// toute les classes il devra être mis
this.biomesToSpawnIn.add(BiomeGenBase.savanna);
}

public AncientWorldChunkManager(long par1, WorldType worldType)
{
this();
/**
* Appele la fonction makeTheWorld dans la classe TutoGenLayer, la
* fonction est la fonction de génération de nos biome
*/
GenLayer[] agenlayer = AncientGenLayer.makeTheWorld(par1);
this.genBiomes = agenlayer[0];
this.biomeIndexLayer = agenlayer[1];
}

public AncientWorldChunkManager(World world)
{
this(world.getSeed(), world.provider.terrainType);
}

/** Permet d'obtenir la list des biomes ou le joueur peut apparaitre */
public List <biomegenbase>getBiomesToSpawnIn()
{
return this.biomesToSpawnIn;
}

/** Renvoie au BiomeGenBase a la position x, z relative dans le monde */
public BiomeGenBase getBiomeGenAt(int x, int z)
{
BiomeGenBase biome = this.biomeCache.getBiomeGenAt(x, z);
if(biome == null)
{
return BiomeGenBase.savanna;

}
return biome;
}

/**
* Retourne a la list des valeurs pour la pluis… ... pour en fonction de
* blocs spésifier
*/
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;
}

/** Retourne a une température donner par raport au y */
@SideOnly(Side.CLIENT)
public float getTemperatureAtHeight(float par1, int par2)
{
return par1;
}

/** Retourne à un tableau pour les biomes a générer */
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.genBiomes.getInts(par2, par3, par4, par5);

for(int i = 0; i < par4 * par5; ++i)
{
if(aint* >= 0)
{
par1ArrayOfBiomeGenBase* = BiomeGenBase.getBiome(aint*);
}
else
{
par1ArrayOfBiomeGenBase* = BiomeGenBase.forest;
}
}

return par1ArrayOfBiomeGenBase;
}

/** Retourne au biome et charge les données pour les blocs */
public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5)
{
return this.getBiomeGenAt(par1ArrayOfBiomeGenBase, par2, par3, par4, par5, true);
}

/**
* Retourne a une liste de biome pour les blocs spécifiés argument : x, y,
* largeur, longueur, cache.
*/
public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] arrayOfBiomeGenBase, int x, int y, int width, int length, boolean cacheFlag)
{
if(arrayOfBiomeGenBase == null || arrayOfBiomeGenBase.length < width * length)
{
arrayOfBiomeGenBase = new BiomeGenBase[width * length];
}

if(cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (y & 15) == 0)
{
BiomeGenBase[] abiomegenbase1 = this.biomeCache.getCachedBiomes(x, y);
System.arraycopy(abiomegenbase1, 0, arrayOfBiomeGenBase, 0, width * length);
return arrayOfBiomeGenBase;
}
else
{
int[] aint = this.biomeIndexLayer.getInts(x, y, width, length);

for(int i1 = 0; i1 < width * length; ++i1)
{
if(aint[i1] >= 0)
{
arrayOfBiomeGenBase[i1] = BiomeGenBase.getBiome(aint[i1]);
}

else
{
arrayOfBiomeGenBase[i1] = BiomeGenBase.forest;
}
}

return arrayOfBiomeGenBase;
}
}

/** Verifie les données du chunk */
public boolean areBiomesViable(int x, int y, int z, List par4List)
{
IntCache.resetIntCache();
int l = x - z >> 2;
int i1 = y - z >> 2;
int j1 = x + z >> 2;
int k1 = y + z >> 2;
int l1 = j1 - l + 1;
int i2 = k1 - i1 + 1;
int[] aint = this.genBiomes.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;
}

/** Supprime le biome dans les 30s. si il n'est pas vérifier dans la temps */
public void cleanupCache()
{
this.biomeCache.cleanupCache();
}
}

Ligne 13 et 15 dans AncientWorldProvider :

package mod.common.world.type;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mod.common.world.structure.DimensionRegister;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldProvider;

public class AncientWorldProvider extends WorldProvider
{
public void registerWorldChunkManager()
{
this.worldChunkMgr = new AncientWorldChunkManager(worldObj.getSeed(), terrainType);
this.dimensionId = DimensionRegister.tutoDimAncient4;
}

public String getDimensionName()
{
return "Ancient World";
}

public String getSaveFolder()
{
return "AncientWorld";
}
public boolean canRespawnHere()
{
return true;
}
public boolean getWorldHasVoidParticles()
{
return true;
}
public int getHeight()
{
return 256;
}

public boolean canCoordinateBeSpawn(int par1, int par2)
{
return this.worldObj.getTopBlock(par1, par2) == Blocks.grass;
}

protected void generateLightBrightnessTable()
{
float f = 0.2F;

for(int i = 0; i <= 15; ++i)
{
float f1 = 1.0F - (float)i / 15.0F;
this.lightBrightnessTable* = (1.0F - f1) / (f1 * 3.0F + 1.0F) * (1.0F - f) + f;
}
}
public float calculateCelestialAngle(long par1, float par2)
{
int j = (int)(par1 % 24000L);
float f1 = ((float)j + par2) / 24000.0F - 0.25F;

if(f1 < 0.0F)
{
++f1;
}
if(f1 > 1.0F)
{
–f1;
}
float f2 = f1;
f1 = 1.0F - (float)((Math.cos((double)f1 * Math.PI) + 1.0D) / 2.0D);
f1 = f2 + (f1 - f2) / 3.0F;
return f1;
}
public int getMoonPhase(long par1)
{
return (int)(par1 / 24000L % 8L + 8L) % 8;
}
public String getWelcomeMessage()
{
if(this instanceof AncientWorldProvider)
{
return "Entering the Ancient Dimension";
}
return null;
}

public String getDepartMessage()
{
if(this instanceof AncientWorldProvider)
{
return "Leaving the Ancient Dimension";
}
return null;
}

@SideOnly(Side.CLIENT)
public boolean isSkyColored()
{
return true;
}

@Override
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
{ //à modifier pour changer la couleur
return Vec3.createVectorHelper(2.8, 1.1, 1.7);
}
}

J’ai rien trouver d’autre et je vois pas d’erreur…</biomegenbase></biomegenbase></biomegenbase>