[DEV] New Cloth Config GUIs, new nojang apis, and bug fixes
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
-def JDK = "21";
|
||||
-def majorMc = "1.21.2";
|
||||
-def modLoaders = "neoforge|fabric|quilt|paper";
|
||||
-def supportedMc = "1.21.3";
|
||||
-def supportedMc = "1.21.3|1.21.4";
|
||||
-def reltype = "port";
|
||||
+def JDK = "17";
|
||||
+def majorMc = "1.20.4";
|
||||
|
@@ -0,0 +1,11 @@
|
||||
--- a/Common/src/main/java/com/hypherionmc/craterlib/client/gui/config/ClothConfigScreenBuilder.java
|
||||
+++ b/Common/src/main/java/com/hypherionmc/craterlib/client/gui/config/ClothConfigScreenBuilder.java
|
||||
@@ -390,7 +390,7 @@
|
||||
config.saveConfig(config);
|
||||
Files.deleteIfExists(backupPath);
|
||||
} catch (Exception e) {
|
||||
- Minecraft.getInstance().getToastManager().addToast(
|
||||
+ Minecraft.getInstance().getToasts().addToast(
|
||||
new SystemToast(
|
||||
SystemToast.SystemToastId.PACK_LOAD_FAILURE,
|
||||
Component.literal("Failed To Save Config"),
|
@@ -1,6 +1,6 @@
|
||||
--- a/Common/src/main/java/com/hypherionmc/craterlib/client/gui/config/CraterConfigScreen.java
|
||||
+++ b/Common/src/main/java/com/hypherionmc/craterlib/client/gui/config/CraterConfigScreen.java
|
||||
@@ -158,7 +158,7 @@
|
||||
@@ -159,7 +159,7 @@
|
||||
return new TextConfigOption<>(Objects::toString, BigDecimal::new);
|
||||
}
|
||||
if (value instanceof ResourceLocation) {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
if (isSubConfig) {
|
||||
return new SubConfigWidget<>(config, this, value);
|
||||
@@ -216,23 +216,24 @@
|
||||
@@ -217,23 +217,24 @@
|
||||
int maxY = this.height - BOTTOM;
|
||||
//RenderSystem.disableTexture();
|
||||
Tesselator tesselator = Tesselator.getInstance();
|
||||
@@ -51,7 +51,7 @@
|
||||
RenderSystem.disableBlend();
|
||||
//RenderSystem.enableTexture();
|
||||
}
|
||||
@@ -240,21 +241,22 @@
|
||||
@@ -241,21 +242,22 @@
|
||||
|
||||
private void renderShadow(PoseStack matrices) {
|
||||
Tesselator tesselator = Tesselator.getInstance();
|
||||
@@ -85,7 +85,7 @@
|
||||
//RenderSystem.enableTexture();
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
@@ -265,15 +267,16 @@
|
||||
@@ -266,15 +268,16 @@
|
||||
|
||||
protected void overlayBackground(Matrix4f matrix, int minX, int minY, int maxX, int maxY, int red, int green, int blue, int startAlpha, int endAlpha) {
|
||||
Tesselator tesselator = Tesselator.getInstance();
|
||||
|
@@ -1,11 +1,11 @@
|
||||
--- a/Fabric/build.gradle
|
||||
+++ b/Fabric/build.gradle
|
||||
@@ -116,8 +116,8 @@
|
||||
@@ -117,8 +117,8 @@
|
||||
setVersionType("release")
|
||||
setChangelog(rootProject.file("changelog.md"))
|
||||
setProjectVersion("${minecraft_version}-${project.version}")
|
||||
- setDisplayName("[FABRIC/QUILT 1.21.3] CraterLib - ${project.version}")
|
||||
- setGameVersions("1.21.3")
|
||||
- setDisplayName("[FABRIC/QUILT 1.21.3/4] CraterLib - ${project.version}")
|
||||
- setGameVersions("1.21.3", "1.21.4")
|
||||
+ setDisplayName("[FABRIC/QUILT 1.20.4] CraterLib - ${project.version}")
|
||||
+ setGameVersions("1.20.4")
|
||||
setLoaders("fabric", "quilt")
|
||||
|
@@ -10,9 +10,9 @@
|
||||
+ stupidRemapArch("dev.ftb.mods:ftb-essentials-forge:${ftb_essentials}")
|
||||
+ stupidRemapArch("dev.ftb.mods:ftb-ranks-forge:${ftb_ranks}")
|
||||
|
||||
// Do not edit or remove
|
||||
implementation project(":Common")
|
||||
@@ -107,8 +110,8 @@
|
||||
modImplementation("me.shedaniel.cloth:cloth-config-forge:${cloth_config}")
|
||||
|
||||
@@ -109,8 +112,8 @@
|
||||
setVersionType("release")
|
||||
setChangelog(rootProject.file("changelog.md"))
|
||||
setProjectVersion("${minecraft_version}-${project.version}")
|
||||
|
@@ -1,24 +1,45 @@
|
||||
--- a/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ConfigScreenHandlerMixin.java
|
||||
+++ b/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ConfigScreenHandlerMixin.java
|
||||
@@ -1,8 +1,8 @@
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.hypherionmc.craterlib.mixin;
|
||||
|
||||
+import com.hypherionmc.craterlib.client.gui.config.ClothConfigScreenBuilder;
|
||||
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
||||
+import com.hypherionmc.craterlib.core.config.AbstractConfig;
|
||||
import com.hypherionmc.craterlib.core.config.ConfigController;
|
||||
-import com.hypherionmc.craterlib.core.config.ModuleConfig;
|
||||
+import com.hypherionmc.craterlib.core.config.annotations.ClothScreen;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.NoConfigScreen;
|
||||
+import com.hypherionmc.craterlib.core.platform.ModloaderEnvironment;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
@@ -28,9 +28,9 @@
|
||||
import net.minecraftforge.client.ConfigScreenHandler;
|
||||
@@ -28,17 +31,22 @@
|
||||
*/
|
||||
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, watcher) -> {
|
||||
+ ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
if (!conf.getClass().isAnnotationPresent(NoConfigScreen.class)) {
|
||||
- ModuleConfig config = (ModuleConfig) conf;
|
||||
+ AbstractConfig config = watcher.getLeft();
|
||||
if (config.getModId().equals(selectedMod.getModId())) {
|
||||
cir.setReturnValue(
|
||||
Optional.of((minecraft, screen) -> new CraterConfigScreen(config, screen))
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
+ if (config.getModId().equals(selectedMod.getModId())) {
|
||||
+ if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
|
||||
+ cir.setReturnValue(
|
||||
+ Optional.of((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))
|
||||
+ );
|
||||
+ } else {
|
||||
+ cir.setReturnValue(
|
||||
+ Optional.of((minecraft, screen) -> new CraterConfigScreen(config, screen))
|
||||
+ );
|
||||
+ }
|
||||
}
|
||||
});
|
||||
}
|
||||
-
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
--- a/NeoForge/build.gradle
|
||||
+++ b/NeoForge/build.gradle
|
||||
@@ -35,12 +35,7 @@
|
||||
@@ -37,12 +37,7 @@
|
||||
|
||||
unimined.minecraft {
|
||||
neoForged {
|
||||
@@ -14,7 +14,7 @@
|
||||
mixinConfig("${mod_id}.mixins.json", "${mod_id}.neoforge.mixins.json")
|
||||
}
|
||||
}
|
||||
@@ -59,7 +54,7 @@
|
||||
@@ -61,7 +56,7 @@
|
||||
from project(":Common").sourceSets.main.resources
|
||||
def buildProps = project.properties.clone()
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
expand buildProps
|
||||
}
|
||||
}
|
||||
@@ -114,8 +109,8 @@
|
||||
@@ -116,8 +111,8 @@
|
||||
setVersionType("release")
|
||||
setChangelog(rootProject.file("changelog.md"))
|
||||
setProjectVersion("${minecraft_version}-${project.version}")
|
||||
- setDisplayName("[NeoForge 1.21.3] CraterLib - ${project.version}")
|
||||
- setGameVersions("1.21.3")
|
||||
- setDisplayName("[NeoForge 1.21.3/1.21.4] CraterLib - ${project.version}")
|
||||
- setGameVersions("1.21.3", "1.21.4")
|
||||
+ setDisplayName("[NeoForge 1.20.4] CraterLib - ${project.version}")
|
||||
+ setGameVersions("1.20.4")
|
||||
setLoaders("neoforge")
|
||||
|
@@ -1,15 +1,18 @@
|
||||
--- a/NeoForge/src/main/java/com/hypherionmc/craterlib/client/NeoForgeClientHelper.java
|
||||
+++ b/NeoForge/src/main/java/com/hypherionmc/craterlib/client/NeoForgeClientHelper.java
|
||||
@@ -1,20 +1,11 @@
|
||||
@@ -1,23 +1,12 @@
|
||||
package com.hypherionmc.craterlib.client;
|
||||
|
||||
-import com.hypherionmc.craterlib.api.events.client.LateInitEvent;
|
||||
-import com.hypherionmc.craterlib.client.gui.config.ClothConfigScreenBuilder;
|
||||
-import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
||||
-import com.hypherionmc.craterlib.core.config.AbstractConfig;
|
||||
-import com.hypherionmc.craterlib.core.config.ConfigController;
|
||||
-import com.hypherionmc.craterlib.core.config.annotations.ClothScreen;
|
||||
-import com.hypherionmc.craterlib.core.config.annotations.NoConfigScreen;
|
||||
-import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
||||
import com.hypherionmc.craterlib.core.platform.ClientPlatform;
|
||||
import com.hypherionmc.craterlib.core.platform.ModloaderEnvironment;
|
||||
import com.hypherionmc.craterlib.nojang.client.BridgedMinecraft;
|
||||
-import com.hypherionmc.craterlib.nojang.client.BridgedOptions;
|
||||
import com.hypherionmc.craterlib.nojang.client.multiplayer.BridgedClientLevel;
|
||||
@@ -21,7 +24,7 @@
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -45,17 +36,5 @@
|
||||
@@ -48,22 +37,5 @@
|
||||
public Connection getClientConnection() {
|
||||
Objects.requireNonNull(Minecraft.getInstance().getConnection(), "Cannot send packets when not in game!");
|
||||
return Minecraft.getInstance().getConnection().getConnection();
|
||||
@@ -32,9 +35,14 @@
|
||||
- CraterEventBus.INSTANCE.postEvent(event);
|
||||
-
|
||||
- ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
- if (!conf.getClass().isAnnotationPresent(NoConfigScreen.class)) {
|
||||
- AbstractConfig config = watcher.getLeft();
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
- AbstractConfig config = watcher.getLeft();
|
||||
- if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
- return;
|
||||
-
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
- }
|
||||
- });
|
||||
}
|
||||
|
@@ -24,7 +24,12 @@
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
@@ -32,17 +32,17 @@
|
||||
@@ -29,21 +29,21 @@
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
discord_formatter=2.0.0
|
||||
-cloth_config=17.0.144
|
||||
+cloth_config=13.0.138
|
||||
|
||||
# Mod Dependencies
|
||||
fabrictailor=2.3.1
|
||||
|
Reference in New Issue
Block a user