-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tooltip when unlockAllRecipes is true.
- Loading branch information
1 parent
5c6492d
commit a552067
Showing
2 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/main/java/turniplabs/halplibe/mixin/mixins/GuiTooltipMixin.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,29 @@ | ||
package turniplabs.halplibe.mixin.mixins; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.Gui; | ||
import net.minecraft.client.gui.GuiTooltip; | ||
import net.minecraft.core.item.ItemStack; | ||
import net.minecraft.core.player.inventory.slot.Slot; | ||
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.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
import turniplabs.halplibe.HalpLibe; | ||
|
||
@Mixin(value = GuiTooltip.class, remap = false) | ||
public class GuiTooltipMixin extends Gui { | ||
|
||
@Shadow Minecraft mc; | ||
|
||
@Inject(method = "getTooltipText(Lnet/minecraft/core/item/ItemStack;ZLnet/minecraft/core/player/inventory/slot/Slot;)Ljava/lang/String;", at = @At(value = "FIELD", target = "Lnet/minecraft/core/player/inventory/slot/Slot;discovered:Z", ordinal = 0, shift = At.Shift.AFTER)) | ||
public void getTooltipText(ItemStack itemStack, boolean showDescription, Slot slot, CallbackInfoReturnable<String> cir, @Local(ordinal = 0, argsOnly = true) LocalBooleanRef discovered) { | ||
if(mc.theWorld.getGameRule(HalpLibe.UNLOCK_ALL_RECIPES)){ | ||
discovered.set(true); | ||
} | ||
} | ||
|
||
} |
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