diff options
Diffstat (limited to 'src/main/java/com/dulkirfabric/mixin')
-rw-r--r-- | src/main/java/com/dulkirfabric/mixin/render/GameMenuScreenMixin.java | 13 | ||||
-rw-r--r-- | src/main/java/com/dulkirfabric/mixin/render/KeyboardMixin.java | 16 |
2 files changed, 16 insertions, 13 deletions
diff --git a/src/main/java/com/dulkirfabric/mixin/render/GameMenuScreenMixin.java b/src/main/java/com/dulkirfabric/mixin/render/GameMenuScreenMixin.java index b644595..6f09e51 100644 --- a/src/main/java/com/dulkirfabric/mixin/render/GameMenuScreenMixin.java +++ b/src/main/java/com/dulkirfabric/mixin/render/GameMenuScreenMixin.java @@ -14,7 +14,6 @@ package com.dulkirfabric.mixin.render; import com.dulkirfabric.config.DulkirConfig; -import com.dulkirfabric.events.WidgetInitEvent; import net.minecraft.client.gui.screen.GameMenuScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -30,8 +29,6 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.util.function.Supplier; -import static com.dulkirfabric.DulkirModFabric.EVENT_BUS; - @Mixin(GameMenuScreen.class) public abstract class GameMenuScreenMixin extends ScreenMixin { @@ -48,14 +45,4 @@ public abstract class GameMenuScreenMixin extends ScreenMixin { adder.add(this.createButton(buttonText, new DulkirConfig()::getScreen)); } - @Inject(method = "initWidgets", at = @At(value = "HEAD")) - private void initWidgetPre(CallbackInfo ci) { - EVENT_BUS.post(WidgetInitEvent.get(false)); - } - - @Inject(method = "initWidgets", at = @At(value = "TAIL")) - private void initWidgetPost(CallbackInfo ci) { - EVENT_BUS.post(WidgetInitEvent.get(true)); - } - }
\ No newline at end of file diff --git a/src/main/java/com/dulkirfabric/mixin/render/KeyboardMixin.java b/src/main/java/com/dulkirfabric/mixin/render/KeyboardMixin.java new file mode 100644 index 0000000..c2c5a45 --- /dev/null +++ b/src/main/java/com/dulkirfabric/mixin/render/KeyboardMixin.java @@ -0,0 +1,16 @@ +package com.dulkirfabric.mixin.render; + +import com.dulkirfabric.events.WorldKeyPressEvent; +import net.minecraft.client.Keyboard; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(Keyboard.class) +public class KeyboardMixin { + @Inject(method = "onKey", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;onKeyPressed(Lnet/minecraft/client/util/InputUtil$Key;)V")) + public void onKeyBoardInWorld(long window, int key, int scancode, int action, int modifiers, CallbackInfo ci) { + new WorldKeyPressEvent(key, scancode, modifiers).post(); + } +} |