GithubHelp home page GithubHelp logo

Comments (5)

LexManos avatar LexManos commented on May 28, 2024

You're setting the time in all dimensions, which you shouldn't be.
And our code most definitly sets to the same time as vanilla does:

            long j = this.levelData.getDayTime() + 24000L;
            this.setDayTime(j - j % 24000L);
            long j = this.getDayTime() + 24000L;
            this.setDayTime(net.minecraftforge.event.ForgeEventFactory.onSleepFinished(this, j - j % 24000L, this.getDayTime()));

So you're gunna need to provide more context to what you're doing.

from minecraftforge.

RealAntEngineer avatar RealAntEngineer commented on May 28, 2024

Ok, so more context :

My mod is plagued by this bug : https://bugs.mojang.com/browse/MC-188578

so when trying to solved it I found out that the command /time set .... was using something different than the bed ( what I used in fact), so I used the SleepFinishedTimeEvent to set the time on every level and it works.

So I think there is an issue with level.setDayTime as it seems to only work in the Overworld

from minecraftforge.

RealAntEngineer avatar RealAntEngineer commented on May 28, 2024

the setDayTime does nothing in the DerivedLevelData maybe that the issue ?

from minecraftforge.

RealAntEngineer avatar RealAntEngineer commented on May 28, 2024

I just found out that doing this

sleepFinishedEvent.getLevel().getServer().getLevel(Level.OVERWORLD).setDayTime(sleepFinishedEvent.getNewTime());

instead of that

for (ServerLevel serverlevel : sleepFinishedEvent.getLevel().getServer().getAllLevels()) {
serverlevel.setDayTime(sleepFinishedEvent.getNewTime());
}

also works

from minecraftforge.

LexManos avatar LexManos commented on May 28, 2024

You're correct, I was mistaken thought Mojang had properly desynced world times. Guess they haven't anyways, no if you're sleeping in other dimensions and want the world time to pass in the overworld looks like you have to explicitly set it.

from minecraftforge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.