Skip to content

Commit

Permalink
Always show the inventory context buttons
Browse files Browse the repository at this point in the history
...unless dragging
  • Loading branch information
Protonull committed Sep 10, 2024
1 parent b42cfe4 commit 9e59edd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package uk.protonull.civ.chesttracker.mixins;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import red.jackf.chesttracker.impl.gui.invbutton.ui.InventoryButton;

@Mixin(InventoryButton.class)
public abstract class AlwaysShowContextButtons {
@Shadow(remap = false)
private boolean isDragging;

@ModifyVariable(
method = "showExtraButtons",
at = @At("HEAD"),
argsOnly = true,
remap = false
)
protected boolean ctt$modify_variable$showExtraButtons$alwaysShow(
final boolean shouldShow
) {
if (this.isDragging) {
return shouldShow;
}
return true;
}
}
4 changes: 3 additions & 1 deletion src/main/resources/civchesttracker.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"illegal.AlwaysReturnNoBlockSourceMixin",
"illegal.DoNotRegisterBlockBreakListenerMixin",
"illegal.DoNotRegisterBlockPlaceListenerMixin",
"illegal.DoNotRegisterUseBlockListenerMixin"
"illegal.DoNotRegisterUseBlockListenerMixin",

"AlwaysShowContextButtons"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 9e59edd

Please sign in to comment.