Skip to content

Commit

Permalink
Now mod loads correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
TonimatasDEV committed Sep 20, 2024
1 parent ad1e87f commit f6264d4
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 56 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Java with Gradle

on:
push:
branches: [master]
branches: [1.12.2]

jobs:
build:
Expand All @@ -11,10 +11,10 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Set up JDK 17
- name: Set up JDK 8
uses: actions/[email protected]
with:
java-version: 17
java-version: 8

- name: Give permissions to Gradle
run: chmod +x ./gradlew
Expand Down
6 changes: 1 addition & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ subprojects {
apply(plugin = "java")

version = "$modVersion-$minecraftVersion"
group = "net.tonimatasdev"
group = "dev.tonimatas"

base.archivesName.set("PacketFixer-" + project.name)

dependencies {
implementation("org.spongepowered:mixin:0.8.5")
}
}
68 changes: 24 additions & 44 deletions forge/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,77 +1,59 @@
plugins {
id("net.minecraftforge.gradle") version "6.+"
id("com.gtnewhorizons.retrofuturagradle") version "1.3.35"
id("idea")
id("eclipse")
}

val modVersion: String by extra
val minecraftVersion: String by extra
val forgeVersion: String by extra

group = "net.tonimatasdev"
group = "dev.tonimatas"
version = "$modVersion-$minecraftVersion"


java {
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
withSourcesJar()
}

minecraft {
mappings("snapshot", "20171003-1.12")

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/"))
}
}
mcVersion.set("1.12.2")

mcpMappingChannel.set("stable")
mcpMappingVersion.set("39")

useDependencyAccessTransformers.set(true)
}

sourceSets.main.get().resources { srcDir("src/generated/resources") }

repositories {

maven(url = "https://maven.cleanroommc.com")
}

dependencies {
minecraft("net.minecraftforge:forge:$minecraftVersion-$forgeVersion")
//minecraft("net.minecraftforge:forge:$minecraftVersion-$forgeVersion")

var mixin = modUtils.enableMixins("zone.rong:mixinbooter:9.1", "packetfixer.mixins.refmap.json") as String
api(mixin) {
isTransitive = false
}
annotationProcessor("org.ow2.asm:asm-debug-all:5.2")
annotationProcessor("com.google.guava:guava:24.1.1-jre")
annotationProcessor("com.google.code.gson:gson:2.8.6")
annotationProcessor(mixin) {
isTransitive = false
}
}



tasks.withType<ProcessResources> {
tasks.processResources {
val replaceProperties = mapOf("modVersion" to modVersion, "minecraftVersion" to minecraftVersion)

inputs.properties(replaceProperties)

filesMatching(listOf("META-INF/mods.toml", "pack.mcmeta")) {
filesMatching(listOf("mcmod.info", "pack.mcmeta")) {
expand(replaceProperties)
}
}
Expand All @@ -81,8 +63,6 @@ tasks.jar {
manifest {
attributes(
"Manifest-Version" to "1.0",
"FMLCorePluginContainsFMLMod" to true,
"FMLCorePlugin" to "net.tonimatasdev.packetfixer.PacketFixer"
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.apache.logging.log4j.Logger;


@Mod(modid = "packetfixer")
@Mod(modid = "packetfixer", dependencies = "required-after:mixinbooter")
public class PacketFixer {
public static final Logger LOGGER = LogManager.getLogger("PacketFixer");

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package dev.tonimatas.packetfixer;

import zone.rong.mixinbooter.ILateMixinLoader;

import java.util.Collections;
import java.util.List;

public class PacketFixerMixins implements ILateMixinLoader {
@Override
public List<String> getMixinConfigs() {
return Collections.singletonList("packetfixer.mixins.json");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@Mixin(value = PacketBuffer.class, priority = 9999)
public class PacketBufferMixin {
@ModifyConstant(method = "readCompoundTag", constant = @Constant(longValue = 2097152L))
private long newSize$readCompoundTag(long value) {
private long newSize$readCompoundTag(long constant) {
return Config.getNbtMaxSize();
}
}
1 change: 1 addition & 0 deletions forge/src/main/resources/packetfixer.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"package": "dev.tonimatas.packetfixer.mixins",
"compatibilityLevel": "JAVA_8",
"plugin": "dev.tonimatas.packetfixer.mixins.MixinConfigPlugin",
"refmap": "packetfixer.mixins.refmap.json",
"mixins": [
"CPacketCustomPayloadMixin",
"NettyCompressionDecoderMixin",
Expand Down
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ org.gradle.daemon=false
# Mod Properties
modVersion=1.4.3

minecraftVersion=1.12.2
forgeVersion=14.23.5.2860
minecraftVersion=1.12.2
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pluginManagement {
maven(url = "https://maven.minecraftforge.net/")
maven(url = "https://repo.spongepowered.org/repository/maven-public/")
maven(url = "https://maven.fabricmc.net/")
maven(url = "https://nexus.gtnewhorizons.com/repository/public/")
}
}

Expand Down

0 comments on commit f6264d4

Please sign in to comment.