Posted January 23, 201510 yr 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
January 23, 201510 yr 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
January 23, 201510 yr 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
January 23, 201510 yr This guy's tutorial on Events is very helpful I think. http://www.wuppy29.com/minecraft/modding-tutorials/wuppys-minecraft-forge-modding-tutorials-for-1-7-events/ Events are very straightforward once you've written your first handler -TGG
January 24, 201510 yr 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.