diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 95b0275..0000000 --- a/build.gradle +++ /dev/null @@ -1,5 +0,0 @@ -repositories { -} - -dependencies { -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..2d1df19 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + java +} + +val modVersion: String by extra +val minecraftVersion: String by extra + +subprojects { + apply(plugin = "java") + + version = "$modVersion-$minecraftVersion" + group = "net.tonimatasdev" + + base.archivesName.set("PacketFixer-" + project.name) +} diff --git a/fabric/build.gradle b/fabric/build.gradle deleted file mode 100644 index 796eef9..0000000 --- a/fabric/build.gradle +++ /dev/null @@ -1,51 +0,0 @@ -//file:noinspection GroovyAssignabilityCheck -//file:noinspection GroovyAccessibility - -plugins { - id 'fabric-loom' version '1.3-SNAPSHOT' -} - -version = mod_version + "-" + minecraft_version -group = "net.tonimatasdev" - -base { - archivesName = "PacketFixerFabric" -} - -repositories { -} - -dependencies { - minecraft "com.mojang:minecraft:${minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${loader_version}" - -} - -processResources { - inputs.property "version", mod_version - inputs.property "minecraft_version", minecraft_version - inputs.property "loader_version", loader_version - filteringCharset "UTF-8" - - filesMatching("fabric.mod.json") { - expand "version": mod_version, "minecraft_version": minecraft_version - } -} - -tasks.withType(JavaCompile).configureEach { - it.options.release = 17 -} - -java { - withSourcesJar() - - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 -} - -jar { - from("LICENSE") { - rename { "${it}_${project.base.archivesName.get()}"} - } -} diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts new file mode 100644 index 0000000..95080de --- /dev/null +++ b/fabric/build.gradle.kts @@ -0,0 +1,44 @@ +@file:Suppress("UnstableApiUsage") + +plugins { + id("fabric-loom") version "1.3-SNAPSHOT" +} + +val loaderVersion: String by extra +val yarnMappings: String by extra +val modVersion: String by extra +val minecraftVersion: String by extra + +dependencies { + minecraft("com.mojang:minecraft:$minecraftVersion") + mappings("net.fabricmc:yarn:$yarnMappings:v2") + modImplementation("net.fabricmc:fabric-loader:$loaderVersion") + +} + +tasks.withType { + val replaceProperties = mapOf("version" to modVersion, "minecraftVersion" to minecraftVersion) + + inputs.properties(replaceProperties) + + filesMatching("fabric.mod.json") { + expand(replaceProperties) + } +} + +tasks.withType { + options.release.set(17) +} + +java { + withSourcesJar() + + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +tasks.jar { + from("LICENSE") { + rename { "${it}_${project.base.archivesName.get()}"} + } +} diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 9763e0a..b0aabf0 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -23,6 +23,6 @@ ], "depends": { "fabricloader": ">=0.12.12", - "minecraft": "${minecraft_version}" + "minecraft": "${minecraftVersion}" } } diff --git a/forge/build.gradle b/forge/build.gradle deleted file mode 100644 index 932740a..0000000 --- a/forge/build.gradle +++ /dev/null @@ -1,107 +0,0 @@ -//file:noinspection GroovyAssignabilityCheck - -plugins { - id 'net.minecraftforge.gradle' version '[6.0,6.2)' - id 'org.spongepowered.mixin' version '0.7-SNAPSHOT' - id 'idea' - id 'eclipse' -} - -group = 'net.tonimatasdev' -version = mod_version + "-" + minecraft_version - -base { - archivesName = "PacketFixerForge" -} - -java { - toolchain.languageVersion = JavaLanguageVersion.of(17) -} - -minecraft { - mappings channel: 'official', version: minecraft_version - - copyIdeResources = true - - runs { - configureEach { - workingDirectory project.file('run') - property 'forge.logging.markers', 'REGISTRIES' - property 'forge.logging.console.level', 'debug' - - mods { - packetfixer { - source sourceSets.main - } - } - } - - client { - property 'forge.enabledGameTestNamespaces', "packetfixer" - } - - server { - property 'forge.enabledGameTestNamespaces', "packetfixer" - args '--nogui' - } - - gameTestServer { - property 'forge.enabledGameTestNamespaces', "packetfixer" - } - - data { - workingDirectory project.file('run-data') - args '--mod', "packetfixer", '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') - } - } -} - -mixin { - add sourceSets.main, "packetfixer.refmap.json" - config "packetfixer.mixins.json" -} - -sourceSets.main.resources { srcDir 'src/generated/resources' } - -repositories { - -} - -dependencies { - minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" - annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' -} - - - -tasks.named('processResources', ProcessResources).configure { - var replaceProperties = [ - minecraft_version_range: minecraft_version_range, forge_version_range: forge_version_range, mod_version: mod_version] - - inputs.properties replaceProperties - - filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { - expand replaceProperties + [project: project] - } -} - - -tasks.named('jar', Jar).configure { - manifest { - attributes([ - "Specification-Title": "PacketFixerForge", - "Specification-Vendor": "TonimatasDEV", - "Specification-Version": "1", - "Implementation-Title": "PacketFixerForge", - "Implementation-Version": project.jar.archiveVersion, - "Implementation-Vendor": "TonimatasDEV", - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") - ]) - } - - finalizedBy 'reobfJar' -} - -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' -} diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts new file mode 100644 index 0000000..8baf610 --- /dev/null +++ b/forge/build.gradle.kts @@ -0,0 +1,105 @@ +plugins { + id("net.minecraftforge.gradle") version "[6.0,6.2)" + id("org.spongepowered.mixin") version "0.7-SNAPSHOT" + id("idea") + id("eclipse") +} + +val modVersion: String by extra +val minecraftVersion: String by extra +val forgeVersion: String by extra +val forgeVersionRange: String by extra + +group = "net.tonimatasdev" +version = "$modVersion-$minecraftVersion" + +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(17)) + withSourcesJar() +} + +minecraft { + mappings("official", minecraftVersion) + + copyIdeResources.set(true) + + runs { + configureEach { + workingDirectory(project.file("run")) + property("forge.logging.markers", "REGISTRIES") + property("forge.logging.console.level", "debug") + + mods { + create("packetfixer") { + source(sourceSets.main.get()) + } + } + } + + create("client") { + property("forge.enabledGameTestNamespaces", "packetfixer") + } + + create("server") { + property("forge.enabledGameTestNamespaces", "packetfixer") + args("--nogui") + } + + create("gameTestServer") { + property("forge.enabledGameTestNamespaces", "packetfixer") + } + + create("data") { + workingDirectory(project.file("run-data")) + args("--mod", "packetfixer", "--all", "--output", file("src/generated/resources/"), "--existing", file("src/main/resources/")) + } + } +} + +mixin { + add(sourceSets.main.get(), "packetfixer.refmap.json") + config("packetfixer.mixins.json") +} + +sourceSets.main.get().resources { srcDir("src/generated/resources") } + +repositories { + +} + +dependencies { + minecraft("net.minecraftforge:forge:$minecraftVersion-$forgeVersion") + annotationProcessor("org.spongepowered:mixin:0.8.5:processor") +} + + + +tasks.withType { + val replaceProperties = mapOf("forgeVersionRange" to forgeVersionRange, "version" to modVersion, "minecraftVersion" to minecraftVersion) + + inputs.properties(replaceProperties) + + filesMatching(listOf("META-INF/mods.toml", "pack.mcmeta")) { + expand(replaceProperties) + } +} + + +tasks.jar { + manifest { + attributes( + "Specification-Title" to "PacketFixerForge", + "Specification-Vendor" to "TonimatasDEV", + "Specification-Version" to modVersion, + "Implementation-Title" to "PacketFixerForge", + "Implementation-Version" to modVersion, + "Implementation-Vendor" to "TonimatasDEV" + ) + } + + finalizedBy("reobfJar") +} + +tasks.withType { + options.encoding = "UTF-8" +} diff --git a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/PacketFixerForge.java b/forge/src/main/java/net/tonimatasdev/packetfixerforge/PacketFixerForge.java similarity index 85% rename from forge/src/main/java/net/tonimatasdev/packetsizedoubler/PacketFixerForge.java rename to forge/src/main/java/net/tonimatasdev/packetfixerforge/PacketFixerForge.java index e257ad6..0c56cdb 100644 --- a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/PacketFixerForge.java +++ b/forge/src/main/java/net/tonimatasdev/packetfixerforge/PacketFixerForge.java @@ -1,4 +1,4 @@ -package net.tonimatasdev.packetsizedoubler; +package net.tonimatasdev.packetfixerforge; import com.mojang.logging.LogUtils; import net.minecraftforge.fml.common.Mod; diff --git a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/ClientboundCustomPayloadPacketMixin.java b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ClientboundCustomPayloadPacketMixin.java similarity index 91% rename from forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/ClientboundCustomPayloadPacketMixin.java rename to forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ClientboundCustomPayloadPacketMixin.java index 5a8354a..5e4b736 100644 --- a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/ClientboundCustomPayloadPacketMixin.java +++ b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ClientboundCustomPayloadPacketMixin.java @@ -1,4 +1,4 @@ -package net.tonimatasdev.packetsizedoubler.mixin; +package net.tonimatasdev.packetfixerforge.mixin; import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket; diff --git a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/ClientboundCustomQueryPacketMixin.java b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ClientboundCustomQueryPacketMixin.java similarity index 91% rename from forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/ClientboundCustomQueryPacketMixin.java rename to forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ClientboundCustomQueryPacketMixin.java index 3d50128..9f8749c 100644 --- a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/ClientboundCustomQueryPacketMixin.java +++ b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ClientboundCustomQueryPacketMixin.java @@ -1,4 +1,4 @@ -package net.tonimatasdev.packetsizedoubler.mixin; +package net.tonimatasdev.packetfixerforge.mixin; import net.minecraft.network.protocol.login.ClientboundCustomQueryPacket; import org.spongepowered.asm.mixin.Mixin; diff --git a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/CompressionDecoderMixin.java b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/CompressionDecoderMixin.java similarity index 88% rename from forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/CompressionDecoderMixin.java rename to forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/CompressionDecoderMixin.java index 670989f..eae053a 100644 --- a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/CompressionDecoderMixin.java +++ b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/CompressionDecoderMixin.java @@ -1,4 +1,4 @@ -package net.tonimatasdev.packetsizedoubler.mixin; +package net.tonimatasdev.packetfixerforge.mixin; import net.minecraft.network.CompressionDecoder; import org.spongepowered.asm.mixin.Mixin; diff --git a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/CompressionEncoderMixin.java b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/CompressionEncoderMixin.java similarity index 97% rename from forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/CompressionEncoderMixin.java rename to forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/CompressionEncoderMixin.java index 069bd44..ec89b1f 100644 --- a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/CompressionEncoderMixin.java +++ b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/CompressionEncoderMixin.java @@ -1,4 +1,4 @@ -package net.tonimatasdev.packetsizedoubler.mixin; +package net.tonimatasdev.packetfixerforge.mixin; import com.mojang.logging.LogUtils; import io.netty.buffer.ByteBuf; diff --git a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/NbtAccounterMixin.java b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/NbtAccounterMixin.java similarity index 91% rename from forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/NbtAccounterMixin.java rename to forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/NbtAccounterMixin.java index 29e66bd..50aa8d1 100644 --- a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/NbtAccounterMixin.java +++ b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/NbtAccounterMixin.java @@ -1,4 +1,4 @@ -package net.tonimatasdev.packetsizedoubler.mixin; +package net.tonimatasdev.packetfixerforge.mixin; import net.minecraft.nbt.NbtAccounter; import org.objectweb.asm.Opcodes; diff --git a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/PacketEncoderMixin.java b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/PacketEncoderMixin.java similarity index 91% rename from forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/PacketEncoderMixin.java rename to forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/PacketEncoderMixin.java index 528a5d5..feaa283 100644 --- a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/PacketEncoderMixin.java +++ b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/PacketEncoderMixin.java @@ -1,4 +1,4 @@ -package net.tonimatasdev.packetsizedoubler.mixin; +package net.tonimatasdev.packetfixerforge.mixin; import net.minecraft.network.PacketEncoder; import org.spongepowered.asm.mixin.Mixin; diff --git a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/ServerboundCustomPayloadPacketMixin.java b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ServerboundCustomPayloadPacketMixin.java similarity index 91% rename from forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/ServerboundCustomPayloadPacketMixin.java rename to forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ServerboundCustomPayloadPacketMixin.java index 3f85dd8..ef1cf00 100644 --- a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/ServerboundCustomPayloadPacketMixin.java +++ b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ServerboundCustomPayloadPacketMixin.java @@ -1,4 +1,4 @@ -package net.tonimatasdev.packetsizedoubler.mixin; +package net.tonimatasdev.packetfixerforge.mixin; import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; import org.spongepowered.asm.mixin.Mixin; diff --git a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/ServerboundCustomQueryPacketMixin.java b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ServerboundCustomQueryPacketMixin.java similarity index 95% rename from forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/ServerboundCustomQueryPacketMixin.java rename to forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ServerboundCustomQueryPacketMixin.java index abd1a71..f2c9822 100644 --- a/forge/src/main/java/net/tonimatasdev/packetsizedoubler/mixin/ServerboundCustomQueryPacketMixin.java +++ b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ServerboundCustomQueryPacketMixin.java @@ -1,4 +1,4 @@ -package net.tonimatasdev.packetsizedoubler.mixin; +package net.tonimatasdev.packetfixerforge.mixin; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.protocol.login.ServerboundCustomQueryPacket; diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 240a5db..47370ae 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -1,11 +1,11 @@ modLoader="javafml" -loaderVersion="${forge_version_range}" +loaderVersion="${forgeVersionRange}" license="MIT" issueTrackerURL="https://github.com/TonimatasDEV/PacketFixer" [[mods]] modId="packetfixer" -version="${mod_version}" +version="${modVersion}" displayName="PacketFixer" icon="icon.png" @@ -17,13 +17,13 @@ A simple mod to solve various problems with packets. [[dependencies.packetfixer]] modId="forge" mandatory=true -versionRange="${forge_version_range}" +versionRange="${forgeVersionRange}" ordering="NONE" side="BOTH" [[dependencies.packetfixer]] modId="minecraft" mandatory=true -versionRange="${minecraft_version_range}" +versionRange="[${minecraftVersion}]" ordering="NONE" side="BOTH" diff --git a/forge/src/main/resources/packetfixer.mixins.json b/forge/src/main/resources/packetfixer.mixins.json index 86da09a..fa9b87c 100644 --- a/forge/src/main/resources/packetfixer.mixins.json +++ b/forge/src/main/resources/packetfixer.mixins.json @@ -1,7 +1,7 @@ { "required": true, "minVersion": "0.8", - "package": "net.tonimatasdev.packetsizedoubler.mixin", + "package": "net.tonimatasdev.packetfixerforge.mixin", "compatibilityLevel": "JAVA_17", "refmap": "packetfixer.refmap.json", "injectors": { diff --git a/gradle.properties b/gradle.properties index cab1bf4..7593512 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,17 +2,16 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false # Mod Properties -mod_version=1.1.4 +modVersion=1.1.4 # Minecraft properties -minecraft_version=1.20.1 -minecraft_version_range=[1.20,1.20.1] +minecraftVersion=1.20.1 # Forge properties -forge_version=47.1.1 -forge_version_range=[46,48) +forgeVersion=47.1.1 +forgeVersionRange=[46,48) # Fabric properties -loader_version=0.14.21 -yarn_mappings=1.20.1+build.9 \ No newline at end of file +loaderVersion=0.14.21 +yarnMappings=1.20.1+build.9 \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index e775ef5..0000000 --- a/settings.gradle +++ /dev/null @@ -1,16 +0,0 @@ -pluginManagement { - repositories { - mavenCentral() - gradlePluginPortal() - maven { url = 'https://maven.minecraftforge.net/' } - maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } - maven { url = 'https://maven.fabricmc.net/' } - } -} - -plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' -} - -include 'fabric', 'forge' -rootProject.name = 'PacketFixer' \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..a243e82 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,12 @@ +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + maven(url = "https://maven.minecraftforge.net/") + maven(url = "https://repo.spongepowered.org/repository/maven-public/") + maven(url = "https://maven.fabricmc.net/") + } +} + +include("fabric", "forge") +rootProject.name = "PacketFixer"