• Bonjour.

    En suivant le tutoriel, j’ai deux problèmes :

    Crash: Le jeu crash quand je le lance (après Mojang). Voila le Crash-Repot:

    –-- Minecraft Crash Report ----
    // You should try our sister game, Minceraft!
    
    Time: 02/09/13 17:25
    Description: There was a severe problem during mod loading that has caused the game to fail
    
    cpw.mods.fml.common.LoaderException: java.lang.Error: Unresolved compilation problem:
    Type mismatch: cannot convert from Item to Mod.Item
    
    at cpw.mods.fml.common.LoadController.transition(LoadController.java:149)
    at cpw.mods.fml.common.Loader.loadMods(Loader.java:521)
    at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:181)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:470)
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:796)
    at net.minecraft.client.main.Main.main(Main.java:93)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:57)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:18)
    Caused by: java.lang.Error: Unresolved compilation problem:
    Type mismatch: cannot convert from Item to Mod.Item
    
    at telque.common.ModTelque.preInit(ModTelque.java:58)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:540)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
    at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:194)
    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:174)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:105)
    at cpw.mods.fml.common.Loader.loadMods(Loader.java:520)
    ... 10 more
    
    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------
    
    -- System Details --
    Details:
    Minecraft Version: 1.6.2
    Operating System: Windows 7 (amd64) version 6.1
    Java Version: 1.7.0_25, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 763874440 bytes (728 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    Suspicious classes: FML and Forge are installed
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP v8.04 FML v6.2.57.844 Minecraft Forge 9.10.0.844 4 mods loaded, 4 mods active
    mcp{8.04} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
    FML{6.2.57.844} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized
    Forge{9.10.0.844} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized
    ModTelque{1.0.0} [Mod Telque] (bin) Unloaded->Constructed->Errored
    

    Et la classe qui crash:

    package telque.common;
    
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.item.Item;
    
    public class diamondDust extends Item
    {
    
    public diamondDust(int id)
    {
    super(id);
    this.setCreativeTab(CreativeTabs.tabMaterials);
    // TODO Auto-generated constructor stub
    }
    
    }
    

    Ensuite, j’ai une erreur à cette ligne :

    diamondDust = new diamondDust(12000).setUnlocalizedName("diamondDust").func_111206_d("modtelque:diamondDust");
    

    Il me souligne de ‘new’ jusqu’au ‘;’ en rouge, et quand je corrige, ca me rajoute un (Item) devant ‘new’

    diamondDust = (Item) new diamondDust(12000).setUnlocalizedName("diamondDust").func_111206_d("modtelque:diamondDust");
    

    Mais ca ne marche toujours pas.

    Merci des futurs réponses !

  • Administrateurs Rédacteurs Moddeurs confirmés

    Je peux voir tes importations et la déclaration de l’item ?


  • Bien sûr !

    public static Item diamondDust, obsidianDust, ingotSteel, steelStick, rubis, saphir, telque, aquatelque, pyrotelque;
    

    Et les import :
    Ceux de la classe principale

    
    import net.minecraft.block.Block;
    import tutoriel.proxy.TutoCommonProxy;
    import cpw.mods.fml.common.Mod;
    import cpw.mods.fml.common.Mod.EventHandler;
    import cpw.mods.fml.common.Mod.Instance;
    import cpw.mods.fml.common.Mod.Item;
    import cpw.mods.fml.common.SidedProxy;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.event.FMLPostInitializationEvent;
    import cpw.mods.fml.common.event.FMLPreInitializationEvent;
    import cpw.mods.fml.common.network.NetworkMod;
    import cpw.mods.fml.common.registry.GameRegistry;
    

    Et ceux de la classe de l’item

    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.item.Item;
    
    
  • Administrateurs Rédacteurs Moddeurs confirmés

    import cpw.mods.fml.common.Mod.Item; -> import net.minecraft.item.Item;
    dans la classe principale.
    Retire le cast que tu as mit en même temps (ça : (Item) new blablabla …)


  • Ok ! Merci beaucoup, et désolé du dérangement