forked from maruohon/tweakeroo
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b72908
commit 5e07d0c
Showing
6 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 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
35 changes: 35 additions & 0 deletions
35
src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBundleItem.java
This file contains 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,35 @@ | ||
package fi.dy.masa.tweakeroo.mixin; | ||
|
||
import java.util.Optional; | ||
|
||
import net.minecraft.item.BundleItem; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.tooltip.TooltipData; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import fi.dy.masa.malilib.gui.GuiBase; | ||
import fi.dy.masa.tweakeroo.config.Configs; | ||
import fi.dy.masa.tweakeroo.config.FeatureToggle; | ||
|
||
@Mixin(BundleItem.class) | ||
public class MixinBundleItem | ||
{ | ||
@Inject(method = "getTooltipData", at = @At("HEAD"), cancellable = true) | ||
private void tweakeroo_getTooltipData(ItemStack stack, CallbackInfoReturnable<Optional<TooltipData>> cir) | ||
{ | ||
if (FeatureToggle.TWEAK_BUNDLE_DISPLAY.getBooleanValue() && | ||
Configs.Generic.BUNDLE_DISPLAY_REQUIRE_SHIFT.getBooleanValue() && | ||
GuiBase.isShiftDown()) | ||
{ | ||
cir.setReturnValue(Optional.empty()); | ||
} | ||
else if (FeatureToggle.TWEAK_BUNDLE_DISPLAY.getBooleanValue() && | ||
!Configs.Generic.BUNDLE_DISPLAY_REQUIRE_SHIFT.getBooleanValue()) | ||
{ | ||
cir.setReturnValue(Optional.empty()); | ||
} | ||
} | ||
} |
This file contains 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 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