Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

  • Author

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

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

 

 

  • Author

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

You can subscribe directly to the various TickEvents, rather than the generic TickEvent

 

ServerTickEvent

ClientTickEvent

WorldTickEvent

PlayerTickEvent

RenderTickEvent

 

Those are all the tick events available at this time, that I can find, so you can use:

@SubscribeEvent
public void onTick(ClientTickEvent event)
{
// codes
}

  • Author

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

  • Author

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

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.