Jump to content

Tick Handlers?


apuppy120

Recommended Posts

I've been trying to figure out how to get a "Star Catcher" to work, where it drops an item downwards X amount of ticks. I've managed to get it to drop the item. but I can get it to increment a variable very tick, then when variable is = to Y, reset variable and do something. Here is my code (The code that drops the item isn't included, but if it was, it would be under tickEnd):

public void tickStart(EnumSet<WorldTickEvent.Type> type, Object... tickData)
{

}

public EnumSet<WorldTickEvent.Type> ticks()
{
	return EnumSet.of(WorldTickEvent.Type.WORLD);
}



public void tickEnd(EnumSet<WorldTickEvent.Type> type, Object... tickData)
{
	if(currentTick/20 < 15  || isLesserStarReady == false)
	{
		currentTick++;
		System.out.println("BlockTick!");
	}else if(currentTick/20 >= 15)
	{
		System.out.println("Star Ready!");
		isLesserStarReady = true;
	}
}

 

Please help?

glubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglub.

Link to comment
Share on other sites

1.7.10. I know that I need to subscribe, but I dont know how I'm supposed to, and apparently I'm also supposed to register a tick handler.

glubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglub.

Link to comment
Share on other sites

public class Ticker{
    @SubscribeEvent
    public void worldTick(TickEvent.WorldTickEvent event) {
        if (event.phase == TickEvent.Phase.END){
          do_something();
        }
    }
}

 

FMLCommonHandler.instance().bus().register(new Ticker());

 

Link to comment
Share on other sites

public class Ticker{
    @SubscribeEvent
    public void worldTick(TickEvent.WorldTickEvent event) {
        if (event.phase == TickEvent.Phase.END){
          do_something();
        }
    }
}

 

FMLCommonHandler.instance().bus().register(new Ticker());

 

Thanks!

glubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglubglub.

Link to comment
Share on other sites

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.