Skip to content

Commit

Permalink
fix: recipe book search results do not immediately refresh when input…
Browse files Browse the repository at this point in the history
… Korean

closes #7
  • Loading branch information
LemonCaramel committed Oct 19, 2023
1 parent 4141244 commit 406310a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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);
}
}
1 change: 1 addition & 0 deletions common/src/main/resources/caramelchat.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"MixinCreativeModeInventoryScreen",
"MixinEditBox",
"MixinMinecraft",
"MixinRecipeBookComponent",
"MixinSelectWorldScreen",
"MixinSignEditScreen"
]
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
org.gradle.jvmargs=-Xmx2G

archives_base_name=caramelChat
mod_version=1.1.0-beta.1
mod_version=1.0.0-SNAPSHOT
maven_group=moe.caramel

minecraft_version=1.20.2
Expand Down

0 comments on commit 406310a

Please sign in to comment.