Jump to content

Periodic data save (or how to get a timer server side)


Recommended Posts

I'm have a command mod that saves it's data in NBT format.  It's stored in memory for performance reasons, but I would like to write it to disk say every 15 minutes.  The math is no problem, the problem is I can't seem to find a way to get a timer event notification server-side.  The Timer class is client-side only.


Is there a tick event or some other less obvious way to achieve this?  Or is there a way to tap into the /save-on command so I can write the data back out?  I'd hate to have to write the data every time a user makes a change.




Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now


  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • If your Apex Hosting server crashes with mods, check compatibility, allocate enough RAM, and keep mods updated to ensure a stable gaming experience. Troubleshoot specific mod issues for solutions. Learn more
    • Pls help, I have selfmade modpack and I don't know what is wrong... Minecraft version: 1.19.2 forge: 43.3.0 tetra: 5.5.1 I already checked all the addons of tetra, they are not wrong, it is still crushing even when tetra don't have addons Latest log: https://github.com/Igitoro/tetra-crush/blob/main/latest.log Crash-report: https://github.com/Igitoro/tetra-crush/blob/main/crash-2023-09-24_11.33.47-fml.txt  
    • and i ran clean and build so many times  
    • i only made changes to the things shown in tutorial ie. mod id and mod group
    • It wasnt mappings issue, I was reading fabric and not forge. Fabric has PlayerEntity while forge has Player. Through a mixin I was able to change the player's velocity so that there is a sort of slow-motion type movement. Only issue is that jumping seems to be handled separately. Changing that velocity only makes the jump lower, not slower. Unsure how to increase the duration in which a jump happens.   @Mixin(LivingEntity.class) public abstract class ExampleMixin extends Entity { public ExampleMixin(EntityType<?> type, World world) { super(type, world); } @Inject(method = "tickMovement", at = @At("HEAD")) private void onTickMovement(CallbackInfo ci) { // Access the player entity LivingEntity entity = (LivingEntity)(Object)this; // Modify player's acceleration by applying a force in the opposite direction double slowdownFactor = 0.75; // Adjust as needed entity.setVelocity(entity.getVelocity().multiply(1, slowdownFactor, 1)); } }  
  • Create New...

Important Information

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