Hi everyone! I'm a little new to this part of the forum but I'm looking for a little help here. I understand how to make some basic mods like standard ores, item creation, smelting, and basic blocks that have a gui.So I know a little bit with MC modding, however I am not sure where to start on this one. I am looking to add something to a forge mod I am working on that does the following:
1. Manipulate the speed of ticks in a given range. For example:
I can place my block on the ground and open its UI, then in a text space I would type in a number, default being 20, and that number is how many ticks happen in 1 second in a 10X10X10 area.The block and gui I can do on my own.
I just don't know what to access to make this possible as I am still learning.Thanks for any help that is given and it will be very appreciated.
-TerraEnvy
Thanks for your help guys. I found something while researching it so I have an actual example now. In Dartcraft they have an item called a time torch that does almost exactly what I am talking about.
I will look more into Minecraft,run() and InternalServer.tick() But if anyone has an opinion about how the time torches were done, that would be great.
From the OP, I was expecting he wanted time to slow down, not speed up; speeding up is easy, as shown in one of the other posts, but slowing things down, that would require a ton more work.
@OP Also, like many others have mentioned, changing the rate of ticking by any dramatic amount probably isn't going to be very friendly, bug-wise, but on a small scale and limited scope (say, up to one extra tick every tick), you probably won't cause any problems and can certainly update Blocks as shown earlier. If you wanted to update Entities, too, well, who knows what would happen if you called the onUpdate method for each Entity an extra time or two per tick - I bet it would get very funky, very quickly.
The Meaning of Life, the Universe, and Everything.
Join Date:
7/2/2014
Posts:
55
Minecraft:
BinaryAura
Member Details
I this idea probably isn't the greatest but, if you're trying to speed things up or slow things down couldn't you do just that. The status effect speed infers there's already a method to change the speed of the player maybe there's one to slow other actions besides movement. For speeding things up you could call the swing method from the onUpdate() from your entity. Messing with the time for only a portion of the game seems risky to me. For the entire game seems hacky though, less risky because everything would still be snyced.
The Meaning of Life, the Universe, and Everything.
Join Date:
7/2/2014
Posts:
55
Minecraft:
BinaryAura
Member Details
I'm just thinking to create the illusion of time alteration since we aren't able to travel through time. It was just a thought, though. Trying to maybe get the same effect without cause a ton of issues. I'm aware that the to methods are completely different.
You might be able to get away with a time-stamps implementation depending on what you are trying to do...
My current (and first) mod basically has an internal clock. The goal of the mod is a little different though. It uses the clock to measure the time between chunk loading and unloading, and then updates the blocks accordingly (to ensure that, for example, crops keep growing when you are really far away).
Anyway, one of the things that sort of grew out of this was the ability to manipulate the internal clock and force updates to happen faster, slower, or not at all. For example, you can basically fast forward time, and everything (rather, all of the "time dependent" blocks, like crops, saplings, furnaces etc) will update accordingly. Another example is that I could set time in the end to flow much faster or slower than it does in the overworld, meaning that one minute in the end may be like an hour, or perhaps even one single second, in the overworld.
Anyway, you could do the same sort of thing with your mod (mine is open-source-free-to-use-any-part-of-it-however-you-want btw), such that when the player goes near the "time warping ultimate block of awesomeness", the game simply records a higher or lower rate of time flow and intermittently updates blocks accordingly while the player is in this area. Also, my own implementation uses a scheduling system which can only update a limited number of blocks per tick, meaning that theoretically you can basically update as many blocks as you want without causing lag.
That said, to slow time down in chunks that ARE loaded, you may need to find some way to stop random ticks from occurring... though if you can locate the block to update it, you can also change the "ticksRandomly" property to false (block.setTickRandomly(false)), so that shouldn't be much of a problem.
1. Manipulate the speed of ticks in a given range. For example:
I can place my block on the ground and open its UI, then in a text space I would type in a number, default being 20, and that number is how many ticks happen in 1 second in a 10X10X10 area.The block and gui I can do on my own.
I just don't know what to access to make this possible as I am still learning.Thanks for any help that is given and it will be very appreciated.
-TerraEnvy
There would be too many complications resulting from this. You'd need to rewrite how servers and clients interact and everything.
I will look more into Minecraft,run() and InternalServer.tick() But if anyone has an opinion about how the time torches were done, that would be great.
Thanks!
Link to vid about the time torch
-TerraEnvy
Any help would be appreciated.
-TerraEnvy
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumFrom the OP, I was expecting he wanted time to slow down, not speed up; speeding up is easy, as shown in one of the other posts, but slowing things down, that would require a ton more work.
@OP Also, like many others have mentioned, changing the rate of ticking by any dramatic amount probably isn't going to be very friendly, bug-wise, but on a small scale and limited scope (say, up to one extra tick every tick), you probably won't cause any problems and can certainly update Blocks as shown earlier. If you wanted to update Entities, too, well, who knows what would happen if you called the onUpdate method for each Entity an extra time or two per tick - I bet it would get very funky, very quickly.
I may end up postponing this one for now and working on another project for the time being.
-TerraEnvy
My current (and first) mod basically has an internal clock. The goal of the mod is a little different though. It uses the clock to measure the time between chunk loading and unloading, and then updates the blocks accordingly (to ensure that, for example, crops keep growing when you are really far away).
Anyway, one of the things that sort of grew out of this was the ability to manipulate the internal clock and force updates to happen faster, slower, or not at all. For example, you can basically fast forward time, and everything (rather, all of the "time dependent" blocks, like crops, saplings, furnaces etc) will update accordingly. Another example is that I could set time in the end to flow much faster or slower than it does in the overworld, meaning that one minute in the end may be like an hour, or perhaps even one single second, in the overworld.
Anyway, you could do the same sort of thing with your mod (mine is open-source-free-to-use-any-part-of-it-however-you-want btw), such that when the player goes near the "time warping ultimate block of awesomeness", the game simply records a higher or lower rate of time flow and intermittently updates blocks accordingly while the player is in this area. Also, my own implementation uses a scheduling system which can only update a limited number of blocks per tick, meaning that theoretically you can basically update as many blocks as you want without causing lag.
That said, to slow time down in chunks that ARE loaded, you may need to find some way to stop random ticks from occurring... though if you can locate the block to update it, you can also change the "ticksRandomly" property to false (block.setTickRandomly(false)), so that shouldn't be much of a problem.
I believe in the Invisible Pink Unicorn, bless her Invisible Pinkness.