Skip to content

Commit

Permalink
Fix all forge problems and release for fabric
Browse files Browse the repository at this point in the history
  • Loading branch information
TonimatasDEV committed Feb 10, 2024
1 parent 18ead32 commit 1cafc51
Show file tree
Hide file tree
Showing 48 changed files with 401 additions and 347 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.16.5]

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
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
/.idea/
/artifacts/

/common/build/
/fabric/build/
/forge/build/
/fabric/.gradle/
/forge/.gradle/
/common/.gradle/
/fabric/run/
/forge/run/
43 changes: 10 additions & 33 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,49 +1,26 @@
import net.fabricmc.loom.api.LoomGradleExtensionAPI

plugins {
java
id("architectury-plugin") version "3.4-SNAPSHOT"
id("dev.architectury.loom") version "1.4-SNAPSHOT" apply false
}

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

architectury {
minecraft = minecraftVersion
}

subprojects {
apply(plugin = "dev.architectury.loom")

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

configure<LoomGradleExtensionAPI> {
silentMojangMappingsLicense()
}

dependencies {
"minecraft"("com.mojang:minecraft:$minecraftVersion")
"mappings"(project.the<LoomGradleExtensionAPI>().officialMojangMappings())
}
}

allprojects {
apply(plugin = "java")
apply(plugin = "architectury-plugin")

version = modVersion
group = "dev.tonimatas.packetfixer"
group = "net.tonimatasdev"
version = "$modVersion-$minecraftVersion"
base.archivesName.set("PacketFixer-" + project.name)

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

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}

java {
withSourcesJar()
}
}
}
9 changes: 0 additions & 9 deletions common/build.gradle.kts

This file was deleted.

13 changes: 0 additions & 13 deletions common/src/main/java/dev/tonimatas/packetfixer/PacketFixer.java

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions common/src/main/java/dev/tonimatas/packetfixer/util/Hooks.java

This file was deleted.

24 changes: 0 additions & 24 deletions common/src/main/resources/packetfixer-common.mixins.json

This file was deleted.

61 changes: 14 additions & 47 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
@file:Suppress("DEPRECATION", "HasPlatformType")

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.fabricmc.loom.task.RemapJarTask
import org.gradle.api.component.AdhocComponentWithVariants
@file:Suppress("UnstableApiUsage")

plugins {
id("com.github.johnrengelman.shadow") version "7.1.2"
}

architectury {
platformSetupLoomIde()
fabric()
id("fabric-loom") version "1.5-SNAPSHOT"
}

val minecraftVersion: String by extra
val fabricLoaderVersion: String by extra
val fabricMinecraftVersionRange: String by extra
val loaderVersion: String by extra
val yarnMappings: String by extra
val modVersion: String by extra
val minecraftVersion: String by extra

val common by configurations.creating
val shadowCommon by configurations.creating

configurations["compileClasspath"].extendsFrom(common)
configurations["runtimeClasspath"].extendsFrom(common)
configurations["developmentFabric"].extendsFrom(common)
repositories {
maven(url = "https://maven.fabricmc.net/")
maven(url = "https://libraries.minecraft.net/")
}

dependencies {
modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion")
minecraft("com.mojang:minecraft:$minecraftVersion")
mappings("net.fabricmc:yarn:$yarnMappings:v2")
modImplementation("net.fabricmc:fabric-loader:$loaderVersion")

common(project(path = ":common", configuration = "namedElements")) { isTransitive = false }
shadowCommon(project(path = ":common", configuration = "transformProductionFabric")) { isTransitive = false }
}

tasks.withType<ProcessResources> {
Expand All @@ -42,30 +31,8 @@ tasks.withType<ProcessResources> {
}
}

tasks.withType<ShadowJar> {
configurations = listOf(shadowCommon)
archiveClassifier.set("dev-shadow")
}

tasks.withType<RemapJarTask> {
val shadowTask = tasks.shadowJar.get()
input.set(shadowTask.archiveFile)
dependsOn(shadowTask)
archiveClassifier.set("")
}

tasks.jar {
archiveClassifier.set("dev")
}

tasks.sourcesJar {
val commonSources = project(":common").tasks.sourcesJar.get()
dependsOn(commonSources)
from(commonSources.archiveFile.map { zipTree(it) })
}

components.getByName<AdhocComponentWithVariants>("java").apply {
withVariantsFromConfiguration(project.configurations["shadowRuntimeElements"]) {
skip()
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}"}
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package net.tonimatasdev.packetfixerfabric;

import net.fabricmc.api.ModInitializer;
import org.apache.logging.log4j.LogManager;

public class PacketFixerFabric implements ModInitializer {
@Override
public void onInitialize() {
LogManager.getLogger().info("Packet Fixer (Fabric) has been initialized successfully");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package net.tonimatasdev.packetfixerfabric.mixin;


import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(value = CustomPayloadC2SPacket.class, priority = 9999)
public class CustomPayloadC2SPacketMixin {
@ModifyConstant(method = "read", constant = @Constant(intValue = 32767))
private int newSize(int value) {
return Integer.MAX_VALUE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package net.tonimatasdev.packetfixerfabric.mixin;

import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(value = CustomPayloadS2CPacket.class, priority = 9999)
public class CustomPayloadS2CPacketMixin {
@ModifyConstant(method = "<init>*", constant = @Constant(intValue = 1048576))
private static int newSize(int value) {
return Integer.MAX_VALUE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package net.tonimatasdev.packetfixerfabric.mixin;

import net.minecraft.network.packet.s2c.login.LoginQueryRequestS2CPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(value = LoginQueryRequestS2CPacket.class, priority = 9999)
public class LoginQueryRequestS2CPacketMixin {
@ModifyConstant(method = "read", constant = @Constant(intValue = 1048576))
private int newSize(int value) {
return Integer.MAX_VALUE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package net.tonimatasdev.packetfixerfabric.mixin;

import net.minecraft.network.packet.c2s.login.LoginQueryResponseC2SPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(value = LoginQueryResponseC2SPacket.class, priority = 9999)
public class LoginQueryResponseC2SPacketMixin {
@ModifyConstant(method = "read", constant = @Constant(intValue = 1048576))
private int newSize(int value) {
return Integer.MAX_VALUE;
}
}
Loading

0 comments on commit 1cafc51

Please sign in to comment.