Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion patchwork-gui/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
archivesBaseName = "patchwork-gui"
version = getSubprojectVersion(project, "0.1.0")
version = getSubprojectVersion(project, "0.1.1")

dependencies {
compile project(path: ':patchwork-fml', configuration: 'dev')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import net.minecraft.client.Keyboard;
Expand Down Expand Up @@ -74,20 +75,26 @@ private void postKeyEvent(int i, boolean[] bls, ParentElement element, int key,
}

@Inject(method = "method_1458", at = @At("HEAD"), cancellable = true)
private static void charEvent(Element element, int character, int mods, CallbackInfo info) {
private static void preCharTyped(Element element, int character, int mods, CallbackInfo info) {
if (MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.KeyboardCharTypedEvent.Pre((Screen) element, (char) character, mods))) {
info.cancel();
} else if (!element.charTyped((char) character, mods)) {
MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.KeyboardCharTypedEvent.Post((Screen) element, (char) character, mods));
}
}

@Redirect(method = "method_1458", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Element;charTyped(CI)Z"))
private static boolean charTyped(Element element, char character, int mods) {
return element.charTyped(character, mods) || MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.KeyboardCharTypedEvent.Post((Screen) element, character, mods));
Comment thread
TheGlitch76 marked this conversation as resolved.
}

@Inject(method = "method_1473", at = @At("HEAD"), cancellable = true)
private static void charEvent(Element element, char character, int mods, CallbackInfo info) {
if (MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.KeyboardCharTypedEvent.Pre((Screen) element, character, mods))) {
private static void preCharTyped(Element element, char character, int mods, CallbackInfo info) {
if (MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.KeyboardCharTypedEvent.Pre((Screen) element, (char) character, mods))) {
info.cancel();
} else if (!element.charTyped(character, mods)) {
MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.KeyboardCharTypedEvent.Post((Screen) element, character, mods));
}
}

@Redirect(method = "method_1473", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Element;charTyped(CI)Z"))
private static boolean charTyped2(Element element, char character, int mods) {
return element.charTyped(character, mods) || MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.KeyboardCharTypedEvent.Post((Screen) element, character, mods));
}
}