|
1 | 1 | package com.mrcrayfish.controllable.client.util; |
2 | 2 |
|
3 | | -import com.mojang.blaze3d.systems.RenderSystem; |
4 | 3 | import com.mrcrayfish.controllable.Config; |
5 | 4 | import com.mrcrayfish.controllable.client.input.Buttons; |
6 | 5 | import com.mrcrayfish.controllable.client.settings.ButtonIcons; |
7 | 6 | import com.mrcrayfish.controllable.client.gui.Icons; |
| 7 | +import com.mrcrayfish.controllable.mixin.client.OverlayRecipeButtonAccessor; |
| 8 | +import com.mrcrayfish.controllable.mixin.client.OverlayRecipeComponentAccessor; |
8 | 9 | import com.mrcrayfish.controllable.platform.ClientServices; |
9 | 10 | import com.mrcrayfish.controllable.util.Utils; |
10 | 11 | import net.minecraft.ChatFormatting; |
11 | 12 | import net.minecraft.client.GuiMessage; |
12 | 13 | import net.minecraft.client.Minecraft; |
13 | 14 | import net.minecraft.client.OptionInstance; |
14 | 15 | import net.minecraft.client.gui.GuiGraphics; |
| 16 | +import net.minecraft.client.gui.components.AbstractWidget; |
15 | 17 | import net.minecraft.client.gui.components.Tooltip; |
16 | | -import net.minecraft.client.player.ClientInput; |
| 18 | +import net.minecraft.client.gui.screens.recipebook.OverlayRecipeComponent; |
17 | 19 | import net.minecraft.client.renderer.RenderType; |
18 | 20 | import net.minecraft.locale.Language; |
19 | 21 | import net.minecraft.network.chat.CommonComponents; |
|
23 | 25 | import net.minecraft.resources.ResourceLocation; |
24 | 26 | import net.minecraft.util.FormattedCharSequence; |
25 | 27 |
|
| 28 | +import java.util.Collections; |
26 | 29 | import java.util.List; |
27 | 30 |
|
28 | 31 | /** |
@@ -102,4 +105,22 @@ public static boolean isSubtitleShowing() |
102 | 105 | Minecraft mc = Minecraft.getInstance(); |
103 | 106 | return mc.options.showSubtitles().get() && mc.screen == null; |
104 | 107 | } |
| 108 | + |
| 109 | + public static List<AbstractWidget> mixinGetRecipeButtons(OverlayRecipeComponent overlay) |
| 110 | + { |
| 111 | + if(overlay instanceof OverlayRecipeComponentAccessor accessor) |
| 112 | + { |
| 113 | + return accessor.controllableGetRecipeButtons(); |
| 114 | + } |
| 115 | + return Collections.emptyList(); |
| 116 | + } |
| 117 | + |
| 118 | + public static boolean mixinIsCraftable(AbstractWidget widget) |
| 119 | + { |
| 120 | + if(widget instanceof OverlayRecipeButtonAccessor accessor) |
| 121 | + { |
| 122 | + return accessor.controllableIsCraftable(); |
| 123 | + } |
| 124 | + return false; |
| 125 | + } |
105 | 126 | } |
0 commit comments