diff --git a/build.gradle b/build.gradle index b0f13f63..2b1d6766 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,7 @@ preprocess { def mc1193 = createNode("1.19.3", 1_19_03, "mojang") def mc1194 = createNode("1.19.4", 1_19_04, "mojang") def mc1201 = createNode("1.20.1", 1_20_01, "mojang") + def mc1202 = createNode("1.20.2", 1_20_02, "mojang") mc1144.link(mc1152, file("versions/mapping-1.14.4-1.15.2.txt")) mc1152.link(mc1165, file("versions/mapping-1.15.2-1.16.5.txt")) @@ -26,6 +27,7 @@ preprocess { mc1192.link(mc1193, file("versions/mapping-1.19.2-1.19.3.txt")) mc1193.link(mc1194, file("versions/mapping-1.19.3-1.19.4.txt")) mc1194.link(mc1201, file("versions/mapping-1.19.4-1.20.1.txt")) + mc1201.link(mc1202, file("versions/mapping-1.20.1-1.20.2.txt")) } ext { diff --git a/common.gradle b/common.gradle index 39868cf4..c74fd9bc 100644 --- a/common.gradle +++ b/common.gradle @@ -38,6 +38,15 @@ repositories { url("https://masa.dy.fi/maven") } + maven { + name("Jitpack Maven") + url("https://jitpack.io") + + content { + includeGroup("com.github.Nyan-Work") + } + } + mavenCentral() } @@ -64,22 +73,24 @@ configurations { register("productionRuntimeMods") } -// Module, Property prefix, Resolve condition, Transitive dependencies. +// Module, Property prefix, Resolve condition, Transitive dependencies, Compile only. def apiDependencies = [ - ["carpet:fabric-carpet" , "carpet" , true, false], - ["curse.maven:malilib-303119" , "malilib", true, false], - ["maven.modrinth:modmenu" , "modmenu", true, false], - ["net.fabricmc.fabric-api:fabric-api", "fabric" , true, true], + ["carpet:fabric-carpet" , "carpet" , true , false, false], + ["curse.maven:malilib-303119" , "malilib", mcVersion < 12002, false, false], + ["com.github.Nyan-Work:malilib" , "malilib", mcVersion > 12001, false, true], + ["maven.modrinth:modmenu" , "modmenu", true , false, mcVersion > 12001], + ["net.fabricmc.fabric-api:fabric-api", "fabric" , true , true , false] , ] // Module, Property prefix, Resolve condition, Transitive dependencies. def runtimeDependencies = [ - ["curse.maven:auto-config-updated-api-373261", "auto_config_updated_api", mcVersion < 11600, false], - ["maven.modrinth:cloth-config" , "cloth_config" , mcVersion < 11600, false], - ["maven.modrinth:in-game-account-switcher" , "inGameAccountSwitcher" , true , false], - ["maven.modrinth:lazydfu" , "lazydfu" , true , false], - ["maven.modrinth:imblocker" , "imblockerfabric" , mcVersion < 12002, false], - ["curse.maven:smooth-boot-415758" , "smoothboot" , mcVersion < 12000, false] + ["curse.maven:auto-config-updated-api-373261", "auto_config_updated_api", mcVersion < 11600 , false], + ["maven.modrinth:cloth-config" , "cloth_config" , mcVersion < 11600 , false], + ["maven.modrinth:in-game-account-switcher" , "inGameAccountSwitcher" , mcVersion < 12002 , false], + ["maven.modrinth:lazydfu" , "lazydfu" , true , false], + ["maven.modrinth:imblocker" , "imblockerfabric" , mcVersion < 12002 , false], + ["curse.maven:smooth-boot-415758" , "smoothboot" , mcVersion < 12000 , false], + ["maven.modrinth:threadtweak" , "threadtweak" , mcVersion > 11904 && mcVersion < 12002, false], ] dependencies { @@ -98,14 +109,21 @@ dependencies { String propertyPrefix = item[1] boolean shouldResolve = item[2] boolean shouldTransitive = item[3] + boolean compileOnly = item[4] if (shouldResolve) { - modApi("${dependencyNotation}:${project.property("${propertyPrefix}_version")}") { - transitive(shouldTransitive) - } + if (compileOnly) { + modCompileOnly("${dependencyNotation}:${project.property("${propertyPrefix}_version")}") { + transitive(shouldTransitive) + } + } else { + modApi("${dependencyNotation}:${project.property("${propertyPrefix}_version")}") { + transitive(shouldTransitive) + } - productionRuntimeMods("${dependencyNotation}:${project.property("${propertyPrefix}_version")}") { - transitive(shouldTransitive) + productionRuntimeMods("${dependencyNotation}:${project.property("${propertyPrefix}_version")}") { + transitive(shouldTransitive) + } } } } diff --git a/gradle.properties b/gradle.properties index 32c06599..36de1522 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,7 +21,7 @@ mod_version=0.7 # Development Environment fabric_installer_version=0.11.2 -fabric_loader_version=0.14.21 +fabric_loader_version=0.14.22 # Annotation processor lombok_version=1.18.28 \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 4be53c99..28df378a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -37,6 +37,7 @@ def versions = Arrays.asList( "1.19.3", "1.19.4", "1.20.1", + "1.20.2", ) for (String version : versions) { diff --git a/src/main/java/top/hendrixshen/magiclib/language/impl/MagicLanguageResourceManager.java b/src/main/java/top/hendrixshen/magiclib/language/impl/MagicLanguageResourceManager.java index 70013fa7..49765ae0 100644 --- a/src/main/java/top/hendrixshen/magiclib/language/impl/MagicLanguageResourceManager.java +++ b/src/main/java/top/hendrixshen/magiclib/language/impl/MagicLanguageResourceManager.java @@ -60,18 +60,21 @@ public MagicLanguageResourceManager() { if (!entry.isDirectory()) { String languagePath = String.format("lang/%s.json", code); ResourceLocation resourceLocation = new ResourceLocation(namespace, languagePath); - //#if MC >= 11903 - Resource resource = new MagicLanguageResource(new FilePackResources(namespace, new File(resourceUrl.getPath()), true), resourceLocation, () -> { - //#else - //$$ Resource resource = new MagicLanguageResource(namespace, resourceLocation, () -> { - //#endif - try { - return jar.getInputStream(entry); - } catch (IOException e) { - throw new RuntimeException(e); - } - }); - + Resource resource = new MagicLanguageResource( + //#if MC > 12001 + //$$ new FilePackResources.FileResourcesSupplier(new File(resourceUrl.getPath()), true).openPrimary(namespace), + //#elseif MC > 11902 + new FilePackResources(namespace, new File(resourceUrl.getPath()), true), + //#else + //$$ namespace, + //#endif + resourceLocation, + () -> { + try { + return jar.getInputStream(entry); + } catch (IOException e) { + throw new RuntimeException(e); + }}); ret.put(resourceLocation, resource); } } @@ -100,18 +103,23 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { String code = matcher.group(2); String languagePath = String.format("lang/%s.json", code); ResourceLocation resourceLocation = new ResourceLocation(namespace, languagePath); - //#if MC >= 11903 - Resource resource = new MagicLanguageResource(new FilePackResources(namespace, file.toFile(), true), resourceLocation, () -> { - //#else - //$$ Resource resource = new MagicLanguageResource(namespace, resourceLocation, () -> { - //#endif - try { - return Files.newInputStream(file); - } catch (IOException e) { - throw new RuntimeException(e); - } - }); + Resource resource = new MagicLanguageResource( + //#if MC > 12001 + //$$ new FilePackResources.FileResourcesSupplier(file, true).openPrimary(namespace), + //#elseif MC > 11902 + new FilePackResources(namespace, file.toFile(), true), + //#else + //$$ namespace, + //#endif + resourceLocation, + () -> { + try { + return Files.newInputStream(file); + } catch (IOException e) { + throw new RuntimeException(e); + } + }); ret.put(resourceLocation, resource); } return FileVisitResult.CONTINUE; diff --git a/versions/1.19.4/gradle.properties b/versions/1.19.4/gradle.properties index 34aa7061..d874b709 100644 --- a/versions/1.19.4/gradle.properties +++ b/versions/1.19.4/gradle.properties @@ -7,8 +7,8 @@ minecraft_dependency=1.19.4 # Carpet - 1.4.101+v230319 # fabric-carpet-1.19.4-1.4.101+v230319.jar carpet_version=1.19.4-1.4.101+v230319 -# Fabric API 0.86.1+1.19.4 -fabric_version=0.86.1+1.19.4 +# Fabric API 0.87.0+1.19.4 +fabric_version=0.87.0+1.19.4 # Malilib - 0.15.4 # https://www.curseforge.com/minecraft/mc-mods/malilib/files/4519977 # malilib-fabric-1.19.4-0.15.4.jar diff --git a/versions/1.20.1/gradle.properties b/versions/1.20.1/gradle.properties index 3b530130..1a32b1b7 100644 --- a/versions/1.20.1/gradle.properties +++ b/versions/1.20.1/gradle.properties @@ -1,14 +1,14 @@ # Independent branch configuration # Development Environment minecraft_version=1.20.1 -minecraft_dependency=1.20.x +minecraft_dependency=>1.20 <=1.20.1 # Required Libraries # Carpet - 1.20-1.4.112+v230608 # fabric-carpet-1.20-1.4.112+v230608.jar carpet_version=1.20-1.4.112+v230608 -# Fabric API 0.86.1+1.20.1 -fabric_version=0.86.1+1.20.1 +# Fabric API 0.87.0+1.20.1 +fabric_version=0.87.0+1.20.1 # Malilib - 0.16.1 # https://www.curseforge.com/minecraft/mc-mods/malilib/files/4593073 # malilib-fabric-1.20.1-0.16.1.jar @@ -28,3 +28,6 @@ inGameAccountSwitcher_version=8.0.2-fabric1.20 # https://www.curseforge.com/minecraft/mc-mods/lazydfu/files/3821870 # lazydfu-0.1.3.jar lazydfu_version=0.1.3 +# ThreadTweak - 0.1.0+mc1.20.1 +# threadtweak-fabric-1.20.1-0.1.0.jar +threadtweak_version=0.1.0+mc1.20.1 diff --git a/versions/1.20.2/gradle.properties b/versions/1.20.2/gradle.properties new file mode 100644 index 00000000..8c4fb2f5 --- /dev/null +++ b/versions/1.20.2/gradle.properties @@ -0,0 +1,33 @@ +# Independent branch configuration +# Development Environment +minecraft_version=23w33a +minecraft_dependency=1.20.2-alpha.23.33.a + +# Required Libraries +# Carpet - 23w32a-1.4.114+v230809 +# fabric-carpet-23w32a-1.4.114+v230809.jar +carpet_version=23w32a-1.4.114+v230809 +# Fabric API 0.87.1+1.20.2 +fabric_version=0.87.1+1.20.2 +# Malilib - 0.16.1-nyan.2 +# https://jitpack.io/#Nyan-Work/malilib/23w33a.2 +# malilib-23w33a.2.jar +malilib_version=23w33a.2 +# Mod Menu - 7.2.1 +# modmenu-7.2.1.jar +modmenu_version=7.2.1 + +# Runtime Libraries - Only for development environment +# IMBlockerFabric 1.0.24 +# imblockerfabric-1.0.24.jar +imblockerfabric_version=1.0.24 +# In-Game Account Switcher +# TODO +inGameAccountSwitcher_version=0 +# LazyDFU 0.1.3 +# https://www.curseforge.com/minecraft/mc-mods/lazydfu/files/3821870 +# lazydfu-0.1.3.jar +lazydfu_version=0.1.3 +# ThreadTweak +# TODO +threadtweak_version=0 diff --git a/versions/mapping-1.20.1-1.20.2.txt b/versions/mapping-1.20.1-1.20.2.txt new file mode 100644 index 00000000..e69de29b