-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add powder mining tracker #1065
Add powder mining tracker #1065
Conversation
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.
This also needs to be rebased for 1.21.4
src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java
Outdated
Show resolved
Hide resolved
return NAME2ID_MAP.getOrDefault(itemName, ""); | ||
} | ||
|
||
private static Path getRewardFilePath() { |
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.
This should be a constant unless it can't be?
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.
It can be, but I had a better solution on another branch that is based on this so I didn't bother to change to avoid a rebase.
src/main/java/de/hysky/skyblocker/skyblock/dwarven/PowderMiningTracker.java
Outdated
Show resolved
Hide resolved
src/main/java/de/hysky/skyblocker/skyblock/dwarven/PowderMiningTracker.java
Outdated
Show resolved
Hide resolved
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.
Is there a reason for making chat events as opposed to using Fabric's ones?
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.
Fabric's injection is like this:
if (ClientReceiveMessageEvents.ALLOW_GAME.invoker().allowReceiveGameMessage(message.get(), overlay)) {
message.set(ClientReceiveMessageEvents.MODIFY_GAME.invoker().modifyReceivedGameMessage(message.get(), overlay));
ClientReceiveMessageEvents.GAME.invoker().onReceiveGameMessage(message.get(), overlay);
} else {
ClientReceiveMessageEvents.GAME_CANCELED.invoker().onReceiveGameMessageCanceled(message.get(), overlay);
ci.cancel();
}
To listen to every incoming message, you'd have to register a listener to ALLOW_GAME
that always returns true and never has anything to do with allowing messages or not. On top of that, if any listener before yours in ALLOW_GAME
cancels it, your listener does not get called. So you have to register the same listener to GAME_CANCELED
as well and complicate things even more. Oh and the 2 functional interfaces don't match due to their return values of boolean
and void
, so you need 3 whole methods (or lambdas) to achieve this.
This is easily solved by adding an event that passes the message to every listener without allowing any modifications, which is what the events I added do. They also don't interfere with fabric's events since they don't modify the message in any way.
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.
I've talked to fabric maintainers about this. The most probably fix that we can put in fabric is just to make ALLOW_GAME
not short curcuit. But they're skeptical of such use cases, and it might help if you bring this problem up with them.
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.
I can see why they wouldn't want to make a breaking change like that, and using ALLOW_GAME
to listen to all incoming messages is still going to be confusing due to the name and the unnecessary return value, so I'm not sure if that's the solution I'd want. Perhaps I could PR this event to fabric, but I can't think of any use cases outside of this either.
43f8b6d
to
33a9cc8
Compare
0f2fb40
to
3d6642b
Compare
src/main/java/de/hysky/skyblocker/skyblock/dwarven/PowderMiningTracker.java
Show resolved
Hide resolved
Regex my beloved
Also a small fix for the regex
3d6642b
to
074b818
Compare
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.
looks good
Powder mining tracker that tracks rewards and calculates your total profit.
This does not include the money from blocks/other drops you might gain along the way (such as sludge from jungle pick if you go down that route).
Has a configurable filter to block items from being listed and used in profit calculation.
Saves rewards to disk upon closing the game and reads from disk upon launching the game.
Also adds some chat events that are fired regardless of cancels with no modifications (realistically only against those done via fabric's events).
Some considerations