Skip to content

Commit 66cdca3

Browse files
committed
MidnightControls 1.8.0 - 1.19.4, New GUI handling, Better reacharound
- Port to 1.19.4 - Drastically improve GUI handling - Directions are now respected instead of acting like the Tab key (possible thanks to 1.19.4) - The new tabs can be navigated using the shoulder buttons - Sodium and Iris now have way better controller navigation thanks to isXander's PRs to them - Improved reacharound thanks to MonstoBusta - Cleaner advanced options screen - Better auto-detection of the Steam Deck
1 parent 6e49667 commit 66cdca3

11 files changed

Lines changed: 22 additions & 23 deletions

File tree

build.gradle

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ boolean isMCVersionNonRelease() {
3232
}
3333

3434
String getMCVersionString() {
35-
if (isMCVersionNonRelease() || project.minecraft_version == "1.19.3") {
35+
if (isMCVersionNonRelease() || project.minecraft_version == "1.19.4") {
3636
return project.minecraft_version
3737
}
3838
def version = project.minecraft_version.split('\\.')
@@ -78,9 +78,6 @@ repositories {
7878
maven { url 'https://jitpack.io' }
7979
maven { url "https://api.modrinth.com/maven" }
8080
maven { url 'https://maven.quiltmc.org/repository/release'}
81-
flatDir {
82-
dirs "localMaven"
83-
}
8481
}
8582

8683
configurations {
@@ -127,7 +124,7 @@ dependencies {
127124
modCompileOnlyApi "maven.modrinth:inventory-tabs-updated:${project.inventorytabs_version}"
128125
modCompileOnlyApi "maven.modrinth:bedrockify:${project.bedrockify_version}"
129126
// Required for Inventory Tabs
130-
modApi("me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}") {
127+
modCompileOnlyApi("me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}") {
131128
exclude(group: "net.fabricmc.fabric-api")
132129
}
133130

gradle.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/use
6-
minecraft_version=1.19.4-pre4
7-
yarn_mappings=1.19.4-pre4+build.1
6+
minecraft_version=1.19.4
7+
yarn_mappings=1.19.4+build.1
88
loader_version=0.14.17
99

1010
# Mod Properties
11-
mod_version = 1.7.4
11+
mod_version = 1.8.0
1212
maven_group = eu.midnightdust
1313
archives_base_name = midnightcontrols
1414
modrinth_id=bXX9h73M
@@ -17,8 +17,8 @@ modrinth_id=bXX9h73M
1717
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
1818
fabric_version=0.75.3+1.19.4
1919
sodium_version=mc1.19.2-0.4.4
20-
spruceui_version=4.2.0+23w06a
21-
midnightlib_version=fabric-1.2.0
20+
spruceui_version=4.2.0+1.19.4
21+
midnightlib_version=1.2.1-fabric
2222
modmenu_version=5.0.1
2323
emotecraft_version=2.1.3-SNAPSHOT-build.29-MC1.19-fabric
2424
bendylib_version=2.0.+
-66.5 KB
Binary file not shown.
-183 KB
Binary file not shown.

src/main/java/eu/midnightdust/midnightcontrols/client/MidnightControlsClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ public void onMcInit(@NotNull MinecraftClient client) {
147147
if (MidnightControlsConfig.configVersion < 2) {
148148
MidnightControlsConfig.mouseScreens.remove("me.jellysquid.mods.sodium.client.gui");
149149
MidnightControlsConfig.mouseScreens.remove("net.coderbot.iris.gui");
150+
MidnightControlsConfig.mouseScreens.remove("net.minecraft.class_5375");
151+
MidnightControlsConfig.mouseScreens.remove("net.minecraft.client.gui.screen.pack.PackScreen");
152+
MidnightControlsConfig.configVersion = 2;
150153
MidnightControlsConfig.write("midnightcontrols");
151154
}
152155
this.hud.setVisible(MidnightControlsConfig.hudEnable);

src/main/java/eu/midnightdust/midnightcontrols/client/MidnightControlsConfig.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import com.google.common.collect.Lists;
1313
import com.google.common.collect.Maps;
14+
import com.mojang.blaze3d.platform.GlDebugInfo;
1415
import eu.midnightdust.lib.config.MidnightConfig;
1516
import eu.midnightdust.midnightcontrols.ControlsMode;
1617
import eu.midnightdust.midnightcontrols.MidnightControlsFeature;
@@ -69,7 +70,7 @@ public class MidnightControlsConfig extends MidnightConfig {
6970
@Entry(category = "controller", name = "Controller ID") @Hidden public static Object controllerID = 0;
7071
@Entry(category = "controller", name = "2nd Controller ID") @Hidden public static Object secondControllerID = -1;
7172
@Entry(category = "visual", name = "midnightcontrols.menu.controller_type") public static ControllerType controllerType = ControllerType.DEFAULT;
72-
@Entry(category = "screens", name = "Mouse screens") public static List<String> mouseScreens = Lists.newArrayList("net.minecraft.client.gui.screen.advancement", "net.minecraft.client.gui.screen.pack.PackScreen", "net.minecraft.class_5375",
73+
@Entry(category = "screens", name = "Mouse screens") public static List<String> mouseScreens = Lists.newArrayList("net.minecraft.client.gui.screen.advancement",
7374
"net.minecraft.class_457", "net.minecraft.class_408", "net.minecraft.class_3872", "me.flashyreese.mods.reeses_sodium_options.client.gui", "dev.emi.emi.screen",
7475
"hardcorequesting.client.interfaces.GuiQuestBook", "hardcorequesting.client.interfaces.GuiReward", "hardcorequesting.client.interfaces.EditTrackerScreen",
7576
"me.shedaniel.clothconfig2.gui.ClothConfigScreen", "com.mamiyaotaru.voxelmap.gui.GuiWaypoints", "com.mamiyaotaru.voxelmap.gui.GuiPersistentMap");
@@ -340,7 +341,7 @@ public static void reset() {
340341
controllerID = 0;
341342
secondControllerID = -1;
342343
controllerType = ControllerType.DEFAULT;
343-
mouseScreens = Lists.newArrayList("net.minecraft.client.gui.screen.advancement", "net.minecraft.client.gui.screen.pack.PackScreen", "net.minecraft.class_5375", "net.minecraft.class_457", "net.minecraft.class_408", "net.minecraft.class_3872", "me.flashyreese.mods.reeses_sodium_options.client.gui", "dev.emi.emi.screen", "me.shedaniel.clothconfig2.gui.ClothConfigScreen", "com.mamiyaotaru.voxelmap.gui.GuiWaypoints", "com.mamiyaotaru.voxelmap.gui.GuiPersistentMap");
344+
mouseScreens = Lists.newArrayList("net.minecraft.client.gui.screen.advancement", "net.minecraft.class_457", "net.minecraft.class_408", "net.minecraft.class_3872", "me.flashyreese.mods.reeses_sodium_options.client.gui", "dev.emi.emi.screen", "me.shedaniel.clothconfig2.gui.ClothConfigScreen", "com.mamiyaotaru.voxelmap.gui.GuiWaypoints", "com.mamiyaotaru.voxelmap.gui.GuiPersistentMap");
344345
BINDING = new HashMap<>();
345346
maxAnalogValueLeftX = 1;
346347
maxAnalogValueLeftY = 1;
@@ -363,7 +364,7 @@ public static void reset() {
363364
String controller = getController().getName().toLowerCase();
364365
if (controller.contains("xbox 360")) return ControllerType.XBOX_360;
365366
else if (controller.contains("xbox") || controller.contains("afterglow")) return ControllerType.XBOX;
366-
else if (controller.contains("steam deck")) return ControllerType.STEAM_DECK;
367+
else if (controller.contains("steam") && GlDebugInfo.getCpuInfo().contains("AMD Custom APU")) return ControllerType.STEAM_DECK;
367368
else if (controller.contains("steam")) return ControllerType.STEAM_CONTROLLER;
368369
else if (controller.contains("dualsense") || controller.contains("ps5")) return ControllerType.DUALSENSE;
369370
else if (controller.contains("dualshock") || controller.contains("ps4") || controller.contains("sony")) return ControllerType.DUALSHOCK;

src/main/java/eu/midnightdust/midnightcontrols/client/MidnightReacharound.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private float getPlayerRange(@NotNull MinecraftClient client) {
140140
var blockPos = playerPos.add(vector);
141141

142142
// Some functions still need BlockPos, so this is here to let that happen
143-
var blockyPos = new BlockPos(blockPos);
143+
var blockyPos = BlockPos.ofFloored(blockPos);
144144

145145
var direction = client.player.getHorizontalFacing();
146146

src/main/java/eu/midnightdust/midnightcontrols/client/controller/InputHandlers.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,13 @@ else if (nextTab >= tabs.size())
166166
}
167167
return true;
168168
} else if (client.currentScreen != null && client.currentScreen.children().stream().anyMatch(e -> e instanceof TabNavigationWidget)) {
169-
Lists.newCopyOnWriteArrayList(client.currentScreen.children()).stream().anyMatch(e -> {
169+
return Lists.newCopyOnWriteArrayList(client.currentScreen.children()).stream().anyMatch(e -> {
170170
if (e instanceof TabNavigationWidget tabs) {
171171
TabNavigationWidgetAccessor accessor = (TabNavigationWidgetAccessor) tabs;
172-
if (next ? accessor.getCurrentTabIndex()+1 < accessor.getTabs().size() : accessor.getCurrentTabIndex() > 0) {
173-
if (next) tabs.selectTab(accessor.getCurrentTabIndex() + 1, true);
174-
else tabs.selectTab(accessor.getCurrentTabIndex() - 1, true);
172+
int tabIndex = accessor.getTabs().indexOf(accessor.getTabManager().getCurrentTab());
173+
if (next ? tabIndex+1 < accessor.getTabs().size() : tabIndex > 0) {
174+
if (next) tabs.selectTab(tabIndex + 1, true);
175+
else tabs.selectTab(tabIndex - 1, true);
175176
return true;
176177
}
177178
}

src/main/java/eu/midnightdust/midnightcontrols/client/mixin/TabNavigationWidgetAccessor.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@
66
import net.minecraft.client.gui.widget.TabNavigationWidget;
77
import org.spongepowered.asm.mixin.Mixin;
88
import org.spongepowered.asm.mixin.gen.Accessor;
9-
import org.spongepowered.asm.mixin.gen.Invoker;
109

1110
@Mixin(TabNavigationWidget.class)
1211
public interface TabNavigationWidgetAccessor {
1312
@Accessor
1413
TabManager getTabManager();
1514
@Accessor
1615
ImmutableList<Tab> getTabs();
17-
@Invoker("getCurrentTabIndex")
18-
int getCurrentTabIndex();
1916
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"pack": {
3-
"pack_format": 12,
3+
"pack_format": 13,
44
"description": "Makes controller tooltips use similar icons to Bedrock Edition"
55
}
66
}

0 commit comments

Comments
 (0)