Jump to content

[1.7.2] Time Manipulation


delpi

Recommended Posts

I'm trying to have different time in one of my dimensions.  Basically I want it to be night all the time. 

 

I've tried searching through all the Minecraft classes and seeing how to do this.  I'm having zero success.  At this point, I'm afraid that the way the worlds tick that it is overriding my time change in the single dimension. 

 

Any advice?

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

When modding I find it is best to start with the closest vanilla Minecraft method and see how it is done there.

 

In that case, I would look at the vanilla command for /time set.  So I think you should look the CommandTime class.  In there there is a setTime() method which looks likely to give ideas on how to do what you want.

 

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Thanks.  I usually succeed with the same approach that you use.

 

In this case it isn't working.  The set time command and it's related subcommands end up setting the time in all dimension to the same thing.  It doesn't look like it should, but there seems to be a method in world server that gets a tick update to sync them all. 

 

I'm hoping the I'm reading it wrong and someone else found a way to have a unique time in each dimension

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

Well it is only setting it in all dimensions because it has a FOR loop that goes through each dimension.  If you can just identify the world server you care about, seems like you could just set the one?

 

Then to find out where the sync is happening, I guess search for other methods that affect the worldservers with same methods and see how that behaves and where it is invoked.  I'm not at a computer with source on it, otherwise I'd help you look.  But I think you know what I mean -- find all the other places in the code where the worldserver time is set and you should find out the method that is causing the sync.  The only question then is whether you can intercept that method (prevent it from happening), or override it (set it yourself right after the sync).

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

I found it and you might have the ticket.  I could track it separately and the change it each tick. 

 

Problem will be finding a trigger I can monitor that indicates it happened.

 

It is inside the world server class an doesn't appear to pass through anything I have customary this point.

 

Anybody used a custom world info for their dimension before??

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

Problem will be finding a trigger I can monitor that indicates it happened.

 

Now that I think about it, you only have to ensure the time is set before it is actually used.  I'm not sure the order of all the underlying steps on the server side, but depending on the effect you're actually after maybe you just have to override the method that renders the celestial sky?

 

Also, there is a command "/gamerule doDaylightCycle false" that simply stops the day-night cycle which you may want to check out for ideas.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

I had put a workaround in place like that. 

 

Basically I changed my custom provider to have no sky so the light value from the sky is always zero.  Created. Custom skyrender to make it always look night.  Right now there is no moon or sun, but I might add the moon back.  I also change the gamma to -0.25 for anyone in it.

 

It makes it very challenging.  I only have creepers in it.  6 custom ones.  I upped the diamond ore spawns an added a rare ore. 

 

You have to use creeper head with obsidian to make a portal.

 

 

It all works well.

 

I just want to figure out the time per dimension thing for a new mod idea that I have.

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

The way time works in minecraft is kind of tricky which is why mods just create a custom provider to remove the sky and change with their own however the side effect of this is time still passes.If you had something that required a certain time of day even though it might look like noon in the dimension well the actual time is midnight so whatever you are trying to do won't work. I have had lots of people contact me reporting a bug where the sun dial in my mod says it is midnight in their constant day age of mystcraft.

Link to comment
Share on other sites

The way time works in minecraft is kind of tricky which is why mods just create a custom provider to remove the sky and change with their own however the side effect of this is time still passes.If you had something that required a certain time of day even though it might look like noon in the dimension well the actual time is midnight so whatever you are trying to do won't work.

 

Yeah, for one thing it seems to me that monster spawning might screw up if they are supposed to spawn at night but it is really daytime with just a night sky...

 

I'm still interested in how you might fix the time similar to the /time set command.  If you could just issue that command every tick, it seems to me that it would work, although delpi is indicating above that it is somehow being overwritten or ignored when he tried it (plus the /time set command seems to affect all worldservers simultaneously).

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

I 'think' I pulled off telling it to just change the time in one world and but posting to the log at various parts of tick events, I would see it change for a fraction of a tick, then it would be the same as all the others.

 

Something is calling the method to write to all of them.

 

For your comment about mobs spawning with a night sky.  If you use the nosky variable, then there is no light in the world.  I 'think' that mobs try to spawn always, but when they test for light and there is too much, they do not.  This looks like it is working right in my custom dimension I talked about above. 

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

I 'think' I pulled off telling it to just change the time in one world and but posting to the log at various parts of tick events, I would see it change for a fraction of a tick, then it would be the same as all the others.

 

Something is calling the method to write to all of them.

 

For your comment about mobs spawning with a night sky.  If you use the nosky variable, then there is no light in the world.  I 'think' that mobs try to spawn always, but when they test for light and there is too much, they do not.  This looks like it is working right in my custom dimension I talked about above.

 

I know the mob spawning would be fine but say you place a block that uses the time in always dark world it will still be at the power for the middle of the day well it appears to be night. Also if you get the time separate make sure that it doesn't mess up the clock.

Link to comment
Share on other sites

For your comment about mobs spawning with a night sky.  If you use the nosky variable, then there is no light in the world.  I 'think' that mobs try to spawn always, but when they test for light and there is too much, they do not.  This looks like it is working right in my custom dimension I talked about above.

 

Well, I understand that the monster spawning is logically "is there light", but I don't like to assume that the logic is exactly related to real, rendered lighting.  Like the "is there light" logic might really be "should there be light based on time of day".  You probably looked at it already, but the check for light for monster spawning may include some check for time of day whether or not it is rendering an actual sky or a sky with the sun in it.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

There is a simple way to do this. Just have the sun stop(or have the minecraftia stop), not the time.

Of course it is a lot harder to stop the time than the sun.

 

It can be easily done by this way:

There is "getCelestialAngle" method in the WorldProvider class.

You can modify the method, and set it return 270 degrees on every time.

Then the sun will always be at directly downward, and the moon at directly upward(Zenith).

 

 

* The following passage is editorial.

Please do not neglect the sky. It nearly controls everything.

Everything on the earth have period of 1 day, respecting to the sun,

and 1 month is based on the rotation of the moon.

 

I think the developers of minecraft is also neglecting the events of the sky.

The sky in minecraft is simple and repetitive, while the real sky is not.

The sun and moon is NOT moving at same rate, and there is several events with the real sky.

Of course someone think it would be hard to show the events in the game,

but it is not that hard compared to the other mechanisms in it.

 

This passage was only editorial, anyway.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

The sun and moon is NOT moving at same rate, and there is several events with the real sky.

 

I certainly always think it is weird how we often associate the moon with the night, when of course it is up in the day just as much.  Sure, it is more prominent at night, but most people seem to actually talk and think like the moon comes up at night.

 

Sounds like you should make a "true sky" mod, complete with constellations!

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Sounds like you should make a "true sky" mod, complete with constellations!

 

Yes, I'm already making one.

It is named "Stellarium for minecraft".

you can find it in a "Mods" subforum of Minecraft Forge Forum.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
    • It is an issue with quark - update it to this build: https://www.curseforge.com/minecraft/mc-mods/quark/files/3642325
    • Remove Instant Massive Structures Mod from your server     Add new crash-reports with sites like https://paste.ee/  
  • Topics

×
×
  • Create New...

Important Information

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