Modding FR

mysterioxes

Bucheron
8 Juin 2011
118
0
11
ou est else et ne met pas le deuxieme if

donc

if(world.isBlockGettingPowered(i, j, k)) else(world.isBlockIndirectlyGettingPowered(i, j, k))

edit tu veut dire sa ou autre dsl mal compris jecrois que c'est || regarde dans se lien

http://www.siteduzero.com/tutoriel-3-10296-les-conditions.html
 

Stormweaker

Bucheron
15 Mai 2011
518
1
11
30
serveur-sinan.forumgratuit.fr
Mack a dit:
Dans une condition, comment on fait un "ou" ?
En gros, j'voudrais mettre :
if(world.isBlockGettingPowered(i, j, k)) OU if(world.isBlockIndirectlyGettingPowered(i, j, k))

J'ai pensé à or, mais c'est pas ça ...

ou : ||
et : &&


mysterioxes a dit:
ou est else et ne met pas le deuxieme if

donc

if(world.isBlockGettingPowered(i, j, k)) else(world.isBlockIndirectlyGettingPowered(i, j, k))

Le else c'est si les conditions ne sont pas remplies
 

Mack

Architecte en herbe
3 Juin 2011
123
5
124
Ulko :
Code:
    public int getBlockTextureFromSide(int i)
    {
	int tex = random.nextInt(2);
        if(tex == 1)
        {
            return 1;
        }
        if(tex == 0)
        {
            return 5;
        } else
        {
            return 8;
        }
     }
Avec ça, chaque face sera aléatoire entre le carreau d'id 1,5 et 8.
A toi de voir comment tu veux régler.
( Pas tester, mais ça devrait être ça. )

Effectivement, pour le ou c'était || merci =P.
 

Mack

Architecte en herbe
3 Juin 2011
123
5
124
La fonction public int getBlockTextureFromSide(int i) est appelée pour chaque face non ?
Du coup, si c'est ça, int tex = random.nextInt(2); permet de tirer un chiffre entre 0 et 2, puis après suivant ce chiffre j'attribue la face.

Donc techniquement ça marche. Non ?


Ou alors j'ai mal compris sa question ?