diff --git a/common/src/main/java/moe/caramel/chat/mixin/MixinRecipeBookComponent.java b/common/src/main/java/moe/caramel/chat/mixin/MixinRecipeBookComponent.java new file mode 100644 index 0000000..e93cf65 --- /dev/null +++ b/common/src/main/java/moe/caramel/chat/mixin/MixinRecipeBookComponent.java @@ -0,0 +1,26 @@ +package moe.caramel.chat.mixin; + +import moe.caramel.chat.controller.EditBoxController; +import net.minecraft.client.gui.components.EditBox; +import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; +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.CallbackInfo; + +/** + * RecipeBook Component Mixin + */ +@Mixin(RecipeBookComponent.class) +public abstract class MixinRecipeBookComponent { + + @Shadow private EditBox searchBox; + @Shadow protected abstract void checkSearchStringUpdate(); + + @Inject(method = "initVisuals", at = @At("TAIL")) + private void initVisuals(final CallbackInfo ci) { + EditBoxController.getWrapper(this.searchBox) + .setInsertCallback(this::checkSearchStringUpdate); + } +} diff --git a/common/src/main/resources/caramelchat.mixins.json b/common/src/main/resources/caramelchat.mixins.json index 3f58126..07761ea 100644 --- a/common/src/main/resources/caramelchat.mixins.json +++ b/common/src/main/resources/caramelchat.mixins.json @@ -9,6 +9,7 @@ "MixinCreativeModeInventoryScreen", "MixinEditBox", "MixinMinecraft", + "MixinRecipeBookComponent", "MixinSelectWorldScreen", "MixinSignEditScreen" ] diff --git a/gradle.properties b/gradle.properties index 20b7424..b414d5b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.jvmargs=-Xmx2G archives_base_name=caramelChat -mod_version=1.0.0-beta.3 +mod_version=1.0.0-SNAPSHOT maven_group=moe.caramel minecraft_version=1.19.4