Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Simba98
Copy link

@Simba98 Simba98 commented Aug 27, 2024

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.

@Simba98
Copy link
Author

Simba98 commented Sep 18, 2024

Updated to newest commit

@62832
Copy link
Member

62832 commented Sep 18, 2024

Please run the spotlessApply Gradle task for proper code formatting and for the automated build to pass.

@Simba98
Copy link
Author

Simba98 commented Sep 19, 2024

Please run the spotlessApply Gradle task for proper code formatting and for the automated build to pass.

Hi 62832, thanks for reminding me. I have applied the spotless format check and passed the checks.
And also there is a back port for 1.20.1 on #8171

}

public long getStartItemCount() {
return this.startItemCount;
return Math.round(((float) this.startItemCount) / AEKEY_SCALE_FACTOR);
Copy link

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?

Copy link
Author

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.

Copy link

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?

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants