aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel
diff options
context:
space:
mode:
authorUnknown <shekwancheung0528@gmail.com>2019-06-21 15:52:04 +0800
committerUnknown <shekwancheung0528@gmail.com>2019-06-21 15:52:04 +0800
commit8e711f287da34abfe4fa5a36f3b98b4181fa6e4f (patch)
tree51ca8f6b99138a57b81e09ff52ff64f5cee59000 /src/main/java/me/shedaniel
parentc72eecc67c401c2d419d03091a2c6f95fafa6e78 (diff)
downloadRoughlyEnoughItems-8e711f287da34abfe4fa5a36f3b98b4181fa6e4f.tar.gz
RoughlyEnoughItems-8e711f287da34abfe4fa5a36f3b98b4181fa6e4f.tar.bz2
RoughlyEnoughItems-8e711f287da34abfe4fa5a36f3b98b4181fa6e4f.zip
better recipe book button removal
Diffstat (limited to 'src/main/java/me/shedaniel')
-rw-r--r--src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java6
-rw-r--r--src/main/java/me/shedaniel/rei/listeners/RecipeBookButtonWidgetHooks.java12
2 files changed, 16 insertions, 2 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();
+}