Jump to content

Recommended Posts

Posted

Should i use TickEvent as tickhandler (if yes how) and is it possible to use FMLCommonHandler with onpreclienttick and onpostclienttick? how to register the tickhandler?

 

What about the PickupHandler?

Actually i don't know what to write in this signature soooo.... anyway

Posted

but now i have two codes that i know are used to register event, have i to use both or have i to use one of them? what one?

 

MinecraftForge.EVENT_BUS.register(new mod_Glacia.TickHandlerClient());

 

or

 

FMLCommonHandler.instance().bus().register(new mod_Glacia.TickHandlerClient());

Actually i don't know what to write in this signature soooo.... anyway

Posted

There are four different buses, two of main interest:

 

Forge events goes on the MinecraftForge.EVENT_BUS

 

FML events go on the FMLCommonHandler bus

 

If you register your event on the wrong bus it won't be called.

 

Easiest way: look to see which package it is in.

 

TickEvent is in package cpw.mods.fml, so use FMLCommonHandler

 

and eg ClientChatReceivedEvent is in net.minecraftforge, so use MinecraftForge

 

-TGG

 

 

Posted

Is this code good?

 

public static class TickHandlerClient

    {

 

private GuiScreen lastGuiOpen;

 

@SubscribeEvent

public void onTick(TickEvent event)

{

//CLIENT TICK

if (event.type == TickEvent.Type.CLIENT && event.side == Side.CLIENT)

{

//CLIENT TICK START

if (event.phase == TickEvent.Phase.START)

{

final Minecraft minecraft = FMLClientHandler.instance().getClient();

 

            final WorldClient world = minecraft.theWorld;

 

            if (world != null)

            {

            if (world.provider instanceof WorldProviderGlacia)

                {

            if (world.provider.getSkyRenderer() == null)

                    {

            world.provider.setSkyRenderer(new GlacialSkyProvider());

                    }

                }

            }

}

 

//CLIENT TICK END

else

{

Minecraft minecraft = Minecraft.getMinecraft();

 

GuiScreen var15 = minecraft.currentScreen;

 

int var14;

 

if (var15 != null)

{

if (var15 instanceof GuiAchievements)

{

var14 = ((GuiAchievements)var15).currentPage;

 

if (AchievementPage.getTitle(var14).equals("Glacia"))

{

minecraft.thePlayer.openGui(mod_Glacia.instance, GlaciaCommonProxy.GUI_ID_ACHIEVEMENTS, minecraft.theWorld, var14, 0, 0);

}

}

 

if (var15 instanceof GuiAchievementsGlacia)

{

var14 = ((GuiAchievementsGlacia)var15).currentPage;

 

if (!AchievementPage.getTitle(var14).equals("Glacia"))

{

GuiAchievements var16 = new GuiAchievements(var15, minecraft.thePlayer.getStatFileWriter());

var16.currentPage = var14;

FMLClientHandler.instance().displayGuiScreen(minecraft.thePlayer, var16);

}

}

}

}

}

}

    }

Actually i don't know what to write in this signature soooo.... anyway

Posted

like this?

 

    public static class TickHandlerClient

    {

 

private GuiScreen lastGuiOpen;

 

@SubscribeEvent

public void onTick(TickEvent.ClientTickEvent event)

{

//CLIENT TICK START

if (event.phase == TickEvent.Phase.START)

{

final Minecraft minecraft = FMLClientHandler.instance().getClient();

 

            final WorldClient world = minecraft.theWorld;

 

            if (world != null)

            {

            if (world.provider instanceof WorldProviderGlacia)

                {

            if (world.provider.getSkyRenderer() == null)

                    {

            world.provider.setSkyRenderer(new GlacialSkyProvider());

                    }

                }

            }

}

 

//CLIENT TICK END

else

{

Minecraft minecraft = Minecraft.getMinecraft();

 

GuiScreen var15 = minecraft.currentScreen;

 

int var14;

 

if (var15 != null)

{

if (var15 instanceof GuiAchievements)

{

var14 = ((GuiAchievements)var15).currentPage;

 

if (AchievementPage.getTitle(var14).equals("Glacia"))

{

minecraft.thePlayer.openGui(mod_Glacia.instance, GlaciaCommonProxy.GUI_ID_ACHIEVEMENTS, minecraft.theWorld, var14, 0, 0);

}

}

 

if (var15 instanceof GuiAchievementsGlacia)

{

var14 = ((GuiAchievementsGlacia)var15).currentPage;

 

if (!AchievementPage.getTitle(var14).equals("Glacia"))

{

GuiAchievements var16 = new GuiAchievements(var15, minecraft.thePlayer.getStatFileWriter());

var16.currentPage = var14;

FMLClientHandler.instance().displayGuiScreen(minecraft.thePlayer, var16);

}

}

}

}

}

    }

Actually i don't know what to write in this signature soooo.... anyway

Posted

i can't still test it because it is part of my dimension mod and sill have a lot of codes to fix

 

ps: what can replace Achievement.getName() //<<doesn't exist enymore

Actually i don't know what to write in this signature soooo.... anyway

Posted

Hi

 

Just a general suggestion, I find with new code that it's very helpful to try it in small pieces and get it working by itself before I try to integrate it into a bigger project.  I keep a separate project called "TestFramework" full of simple classes to test out my new classes and make sure I understand how they work - Item Renderers, Tick Handlers, Tile Entities, etc.  Otherwise it just gets too hard to figure out where the bugs are.

 

-TGG

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.