Slimefun4 icon indicating copy to clipboard operation
Slimefun4 copied to clipboard

Adjust ticker times to show correct time on config changes for custom-ticker-delay

Open J3fftw1 opened this issue 1 year ago • 4 comments

Description

This PR adjust the tick rate based on the config value for custom-ticker-delay. It will try to keep the tickers execution at a similar speed as to when the default value is used.

I also adjust the displayed time based on the difference of execution time.

Proposed changes

Changed CraftingOperation to take into account the new ticks config. Normalize the value to the default one of one operation per 10 ticks.

Changed NumberUtils. Added logic that calculates the time new changes will take to finish the operation.

Related Issues (if applicable)

Not sure if there is na issue open.

Here is how to reproduce the issue:

  1. Adjust custom-ticker-delay to 20.
  2. Run a ticker ingame.
  3. The display timer will be wrong the execution slows down by 1/2 so the secounds and minutes are not synced to the actual values.

Checklist

  • [x] I have fully tested the proposed changes and promise that they will not break everything into chaos.
  • [ ] I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
  • [ ] I have made sure that the proposed changes do not break compatibility across the supported Minecraft versions (1.14.* - 1.19.*).
  • [x] I followed the existing code standards and didn't mess up the formatting.
  • [x] I did my best to add documentation to any public classes or methods I added.
  • [x] I have added Nonnull and Nullable annotations to my methods to indicate their behaviour for null values
  • [ ] I added sufficient Unit Tests to cover my code.

J3fftw1 avatar Jul 29 '23 16:07 J3fftw1

Your Pull Request was automatically labelled as: "🧹 Chores" Thank you for contributing to this project! ❤️

github-actions[bot] avatar Jul 29 '23 16:07 github-actions[bot]

Slimefun preview build

A Slimefun preview build is available for testing! Commit: 40fa170e

https://preview-builds.walshy.dev/download/Slimefun/3927/40fa170e

Note: This is not a supported build and is only here for the purposes of testing. Do not run this on a live server and do not report bugs anywhere but this PR!

github-actions[bot] avatar Jul 29 '23 16:07 github-actions[bot]

This should probably be addressed in MachineRecipe instead of CraftingOperation

iTwins avatar Nov 19 '23 01:11 iTwins