aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java6
-rw-r--r--src/main/java/me/shedaniel/rei/listeners/RecipeBookButtonWidgetHooks.java12
-rw-r--r--src/main/resources/listeners.roughlyenoughitems.json3
3 files changed, 18 insertions, 3 deletions
diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
index 9a5906f32..59a7383e8 100644
--- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
+++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
@@ -13,6 +13,7 @@ import me.shedaniel.rei.api.*;
import me.shedaniel.rei.client.*;
import me.shedaniel.rei.gui.ContainerScreenOverlay;
import me.shedaniel.rei.gui.widget.ItemListOverlay;
+import me.shedaniel.rei.listeners.RecipeBookButtonWidgetHooks;
import me.shedaniel.rei.listeners.RecipeBookGuiHooks;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.network.ClientSidePacketRegistry;
@@ -41,7 +42,6 @@ import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.stream.Collectors;
public class RoughlyEnoughItemsCore implements ClientModInitializer {
@@ -156,6 +156,7 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer {
}
private void registerClothEvents() {
+ final Identifier recipeButtonTex = new Identifier("textures/gui/recipe_button.png");
ClothClientHooks.SYNC_RECIPES.register((minecraftClient, recipeManager, synchronizeRecipesS2CPacket) -> {
if (RoughlyEnoughItemsCore.getConfigManager().getConfig().registerRecipesInAnotherThread)
CompletableFuture.runAsync(() -> ((RecipeHelperImpl) RoughlyEnoughItemsCore.getRecipeHelper()).recipesLoaded(recipeManager), SYNC_RECIPES);
@@ -164,7 +165,8 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer {
});
ClothClientHooks.SCREEN_ADD_BUTTON.register((minecraftClient, screen, abstractButtonWidget) -> {
if (RoughlyEnoughItemsCore.getConfigManager().getConfig().disableRecipeBook && screen instanceof AbstractContainerScreen && abstractButtonWidget instanceof RecipeBookButtonWidget)
- return ActionResult.FAIL;
+ if (((RecipeBookButtonWidgetHooks) abstractButtonWidget).rei_getTexture().equals(recipeButtonTex))
+ return ActionResult.FAIL;
return ActionResult.PASS;
});
ClothClientHooks.SCREEN_INIT_POST.register((minecraftClient, screen, screenHooks) -> {
diff --git a/src/main/java/me/shedaniel/rei/listeners/RecipeBookButtonWidgetHooks.java b/src/main/java/me/shedaniel/rei/listeners/RecipeBookButtonWidgetHooks.java
new file mode 100644
index 000000000..13f450254
--- /dev/null
+++ b/src/main/java/me/shedaniel/rei/listeners/RecipeBookButtonWidgetHooks.java
@@ -0,0 +1,12 @@
+package me.shedaniel.rei.listeners;
+
+import net.minecraft.client.gui.widget.RecipeBookButtonWidget;
+import net.minecraft.util.Identifier;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.gen.Accessor;
+
+@Mixin(RecipeBookButtonWidget.class)
+public interface RecipeBookButtonWidgetHooks {
+ @Accessor("texture")
+ Identifier rei_getTexture();
+}
diff --git a/src/main/resources/listeners.roughlyenoughitems.json b/src/main/resources/listeners.roughlyenoughitems.json
index 2e0aaf909..79586f4e3 100644
--- a/src/main/resources/listeners.roughlyenoughitems.json
+++ b/src/main/resources/listeners.roughlyenoughitems.json
@@ -7,7 +7,8 @@
"client": [
"ContainerScreenHooks",
"RecipeBookGuiHooks",
- "AbstractInventoryScreenHooks"
+ "AbstractInventoryScreenHooks",
+ "RecipeBookButtonWidgetHooks"
],
"injectors": {
"defaultRequire": 1