Posted August 24, 201411 yr Hey guys So, I try to notice whenever a day ends. Is there an event for that? (guess no) Or is there an event that gets called whenever the time gets set to something new or anything reliable like that? Thanks for help
August 24, 201411 yr Author Uhm, @SubscribeEvent public void onTick(TickEvent event) { System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); } isnt doing anything (other events are working) And how can i get the world from TickEvent?
August 24, 201411 yr Why.... You can just calculate it by using the world time. IIRC 24000 ticks is a minecraft day, so just get the world time, do a little math and you have the day count. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
August 24, 201411 yr Author So, when a day ends at 2400, doesnt it get set to 0 again? cuz thats what i thought it does, or does it just continue with 2401? But anyway I would get into trouble when you use "/time set day" since then I would be at day 1 again
August 24, 201411 yr It continues on. As for time being changed by /time set, you have to allocate for that in your time comparison. When it changes, you're pretty much screwed anyway for getting real numbers, so you just have to deal. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
August 24, 201411 yr Author Ok, that solves my 1st Problem, but i still need a reliable event thats getting called once a minute or more often
August 24, 201411 yr How about? @SubscribeEvent public void onTickEvent(WorldTickEvent event) { // Overworld only if(event.world.provider.dimensionId != 0) { return; } // What time is it? long worldTime = event.world.getWorldTime(); // 24000 ticks is one minecraft day if(worldTime%24000 != 0) { return; } // Do something } The event is https://docs.larry1123.net/forge/1060/cpw/mods/fml/common/gameevent/TickEvent.WorldTickEvent.html You need to register FMLCommonHandler.instance().bus().register(new yourClass());
August 25, 201411 yr Author You need to register FMLCommonHandler.instance().bus().register(new yourClass()); Alright, got the problem I was using this: MinecraftForge.EVENT_BUS.register(new yourClass()); Now its actually working, thanks a lot
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.