Skip to content

Commit

Permalink
Support MInecraft 23w33a (1.20.2 Snapshot)
Browse files Browse the repository at this point in the history
Signed-off-by: Hendrix-Shen <[email protected]>
  • Loading branch information
Hendrix-Shen committed Aug 21, 2023
1 parent 0a3f564 commit f355041
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 45 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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 {
Expand Down
50 changes: 34 additions & 16 deletions common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand All @@ -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 {
Expand All @@ -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)
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def versions = Arrays.asList(
"1.19.3",
"1.19.4",
"1.20.1",
"1.20.2",
)

for (String version : versions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions versions/1.19.4/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions versions/1.20.1/gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
33 changes: 33 additions & 0 deletions versions/1.20.2/gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Empty file.

0 comments on commit f355041

Please sign in to comment.