• Récent
  • Mots-clés
  • Populaire
  • Utilisateurs
  • Groupes
  • S'inscrire
  • Se connecter
  • S'inscrire
  • Se connecter
  • Recherche
  • Récent
  • Mots-clés
  • Populaire
  • Utilisateurs
  • Groupes

Résolu Event n'est pas pris en compte

1.7.x
1.7.2
2
3
1.1k
Charger plus de messages
  • Du plus ancien au plus récent
  • Du plus récent au plus ancien
  • Les plus votés
Répondre
  • Répondre à l'aide d'un nouveau sujet
Se connecter pour répondre
Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
  • gargan
    gargan dernière édition par 16 avr. 2014, 23:21

    Bonjour à tous! Je ne comprends pas pourquoi mon event n’est pas pris en compte par forge! Voici mon code:

    package fr.lefgolas.PickAndCraft;
    import javax.swing.JOptionPane;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.gui.GuiMainMenu;
    import net.minecraft.client.gui.GuiScreen;
    import net.minecraftforge.common.MinecraftForge;
    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.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.eventhandler.SubscribeEvent;
    import cpw.mods.fml.common.gameevent.TickEvent;
    import cpw.mods.fml.common.gameevent.TickEvent.Phase;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import fr.lefgolas.PickAndCraft.Gui.GuiCustomMainMenu;
    import fr.lefgolas.PickAndCraft.Proxy.CommonProxy;
    @Mod(modid = "modtutoriel", name = "Mod Tutoriel", version = "1.0.0")
    public class Provisoire
    {
    @Instance("modtutoriel")
    public static Provisoire instance;
    @SidedProxy(clientSide = "fr.lefgolas.PickAndCraft.Proxy.ClientProxy", serverSide = "fr.lefgolas.PickAndCraft.Proxy.CommonProxy")
    public static CommonProxy proxy;
    @EventHandler
    public void preInit(FMLPreInitializationEvent event)
    {
    }
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    proxy.registerRender();
    MinecraftForge.EVENT_BUS.register(this);
    JOptionPane.showConfirmDialog(null, "1Would You Like to Save your Previous Note First?", "Warning", JOptionPane.YES_NO_CANCEL_OPTION);
    }
    @EventHandler
    public void postInit(FMLPostInitializationEvent event)
    {
    }
    @SubscribeEvent
    @SideOnly(Side.CLIENT)
    public void onTickClient(TickEvent.ClientTickEvent event)
    {
    System.out.println("++++++++++++++ début");
    JOptionPane.showConfirmDialog(null, "début", "Warning", JOptionPane.YES_NO_CANCEL_OPTION);
    if(event.phase == Phase.END)
    {
    JOptionPane.showConfirmDialog(null, "OK", "Warning", JOptionPane.YES_NO_CANCEL_OPTION);
    System.out.println("++++++++++++++ Phase.end");
    Minecraft mc = Minecraft.getMinecraft();
    GuiScreen currentScreen = mc.currentScreen;
    GuiCustomMainMenu customMenu = new GuiCustomMainMenu();
    if(currentScreen instanceof GuiMainMenu && !currentScreen.equals(customMenu))
    {
    mc.displayGuiScreen(customMenu);
    System.out.println("++++++++++++++ remplacement");
    }
    }
    }
    }
    1 réponse Dernière réponse Répondre Citer 0
    • robin4002
      robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par 17 avr. 2014, 08:17

      Car il s’agit d’un event FML. Donc
      FMLCommonHandler.instance().bus().register(this);
      et non
      MinecraftForge.EVENT_BUS.register(this);

      En passant réduit ta signature, elle est beaucoup trop grande.

      1 réponse Dernière réponse Répondre Citer 0
      • gargan
        gargan dernière édition par 17 avr. 2014, 17:10

        Merci! Oui je viens de m’apercevoir pour ma signature je change ça toute te suite 🙂

        1 réponse Dernière réponse Répondre Citer 0
        • 1 / 1
        2 sur 3
        • Premier message
          2/3
          Dernier message
        Design by Woryk
        Contact / Mentions Légales

        MINECRAFT FORGE FRANCE © 2018

        Powered by NodeBB