SOLVED Aide mise à jour d'un mod


  • Bonjour,
    J'ai suivi le tutoriel de robin4002 pour "Mettre à jour un mod 1.6.4 vers la 1.7.2".
    J'ai donc fait beaucoup de changement ce qui a supprimé de nombreuses erreurs or il en reste quelques une qui sont les suivantes :

    this.setContainerItem(book); : Erreur sur le "book"
    ((EntityPlayer)entity).addChatMessage("Votre oeuf va eclore dans 14 minutes, restez connectez! "); : Erreur sur le ".addChatMessage"
    this.blockIcon = iconRegister.registerIcon("pixelmonfr:bibliotheque1"); : Erreur sur "iconRegister"
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.tortank)); : Erreur sur le "dropPlayerItem".
    public class creatitems extends CreativeTabs : Erreur sur le nom de la classe

    public IIcon getIconFromDamage(int side, int metadata)
       {
           return side == 0 ? this.nom0 : (side == 2 ? this.nom2 : (side == 3 ? this.nom3 : (side == 4 ? this.nom4 : (side == 5 ? this.nom5 : (side == 1 ? this.nom1 : this.blockIcon)))));
       }

    Erreur sur la méthode entière.

    Et enfin voici une classe entière avec beaucoup d'erreur que je n'arrive pas à résoude (ceci viens des id qui n'existe plus mais je vois pas comment modifier).

    package pixelmonfr;
    import net.minecraft.client.renderer.texture.IconRegister;
    import net.minecraft.entity.Entity;
    import net.minecraft.item.EnumArmorMaterial;
    import net.minecraft.item.ItemArmor;
    import net.minecraft.item.ItemStack;
    public class CB extends ItemArmor {
    public CB(int par1, EnumArmorMaterial par2EnumArmorMaterial,
    int par3, int par4) {
    super(par1, par2EnumArmorMaterial, par3, par4);
    }
    public String getArmorTexture(ItemStack stack, Entity entity, int slot,
    int layer) {
    if (stack.itemID == pixelmain.CB1.itemID
    || stack.itemID == pixelmain.CB2.itemID
    || stack.itemID == pixelmain.CB4.itemID) {
    return "pixelmonfr:textures/armor/chemiseb_layer_1.png";
    }
    if (stack.itemID == pixelmain.CB3.itemID) {
    return "pixelmonfr:textures/armor/chemiseb_layer_2.png";
    } else {
    return null;
    }
    
    }
    public void registerIcons(IconRegister reg) { // Make sure to import IconRegister!
    if (itemID == pixelmain.CB2.itemID) {
    this.itemIcon = reg.registerIcon("pixelmonfr:cb2"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    
    if (itemID == pixelmain.CB3.itemID) {
    this.itemIcon = reg.registerIcon("pixelmonfr:cb3"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    
    if (itemID == pixelmain.CB4.itemID) {
    this.itemIcon = reg.registerIcon("pixelmonfr:cb4"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    
    if (itemID == pixelmain.CB1.itemID) {
    this.itemIcon = reg.registerIcon("pixelmonfr:cb1"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    
    }
    }
    
  • Moddeurs confirmés Rédacteurs Administrateurs

    IconRegister -> IIconRegister
    ((EntityPlayer)entity).addChatMessage("Votre oeuf va eclore dans 14 minutes, restez connectez! ");
    ->
    ((EntityPlayer)entity).addChatMessage(new ChatComponantText("Votre oeuf va eclore dans 14 minutes, restez connectez! "));
    Le reste il faudrait le code complet + l'erreur dit par eclipse.

    En passant, formate ton code, car il est illisible …


  • Pour la 1ere erreur voici le code :

    package pixelbadge;
    
    import net.minecraft.item.Item;
    import pixelmonfr.pixelmain;
    
    public class ItemCarteMembre extends Item
    {
    public ItemCarteMembre(int par1)
    {
    
    this.setCreativeTab(pixelmain.pixelitems);
    this.setMaxStackSize(100);
    this.setContainerItem(book);
    }
    }
    
    

    Et voici l'erreur donné par eclipse :
    book cannot be resolved to a variable

    Pour le IIconRegister cela affiche de nouvelles erreurs pour la classe :

    package pixelblock;
    
    import javax.swing.Icon;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.util.IIcon;
    
    public class bibliotheque1 extends Block
    {
    private Icon nom0;
    private Icon nom1;
    private Icon nom2;
    private Icon nom3;
    private Icon nom4;
    private Icon nom5;
    
    public bibliotheque1(int id)
    {
    super(Material.grass);
    this.setCreativeTab(CreativeTabs.tabBlock);
    }
    
    /**
    * When this method is called, your block should register all the icons it needs with the given IconRegister. This
    * is the only chance you get to register icons.
    */
    public void registerIcons(IIconRegister iconregister)
    {
    this.blockIcon = IIconRegister .registerIcon("pixelmonfr:bibliotheque1");
    this.nom0 = IIconRegister.registerIcon("pixelmonfr:top1");
    this.nom1 = IIconRegister .registerIcon("pixelmonfr:top1");
    this.nom2 = IIconRegister .registerIcon("pixelmonfr:bibliotheque1");
    this.nom3 = IIconRegister .registerIcon("pixelmonfr:bibliotheque1");
    this.nom4 = IIconRegister .registerIcon("pixelmonfr:bibliotheque1");
    this.nom5 = IIconRegister .registerIcon("pixelmonfr:bibliotheque1");
    }
    
    /**
    * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
    */
    public IIcon getIconFromDamage(int side, int metadata)
    {
    return side == 0 ? this.nom0 : (side == 2 ? this.nom2 : (side == 3 ? this.nom3 : (side == 4 ? this.nom4 : (side == 5 ? this.nom5 : (side == 1 ? this.nom1 : this.blockIcon)))));
    }
    }
    
    

    Pour les erreurs :
    :::

    Cannot make a static reference to the non-static method registerIcon(String) from the type IIconRegister bibliotheque1.java /Minecraft/src/main/java/pixelblock line 32

    Cannot make a static reference to the non-static method registerIcon(String) from the type IIconRegister bibliotheque1.java /Minecraft/src/main/java/pixelblock line 33
    (idem jusqu'à la ligne 38)

    Type mismatch: cannot convert from Object to IIcon line 46

    :::

    Pour le dropPlayerItem voici la classe :

    package pixelcarte;
    
    import java.util.Random;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.world.World;
    import pixelmonfr.pixelmain;
    
    public class boostereau extends Item
    {
    public boostereau(int par1)
    {
    
    this.maxStackSize = 1;
    this.setCreativeTab(pixelmain.pixelcarte);
    }
    
    /**
    * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
    */
    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
    int r = (new Random()).nextInt(280);
    
    if (r > 0 && r < 10)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.tortank));
    }
    
    if (r > 0 && r < 10)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ptitard));
    }
    
    if (r > 0 && r < 10)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 0 && r < 10)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.rechercheinf));
    }
    
    if (r > 0 && r < 10)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.vaporetro));
    }
    
    if (r > 10 && r < 20)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.tartard));
    }
    
    if (r > 10 && r < 20)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.poissirene));
    }
    
    if (r > 10 && r < 20)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 10 && r < 20)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.fauxprofc));
    }
    
    if (r > 10 && r < 20)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.recup));
    }
    
    if (r > 20 && r < 30)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.tetarte));
    }
    
    if (r > 20 && r < 30)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.aquali));
    }
    
    if (r > 20 && r < 30)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.en));
    }
    
    if (r > 20 && r < 30)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.vaporetro));
    }
    
    if (r > 20 && r < 30)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.fillette));
    }
    
    if (r > 30 && r < 40)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.carapuce));
    }
    
    if (r > 30 && r < 40)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.akwakwak));
    }
    
    if (r > 30 && r < 40)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 30 && r < 40)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.rechercheinf));
    }
    
    if (r > 30 && r < 40)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 40 && r < 50)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.carabaffe));
    }
    
    if (r > 40 && r < 50)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.amonita));
    }
    
    if (r > 40 && r < 50)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.en));
    }
    
    if (r > 40 && r < 50)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.vaporetro));
    }
    
    if (r > 40 && r < 50)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.fillette));
    }
    
    if (r > 50 && r < 60)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.amonistar));
    }
    
    if (r > 50 && r < 60)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.kokiyas));
    }
    
    if (r > 50 && r < 60)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 50 && r < 60)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.fauxprofc));
    }
    
    if (r > 50 && r < 60)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.rechercheinf));
    }
    
    if (r > 60 && r < 70)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.crustabri));
    }
    
    if (r > 60 && r < 70)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.hypotrempe));
    }
    
    if (r > 60 && r < 70)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ef));
    }
    
    if (r > 60 && r < 70)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.vaporetro));
    }
    
    if (r > 60 && r < 70)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 70 && r < 80)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.hypocean));
    }
    
    if (r > 70 && r < 80)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.krabboss));
    }
    
    if (r > 70 && r < 80)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 70 && r < 80)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.fillette));
    }
    
    if (r > 70 && r < 80)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.rechercheinf));
    }
    
    if (r > 80 && r < 90)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.otaria));
    }
    
    if (r > 80 && r < 90)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.krabby));
    }
    
    if (r > 80 && r < 90)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.roucoups));
    }
    
    if (r > 80 && r < 90)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ef));
    }
    
    if (r > 80 && r < 90)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.vaporetro));
    }
    
    if (r > 90 && r < 100)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.lamentine));
    }
    
    if (r > 90 && r < 100)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.magicarpe));
    }
    
    if (r > 90 && r < 100)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.rapasdepic));
    }
    
    if (r > 90 && r < 100)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 90 && r < 100)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 100 && r < 110)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.leviator));
    }
    
    if (r > 100 && r < 110)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.krabby));
    }
    
    if (r > 100 && r < 110)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.rattatac));
    }
    
    if (r > 100 && r < 110)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ec));
    }
    
    if (r > 100 && r < 110)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.fillette));
    }
    
    if (r > 110 && r < 120)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.magicarpe));
    }
    
    if (r > 110 && r < 120)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.lokhlass));
    }
    
    if (r > 110 && r < 120)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.roucoups));
    }
    
    if (r > 110 && r < 120)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ep));
    }
    
    if (r > 110 && r < 120)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.rechercheinf));
    }
    
    if (r > 120 && r < 130)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.poissoroy));
    }
    
    if (r > 120 && r < 130)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.psykokwak));
    }
    
    if (r > 120 && r < 130)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.rapasdepic));
    }
    
    if (r > 120 && r < 130)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 120 && r < 130)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.vaporetro));
    }
    
    if (r > 130 && r < 140)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.stari));
    }
    
    if (r > 130 && r < 140)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.magicarpe));
    }
    
    if (r > 130 && r < 140)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.melofee));
    }
    
    if (r > 130 && r < 140)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ef));
    }
    
    if (r > 130 && r < 140)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 140 && r < 150)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.staross));
    }
    
    if (r > 140 && r < 150)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ptitard));
    }
    
    if (r > 140 && r < 150)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.rapasdepic));
    }
    
    if (r > 140 && r < 150)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.efeu));
    }
    
    if (r > 140 && r < 150)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 150 && r < 160)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.tentacool));
    }
    
    if (r > 150 && r < 160)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.carapuce));
    }
    
    if (r > 150 && r < 160)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.roucoups));
    }
    
    if (r > 150 && r < 160)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 150 && r < 160)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.rechercheinf));
    }
    
    if (r > 160 && r < 170)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.tentacruel));
    }
    
    if (r > 160 && r < 170)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.tetarte));
    }
    
    if (r > 160 && r < 170)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.miaouss));
    }
    
    if (r > 160 && r < 170)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.epsy));
    }
    
    if (r > 160 && r < 170)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.fauxprofc));
    }
    
    if (r > 170 && r < 180)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.leviator));
    }
    
    if (r > 170 && r < 180)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.poissirene));
    }
    
    if (r > 170 && r < 180)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.doduo));
    }
    
    if (r > 170 && r < 180)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.efeu));
    }
    
    if (r > 170 && r < 180)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.vaporetro));
    }
    
    if (r > 180 && r < 190)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.carabaffe));
    }
    
    if (r > 180 && r < 190)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.aquali));
    }
    
    if (r > 180 && r < 190)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.rattatac));
    }
    
    if (r > 180 && r < 190)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 180 && r < 190)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.rechercheinf));
    }
    
    if (r > 190 && r < 200)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.magicarpe));
    }
    
    if (r > 190 && r < 200)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.lamentine));
    }
    
    if (r > 190 && r < 200)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.miaouss));
    }
    
    if (r > 190 && r < 200)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.epsy));
    }
    
    if (r > 190 && r < 200)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 200 && r < 210)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.otaria));
    }
    
    if (r > 200 && r < 210)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.carapuce));
    }
    
    if (r > 200 && r < 210)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.doduo));
    }
    
    if (r > 200 && r < 210)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 200 && r < 210)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.rechercheinf));
    }
    
    if (r > 210 && r < 220)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.carapuce));
    }
    
    if (r > 210 && r < 220)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.aquali));
    }
    
    if (r > 210 && r < 220)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.melofee));
    }
    
    if (r > 210 && r < 220)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.efeu));
    }
    
    if (r > 210 && r < 220)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.vaporetro));
    }
    
    if (r > 220 && r < 230)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.carabaffe));
    }
    
    if (r > 220 && r < 230)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.magicarpe));
    }
    
    if (r > 220 && r < 230)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.roucoups));
    }
    
    if (r > 220 && r < 230)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ep));
    }
    
    if (r > 220 && r < 230)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.recup));
    }
    
    if (r > 230 && r < 240)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ptitard));
    }
    
    if (r > 230 && r < 240)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.otaria));
    }
    
    if (r > 230 && r < 240)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.miaouss));
    }
    
    if (r > 230 && r < 240)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 230 && r < 240)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.fauxprofc));
    }
    
    if (r > 240 && r < 250)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.carapuce));
    }
    
    if (r > 240 && r < 250)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.otaria));
    }
    
    if (r > 240 && r < 250)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.rattatac));
    }
    
    if (r > 240 && r < 250)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ec));
    }
    
    if (r > 240 && r < 250)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.vaporetro));
    }
    
    if (r > 250 && r < 260)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.staross));
    }
    
    if (r > 250 && r < 260)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.magicarpe));
    }
    
    if (r > 250 && r < 260)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.miaouss));
    }
    
    if (r > 250 && r < 260)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 250 && r < 260)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.recup));
    }
    
    if (r > 260 && r < 270)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.carapuce));
    }
    
    if (r > 260 && r < 270)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.otaria));
    }
    
    if (r > 260 && r < 270)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.doduo));
    }
    
    if (r > 260 && r < 270)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ep));
    }
    
    if (r > 260 && r < 270)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 270 && r < 279)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ptitard));
    }
    
    if (r > 270 && r < 279)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.magicarpe));
    }
    
    if (r > 270 && r < 279)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.rapasdepic));
    }
    
    if (r > 270 && r < 279)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.ee));
    }
    
    if (r > 270 && r < 279)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.vaporetro));
    }
    
    if (r == 280)
    {
    par3EntityPlayer.dropPlayerItem(new ItemStack(pixelmain.artikodin));
    }
    
    –par1ItemStack.stackSize;
    return par1ItemStack;
    }
    }
    
    

    Les erreurs sont :
    Description Resource Path Location Type
    The method dropPlayerItem(ItemStack) is undefined for the type EntityPlayer boostertr.java
    Pour chaque ligne ou la "dropPlayerItem" est présent.

    Pour l'erreur sur le nom de la classe :

    package pixelmonfr;
    
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.item.ItemStack;
    
    public class creatitems extends CreativeTabs
    {
    public creatitems(String label)
    {
    super(label);
    }
    
    public ItemStack getIconItemStack()
    {
    return new ItemStack(pixelmain.CarteMembre);
    }
    
    /**
    * Gets the translated Label.
    */
    public String getTranslatedTabLabel()
    {
    return this.getTabLabel();
    }
    }
    
    

    Voici l'erreur : The type creatitems must implement the inherited abstract method CreativeTabs.getTabIconItem()

    Et pour la classe que je t'ai donné dans le 1er poste l'erreur est :
    itemID cannot be resolved or is not a field CB.java
    A chaque endroit ou "itemId" est présent.

    Sinon quel est le raccourci pour formatter son code ?

  • Moddeurs confirmés Rédacteurs Administrateurs

    ctrl + shift + f
    .itemID n'existe plus, suffit de les enlever.
    this.setContainerItem(book); -> this.setContainerItem(Items.book);
    Pour tout ça :

    private Icon nom0;
    private Icon nom1;
    private Icon nom2;
    private Icon nom3;
    private Icon nom4;
    private Icon nom5;
    

    IIcon à la place de Icon.
    Pour ça :

    public void registerIcons(IIconRegister iconregister)
    {
    this.blockIcon = IIconRegister .registerIcon("pixelmonfr:bibliotheque1");
    this.nom0 = IIconRegister.registerIcon("pixelmonfr:top1");
    this.nom1 = IIconRegister .registerIcon("pixelmonfr:top1");
    this.nom2 = IIconRegister .registerIcon("pixelmonfr:bibliotheque1");
    this.nom3 = IIconRegister .registerIcon("pixelmonfr:bibliotheque1");
    this.nom4 = IIconRegister .registerIcon("pixelmonfr:bibliotheque1");
    this.nom5 = IIconRegister .registerIcon("pixelmonfr:bibliotheque1");
    }
    

    ça devient :

    public void registerBlockIcons(IIconRegister iconregister)
    {
    this.blockIcon = iconregister.registerIcon("pixelmonfr:bibliotheque1");
    this.nom0 = iconregister.registerIcon("pixelmonfr:top1");
    this.nom1 = iconregister.registerIcon("pixelmonfr:top1");
    this.nom2 = iconregister.registerIcon("pixelmonfr:bibliotheque1");
    this.nom3 = iconregister.registerIcon("pixelmonfr:bibliotheque1");
    this.nom4 = iconregister.registerIcon("pixelmonfr:bibliotheque1");
    this.nom5 = iconregister.registerIcon("pixelmonfr:bibliotheque1");
    }
    

    Pour la fonction dropPlayerItem, elle a surement changé de nom.

    Et pour l'onglet créatif :

    package pixelmonfr;
    
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.item.Item;
    
    public class creatitems extends CreativeTabs
    {
    public creatitems(String label)
    {
    super(label);
    }
    
    public Item getTabIconItem()
    {
    return pixelmain.CarteMembre;
    }
    

  • Pour la classe sans les "itemID" voici ce que cela donne :

    package pixelmonfr;
    
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.entity.Entity;
    import net.minecraft.item.ItemArmor;
    import net.minecraft.item.ItemStack;
    
    public class CB extends ItemArmor {
    public CB(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3,
    int par4) {
    super(par1, par2EnumArmorMaterial, par3, par4);
    }
    
    public String getArmorTexture(ItemStack stack, Entity entity, int slot,
    int layer) {
    if (stack == pixelmain.CB1 || stack == pixelmain.CB2
    || stack == pixelmain.CB4) {
    return "pixelmonfr:textures/armor/chemiseb_layer_1.png";
    }
    if (stack == pixelmain.CB3) {
    return "pixelmonfr:textures/armor/chemiseb_layer_2.png";
    } else {
    return null;
    }
    
    }
    
    public void registerIcons(IIconRegister reg) { // Make sure to import IconRegister!
    if ( == pixelmain.CB2) {
    this.itemIcon = reg.registerIcon("pixelmonfr:cb2"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    
    if ( == pixelmain.CB3) {
    this.itemIcon = reg.registerIcon("pixelmonfr:cb3"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    
    if ( == pixelmain.CB4) {
    this.itemIcon = reg.registerIcon("pixelmonfr:cb4"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    
    if ( == pixelmain.CB1) {
    this.itemIcon = reg.registerIcon("pixelmonfr:cb1"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    
    }
    }
    
    

    Cela donne donc des if avec des == vide.

    Pour les erreurs les voici :
    :::

    Incompatible operand types ItemStack and Item (ligne 13 à 18 même erreur)

    Syntax error on token "==", delete this token CB.java (ligne 26,30,34,38 : je vois pas quoi mettre à la place des "itemID" du coup)

    Type mismatch: cannot convert from Item to boolean CB.java (ligne 29,33,37,41)

    par2ArmorMaterial cannot be resolved to a variable CB.java (ligne 11)

    :::

    Sinon où puis-je me renseigner pour trouver le nouveau nom de la fonction : dropPlayerItem
    J'ai également un erreur sur la fonction : "setLightValue"
    Ici :

    Stats = (new Stats(10000)).setUnlocalizedName("Stats")
    .setTextureName("pixelmonfr:Stats").setCreativeTab(pixelitems);
    GameRegistry.registerItem(Stats, "Classement Joueur");
    LanguageRegistry.addName(Stats, "Classement Joueur");
    lampe1 = (new lampeBlanche1(2020)).setHardness(1.0F)
    .setStepSound(Block.soundTypeStone)
    .setBlockName("lampeblanche")
    .setBlockTextureName("pixelmonfr:lampe1")
    .setCreativeTab(pixelblock).setLightValue(1.0F);
    
  • Moddeurs confirmés Rédacteurs Administrateurs

    Il faut chercher dans la classe du joueur.

    Pour l'armure je te conseil de regarder le tutoriel 1.7.x du site.

    Et pour le setLightValue c'est étrange, ça devrait fonctionner normalement.


  • Pour le setLightValue voici l'erreur : The method setLightValue(float) is undefined for the type Block

  • Moddeurs confirmés Rédacteurs Administrateurs

    Ah si, elle a changée c'est setLightLevel maintenant.


  • Je viens de voir le tutoriel pour la création d'une armure.
    J'ai donc modifier ma classe par contre je bute sur la fonction registerIcons.
    Voici ma classe :

    package pixelmonfr;
    
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.entity.Entity;
    import net.minecraft.item.ItemArmor;
    import net.minecraft.item.ItemStack;
    
    public class CB extends ItemArmor {
    public CB(ArmorMaterial material, int type) {
    super(material, 0, type);
    }
    
    public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
    if(slot == 2)
    {
    return "pixelmonfr:textures/armor/chemiseb_layer_1.png";
    }
    
    return "pixelmonfr:textures/armor/chemiseb_layer_2.png";
    
    }
    
    public void registerIcons(IIconRegister reg) { // Make sure to import IconRegister!
    if (pixelmain.CB2) {
    this.itemIcon = reg.registerIcon("pixelmonfr:cb2"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    
    if ( == pixelmain.CB3) {
    this.itemIcon = reg.registerIcon("pixelmonfr:cb3"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    
    if ( == pixelmain.CB4) {
    this.itemIcon = reg.registerIcon("pixelmonfr:cb4"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    
    if ( == pixelmain.CB1) {
    this.itemIcon = reg.registerIcon("pixelmonfr:cb1"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    
    }
    }
    
  • Moddeurs confirmés Rédacteurs Administrateurs

    Elle ne sert à rien, tu peux définir les textures dans la déclarations de l'item directement avec .setTextureName
    Donc vire totalement cette fonction.


  • Ok merci par contre je ne trouve pas la fonction qui remplace "dropPlayerItem".
    Dans quelles classe faut-il que je cherche ?

  • Moddeurs confirmés Rédacteurs Administrateurs

    Visiblement c'est
    par3EntityPlayer.dropPlayerItemWithRandomChoice(new ItemStack(pixelmain.tortank), true);


  • Merci beaucoup pour cette précieuse aide et le temps que tu as accordé 😉