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

I am looking for a way to fire an event after a specific amount of server ticks have occured. The event is simple, write to a text file. Its part of a much larger idea I have.

 

1. What is the best way to so?

2. Is forge sandboxed in such a way that would prevent me from writing to a raw text file while the game is running? Not a config I am talking about an actual text file on the system.

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

Hi

 

If you're running a tick event anyway (ServerTickEvent - have you used Forge (FML) events before?) I would just add a counter.

 

eg

 

tickEvent(ServerTickEvent event)
{
  tickCount++;

  int ticksElapsedSinceTrigger = tickCount - triggerTickCount;
  if (ticksElapsedSinceTrigger >= EVENT_DELAY) {
    // write ye texte file
  }
}

 

I have successfully written text files to the minecraft game directory and saves directory.  Don't know if you can escape outside those.  Probably yes, I imagine.

 

-TGG

  • Author

I have not used ticks before. I thought this might be an easy way to implement something simple.

 

Don't I need to subscribe to a Forge Event Handler or something?

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

  • Author

After thinking on my idea a little more I realized it would be a very bad idea to fire as a tick on the server. The idea is to make a "mod" (if you can call it that really) that writes to a text file every (user configurable) half hour. Its a proof concept I have for a small server watcher tool. So this topic was not the right direction for me to go. Still helpful though thanks.

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

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.