Augmenter la vitesse d'expansion de l'herbe

Stormweaker

Bucheron
15 Mai 2011
518
1
11
30
serveur-sinan.forumgratuit.fr
Salut à tous, je cherche comment augmenter la vitesse d'expansion de l'herbe, j'ai regardé le fichier BlockGrass.java et j'ai trouvé la fonction qui permet à un bloc de terre de se transformer en bloc d'herbe:
Code:
    public void updateTick(World world, int i, int j, int k, Random random)
    {
        if(world.multiplayerWorld)
        {
            return;
        }
        if(world.getBlockLightValue(i, j + 1, k) < 4 && Block.lightOpacity[world.getBlockId(i, j + 1, k)] > 2)
        {
            if(random.nextInt(4) != 0)
            {
                return;
            }
            world.setBlockWithNotify(i, j, k, Block.dirt.blockID);
        } else
        if(world.getBlockLightValue(i, j + 1, k) >= 9)
        {
            int l = (i + random.nextInt(3)) - 1;
            int i1 = (j + random.nextInt(5)) - 3;
            int j1 = (k + random.nextInt(3)) - 1;
            int k1 = world.getBlockId(l, i1 + 1, j1);
            if(world.getBlockId(l, i1, j1) == Block.dirt.blockID && world.getBlockLightValue(l, i1 + 1, j1) >= 4 && Block.lightOpacity[k1] <= 2)
            {
                world.setBlockWithNotify(l, i1, j1, Block.grass.blockID);
            }
        }
    }

Les autres fonctions sont:
protected BlockGrass(int i) qui est la fonction commune à tous les blocs

public int getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l) pour les textures des faces du bloc d'herbe

public int colorMultiplier(IBlockAccess iblockaccess, int i, int j, int k) pour la couleur de l'herbe en fonction du biome je pense

public int idDropped(int i, Random random) pour donner de la terre et pas de l'herbe une fois détruit

J'ai essayé de changer un peu tout, enlever la condition de la lumière mais rien

Maintenant j'essaie d'utiliser la fonction System.currentTimeMillis() qui permet de récupérer un temps en millisecondes (je sais pas si c'est le temps depuis le lancement du jeu, du JRE ou autre chose)
Ça me donne ça:

Code:
	public static long t1 = System.currentTimeMillis();
	public static long t2;
	public static long t3;


public void updateTick(World world, int i, int j, int k, Random random)
    {
	    t2 = System.currentTimeMillis();
		t3 = Math.abs(t2 - t1);
	
        if(t3 >= 100L)
		{
		    if(world.multiplayerWorld)
            {
                return;
            }
            int l = (i + random.nextInt(3)) - 1;
            int i1 = (j + random.nextInt(5)) - 3;
            int j1 = (k + random.nextInt(3)) - 1;
            if(world.getBlockId(l, i1, j1) == Block.dirt.blockID)
            {
                world.setBlockWithNotify(l, i1, j1, Block.grass.blockID);
            }
		}
    }

Ce qui ne fonctionne toujours pas, si quelqu'un a la solution je le remercie d'avance :D