Skip to content

Commit f41d16e

Browse files
committed
Fix preprocess
1 parent 3b803b7 commit f41d16e

4 files changed

Lines changed: 25 additions & 16 deletions

File tree

src/main/java/work/msdnicrosoft/commandbuttons/CommandButtons.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
import net.minecraft.client.KeyMapping;
88
import net.minecraft.client.Minecraft;
99
import net.minecraft.client.player.LocalPlayer;
10-
//#if MC >= 12109
11-
import net.minecraft.resources.ResourceLocation;
12-
//#endif
1310
import org.jetbrains.annotations.NotNull;
14-
import org.lwjgl.glfw.GLFW;
1511
import work.msdnicrosoft.commandbuttons.data.ConfigManager;
1612
import work.msdnicrosoft.commandbuttons.gui.CommandGUI;
1713
import work.msdnicrosoft.commandbuttons.gui.WrapperCommandGUIScreen;
@@ -26,16 +22,7 @@ public class CommandButtons implements ModInitializer {
2622
public void onInitialize() {
2723
ConfigManager.init();
2824

29-
KeyMapping keyBinding = KeyBindingHelper.registerKeyBinding(new KeyMapping(
30-
"mgbuttons.key.opengui",
31-
InputConstants.Type.KEYSYM,
32-
GLFW.GLFW_KEY_G,
33-
//#if MC >= 12109
34-
KeyMapping.Category.register(ResourceLocation.fromNamespaceAndPath("mgbuttons", "category"))
35-
//#else
36-
//$$ "key.category.mgbuttons.category"
37-
//#endif
38-
));
25+
KeyMapping keyBinding = KeyBindingHelper.registerKeyBinding(CommandButtonsReference.OPEN_GUI_KEY_MAPPING);
3926

4027
ClientTickEvents.END_CLIENT_TICK.register(client -> {
4128
while (keyBinding.consumeClick()) {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
11
package work.msdnicrosoft.commandbuttons;
22

3+
import com.mojang.blaze3d.platform.InputConstants;
34
import lombok.Getter;
5+
import net.minecraft.client.KeyMapping;
6+
//#if MC >= 12111
7+
import net.minecraft.resources.Identifier;
8+
//#elseif MC >= 12109
9+
//$$ import net.minecraft.resources.ResourceLocation;
10+
//#endif
411
import org.apache.logging.log4j.LogManager;
512
import org.apache.logging.log4j.Logger;
13+
import org.lwjgl.glfw.GLFW;
614

715
public class CommandButtonsReference {
816
@Getter
917
private static final String modIdentifier = "@MOD_ID@";
1018

1119
@Getter
1220
private static final Logger logger = LogManager.getLogger(modIdentifier);
21+
22+
public static final KeyMapping OPEN_GUI_KEY_MAPPING = new KeyMapping(
23+
"mgbuttons.key.opengui",
24+
InputConstants.Type.KEYSYM,
25+
GLFW.GLFW_KEY_G,
26+
//#if MC >= 12111
27+
KeyMapping.Category.register(Identifier.fromNamespaceAndPath("mgbuttons", "category"))
28+
//#elseif MC >= 12109
29+
//$$ KeyMapping.Category.register(ResourceLocation.fromNamespaceAndPath("mgbuttons", "category"))
30+
//#else
31+
//$$ "key.category.mgbuttons.category"
32+
//#endif
33+
);
1334
}

src/main/java/work/msdnicrosoft/commandbuttons/gui/WrapperCommandGUIScreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public boolean keyPressed(
111111
return true;
112112
}
113113
return super.keyPressed(
114-
//#if MC >= 12119
114+
//#if MC >= 12109
115115
input
116116
//#else
117117
//$$ ch, keyCode, modifiers

src/main/java/work/msdnicrosoft/commandbuttons/mixin/MixinWListPanel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public abstract class MixinWListPanel<D, W extends WWidget> extends WClippedPane
3131

3232
@Shadow
3333
protected BiConsumer<D, W> configurator;
34+
3435
@Unique
3536
private int mgbuttons$index;
3637

@@ -51,7 +52,7 @@ public abstract class MixinWListPanel<D, W extends WWidget> extends WClippedPane
5152
//$$ }
5253
//#endif
5354

54-
@SuppressWarnings({"ConstantConditions", "InvalidInjectorMethodSignature"})
55+
@SuppressWarnings({"ConstantConditions"})
5556
@ModifyVariable(
5657
method = "layout",
5758
at = @At(

0 commit comments

Comments
 (0)