Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

How to get DeltaTime variable?  I tried to take one from the Minecraft instance and multiply by 3 (because the default is not 60 but 20 fps). This works, except that with shaders the variable becomes several times larger and the animations become too fast.

Edited by FoxBox

  • FoxBox changed the title to 1.18 Delta Time variable

Minecraft uses what's known as a partialTick which is some value between 0-1 that represents the frames between the previous tick and the current tick. Typically, you would have the original position and the new position, and then linearly interpolate using the partialTick (usually via `Mth#lerp`). The partialTick is provided in nearly all rendering methods as a float.

  • Author

Is it possible to add custom calculation of the usual Delta Time, which will work fine both with and without shaders?

  • Author

I tried to do it like this, but with shaders the animations are 2x faster..

private static long LAST_TIME = 0;
public static float DELTA_TIME = 0;

@SubscribeEvent
public static void onRenderTick(TickEvent.RenderTickEvent event) {
        if (event.phase == TickEvent.Phase.START) {
            final long time = Util.getNanos();
            DELTA_TIME = (time - LAST_TIME) / 16666666F;
            LAST_TIME = time;
        }
}

Edited by FoxBox

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.