Creer une plantation
-
1- Il vaut mieux éviter la 1.7.2, elle est totalement buguée, plus mise à jour et elle n’utilise pas le nouveau système d’identification
2- Pourquoi ne pas regarder le code de la netherwart tout simplement ? -
@‘SCAREX’:
1- Il vaut mieux éviter la 1.7.2, elle est totalement buguée, plus mise à jour et elle n’utilise pas le nouveau système d’identification
2- Pourquoi ne pas regarder le code de la netherwart tout simplement ?Oui je sais qu’elle est bugger mais faudrait qu’on reinstalle nos 4 serveur (sa serait un peut le bordel X) )
J’ai deja regarder mais certaine fonction on des argumment du style p_12345_0 et je n’arrive pas a savoir a quoi sa correspond pour mieux comprendre le code ^^
-
C’est souvent World world, int x, int y, int z.
Après faut chercher où est appelé la fonction pour retrouver à quoi ça correspond exactement. -
public class BlockNetherWart extends BlockBush { @SideOnly(Side.CLIENT) private IIcon[] field_149883_a; // Les icônes private static final String __OBFID = "CL_00000274"; protected BlockNetherWart() { this.setTickRandomly(true); // c'est une plante qui doit grandir donc update random float f = 0.5F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); // Hitbox this.setCreativeTab((CreativeTabs)null); // aucune creative tab } /** * is the block grass, dirt or farmland */ protected boolean canPlaceBlockOn(Block p_149854_1_) { return p_149854_1_ == Blocks.soul_sand; // Elle doit être placée sur de la soul sand } /** * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. */ public boolean canBlockStay(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_) { return super.canBlockStay(p_149718_1_, p_149718_2_, p_149718_3_, p_149718_4_); // Useless because Mojang } /** * Ticks the block if it's been scheduled */ public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) { int l = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_); // on récupère le metadata if (l < 3 && p_149674_5_.nextInt(10) == 0) // Si la plante peut encore pousser et une chance sur 10 { ++l; p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, l, 2); // On change le metadata (on fait pousser la plante) } super.updateTick(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_); } /** * Gets the block's texture. Args: side, meta */ @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int p_149691_2_) { return p_149691_2_ >= 3 ? this.field_149883_a[2] : (p_149691_2_ > 0 ? this.field_149883_a[1] : this.field_149883_a[0]); // les différentes icônes } /** * The type of render function that is called for this block */ public int getRenderType() { return 6; // on spécifie que la nether wart doit être rendu comme une plante } /** * Drops the block items with a specified chance of dropping the specified items */ @SuppressWarnings("unused") public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) { super.dropBlockAsItemWithChance(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); if (false && !p_149690_1_.isRemote) // Fonction rendue inutile par Forge, il vaut mieux utiliser la fonction getDrops plus bas { int j1 = 1; if (p_149690_5_ >= 3) { j1 = 2 + p_149690_1_.rand.nextInt(3); if (p_149690_7_ > 0) { j1 += p_149690_1_.rand.nextInt(p_149690_7_ + 1); } } for (int k1 = 0; k1 < j1; ++k1) // On fait dropper les items { this.dropBlockAsItem(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(Items.nether_wart)); } } } public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return null; // On spécifie rien car le drop se fait au-dessus } /** * Returns the quantity of items to drop on block destruction. */ public int quantityDropped(Random p_149745_1_) { return 0; // Même chose, pas de drops } /** * Gets an item for the block being called on. Args: world, x, y, z */ @SideOnly(Side.CLIENT) public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { return Items.nether_wart; // l'item récupéré lors d'un click de la molette } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) { this.field_149883_a = new IIcon[3]; // On enregistre les icônes for (int i = 0; i < this.field_149883_a.length; ++i) { this.field_149883_a* = p_149651_1_.registerIcon(this.getTextureName() + "_stage_" + i); } } @Override public ArrayList <itemstack>getDrops(World world, int x, int y, int z, int metadata, int fortune) { ArrayList <itemstack>ret = new ArrayList<itemstack>(); // Nouvelleliste d'items int count = 1; if (metadata >= 3) // Si la nether wart est arrivée à maturité on drop plus de nether wart { count = 2 + world.rand.nextInt(3) + (fortune > 0 ? world.rand.nextInt(fortune + 1) : 0); } for (int i = 0; i < count; i++) { ret.add(new ItemStack(Items.nether_wart)); // on ajoute le tout à la liste } return ret; } }J’espère que ces explications sont assez claires</itemstack></itemstack></itemstack>
-
Merci a vous, j’ai réussi a faire ma nouvelle culture ^^
-
Balise résolu ?
-
@‘robin4002’:
Balise résolu ?
Oui, je sais pas si c’est vous qui la metter ou si je doit faire un truc pour la mettre ^^
-
Il y a de la lecture niveau règles de forum avant de poster. (C’est souvent partout pareil)
-
Voici quatre pages que j’utilise souvent pour “traduire” le code de minecraft (CTRL + F pour faire une recherche sur la page):
-
Merci Maxx, sa va beaucoup me servir tes pages
