-
-
Notifications
You must be signed in to change notification settings - Fork 158
Accessory helper #1889
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
Open
viciscat
wants to merge
26
commits into
SkyblockerMod:master
Choose a base branch
from
viciscat:accessory-helper
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+744
−40
Open
Accessory helper #1889
Changes from 17 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
dce7213
basic implementation
viciscat 21a489d
show price after selling
viciscat b55fb65
cleaner optional chain
viciscat 3cbd145
highlight collected tier for upgrades
viciscat 32fc3e1
implement HoveredItemStackProvider
viciscat 970a82d
remember stuff when you switch page
viciscat 7bbdfc9
highest tier only option
viciscat d8c4dbf
open wiki on clicky
viciscat 72dd7b2
translatable
viciscat 8a1e1f5
move some things around
viciscat 62d73c4
config
viciscat fd16f03
Merge branch 'master' into accessory-helper
viciscat 54abd39
fix upgrade's price per MP not taking in account the upgraded accesso…
viciscat d7ecd29
rename a few things for consistency
viciscat 049705e
add new fields from the API (thanks aaron)
viciscat 44acbc2
recomb
viciscat e7fa8cc
commit the background texture
viciscat b9c788b
Merge branch 'master' into accessory-helper
viciscat 575616a
fixes
viciscat f58685a
Merge branch 'master' into accessory-helper
viciscat 7d5f659
1.21.11
viciscat aeccfa8
checkstyle
viciscat ad2d788
prepare mojmap transition
viciscat 07e521e
Merge branch 'master' into accessory-helper
viciscat aa8c0f2
Merge branch 'master' into accessory-helper
viciscat 43515bf
little merge oopsies
viciscat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/de/hysky/skyblocker/mixins/GenericContainerScreenMixin.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package de.hysky.skyblocker.mixins; | ||
|
|
||
| import com.llamalad7.mixinextras.expression.Definition; | ||
| import com.llamalad7.mixinextras.expression.Expression; | ||
| import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
| import net.minecraft.client.gui.screen.ingame.GenericContainerScreen; | ||
| import net.minecraft.client.gui.screen.ingame.HandledScreen; | ||
| import net.minecraft.entity.player.PlayerInventory; | ||
| import net.minecraft.screen.GenericContainerScreenHandler; | ||
| import net.minecraft.text.Text; | ||
| import org.spongepowered.asm.mixin.Mixin; | ||
| import org.spongepowered.asm.mixin.injection.At; | ||
|
|
||
| @Mixin(GenericContainerScreen.class) | ||
| public abstract class GenericContainerScreenMixin extends HandledScreen<GenericContainerScreenHandler> { | ||
|
|
||
| public GenericContainerScreenMixin(GenericContainerScreenHandler handler, PlayerInventory inventory, Text title) { | ||
| super(handler, inventory, title); | ||
| } | ||
|
|
||
| @Definition(id = "width", field = "Lnet/minecraft/client/gui/screen/ingame/GenericContainerScreen;width:I") | ||
| @Definition(id = "backgroundWidth", field = "Lnet/minecraft/client/gui/screen/ingame/GenericContainerScreen;backgroundWidth:I") | ||
| @Expression("(this.width - this.backgroundWidth) / ?") | ||
| @ModifyExpressionValue(method = "drawBackground", at = @At("MIXINEXTRAS:EXPRESSION")) | ||
| public int x(int ignored) { | ||
| return x; | ||
| } | ||
|
|
||
| @Definition(id = "height", field = "Lnet/minecraft/client/gui/screen/ingame/GenericContainerScreen;height:I") | ||
| @Definition(id = "backgroundHeight", field = "Lnet/minecraft/client/gui/screen/ingame/GenericContainerScreen;backgroundHeight:I") | ||
| @Expression("(this.height - this.backgroundHeight) / ?") | ||
| @ModifyExpressionValue(method = "drawBackground", at = @At("MIXINEXTRAS:EXPRESSION")) | ||
| public int y(int ignored) { | ||
| return y; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/de/hysky/skyblocker/skyblock/accessories/AccessoriesContainerSolver.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package de.hysky.skyblocker.skyblock.accessories; | ||
|
|
||
| import de.hysky.skyblocker.config.SkyblockerConfigManager; | ||
| import de.hysky.skyblocker.utils.container.SimpleContainerSolver; | ||
| import de.hysky.skyblocker.utils.render.gui.ColorHighlight; | ||
| import it.unimi.dsi.fastutil.ints.Int2ObjectMap; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.util.Colors; | ||
| import net.minecraft.util.math.ColorHelper; | ||
| import org.jetbrains.annotations.Nullable; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public class AccessoriesContainerSolver extends SimpleContainerSolver { | ||
| private static final int COLOR = ColorHelper.withAlpha(0.7f, Colors.GREEN); | ||
| public static final AccessoriesContainerSolver INSTANCE = new AccessoriesContainerSolver(); | ||
|
|
||
| @Nullable String highlightedAccessory; | ||
|
|
||
| protected AccessoriesContainerSolver() { | ||
| super(AccessoriesHelper.ACCESSORY_BAG_TITLE); | ||
| } | ||
|
|
||
| @Override | ||
| public List<ColorHighlight> getColors(Int2ObjectMap<ItemStack> slots) { | ||
| if (highlightedAccessory == null) return List.of(); | ||
| return slots.int2ObjectEntrySet().stream() | ||
| .filter(entry -> entry.getValue().getSkyblockId().equals(highlightedAccessory)) | ||
| .map(entry -> new ColorHighlight(entry.getIntKey(), COLOR)) | ||
| .toList(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isEnabled() { | ||
| return SkyblockerConfigManager.get().helpers.enableAccessoriesHelperWidget; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Pretty sure you can just slice for the one you want.
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.
but i liek expressions :((
more readable than to target the first changed local or whatever