Event n'est pas pris en compte



  • 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");
    
    }
    }
    }
    }
    

  • Moddeurs confirmés Rédacteurs Administrateurs

    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.



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


Log in to reply