-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement ElapsedTimeTracker to support AEKeyType AmountPerUnit scaling #8170
base: main
Are you sure you want to change the base?
Conversation
Updated to newest commit |
Please run the |
Hi 62832, thanks for reminding me. I have applied the spotless format check and passed the checks. |
} | ||
|
||
public long getStartItemCount() { | ||
return this.startItemCount; | ||
return Math.round(((float) this.startItemCount) / AEKEY_SCALE_FACTOR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use integer division here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use integer division here?
Integer Division equals Math.floor, making the 99/10 = 9 instead of 10 in this case.
I want to round to make it more precise in displaying, for showing progress, the trade-off is performance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to simulate math.round() with integer division you can add half of the AE_SCALE_FACTOR before dividing, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to simulate math.round() with integer division you can add half of the AE_SCALE_FACTOR before dividing, right?
You are right. I have updated.
Implement #7321, and replace #8045.
This is by adding internal scaling to keep the tracker as an integer.
Possible issue: broken changes due to NBT data in the disk may be invalid.