Skip to content

Commit

Permalink
Update libraries, delete lex forge, add more custom error messages, m…
Browse files Browse the repository at this point in the history
…ove logo to common folder, and port 1.21.4
  • Loading branch information
TonimatasDEV committed Dec 5, 2024
1 parent 798ff4b commit 94a7e99
Show file tree
Hide file tree
Showing 24 changed files with 43 additions and 233 deletions.
27 changes: 13 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,20 @@ import net.fabricmc.loom.api.LoomGradleExtensionAPI
plugins {
java
id("architectury-plugin") version "3.4-SNAPSHOT"
id("dev.architectury.loom") version "1.6-SNAPSHOT" apply false
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("dev.architectury.loom") version "1.7-SNAPSHOT" apply false
id("com.gradleup.shadow") version "8.3.5" apply false
}

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

architectury {
minecraft = minecraftVersion
}

allprojects {
apply(plugin = "java")

val versionArray = minecraftVersionRange.split(",")
version = "$modVersion-${versionArray[0]}-to-${versionArray[1]}"
group = "dev.tonimatas.packetfixer"
}


subprojects {
apply(plugin = "dev.architectury.loom")
apply(plugin = "architectury-plugin")
apply(plugin = "com.gradleup.shadow")

base {
archivesName.set("packetfixer-" + project.name)
Expand All @@ -40,8 +30,17 @@ subprojects {
"minecraft"("com.mojang:minecraft:$minecraftVersion")
"mappings"(project.the<LoomGradleExtensionAPI>().officialMojangMappings())
}

}

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

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

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(21)
}

Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
val fabricLoaderVersion: String by extra

architectury {
common("fabric", /*"forge",*/ "neoforge")
common("fabric", "neoforge")
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import dev.tonimatas.packetfixer.util.Config;
import net.minecraft.network.CompressionDecoder;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.*;

@Mixin(value = CompressionDecoder.class, priority = 9999)
public class CompressionDecoderMixin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import dev.tonimatas.packetfixer.util.Config;
import net.minecraft.network.CompressionEncoder;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(value = CompressionEncoder.class, priority = 9999)
Expand All @@ -12,4 +14,9 @@ public class CompressionEncoderMixin {
private int newSize(int value) {
return Config.getDecoderSize();
}

@ModifyArg(method = "encode(Lio/netty/channel/ChannelHandlerContext;Lio/netty/buffer/ByteBuf;Lio/netty/buffer/ByteBuf;)V", at = @At(value = "INVOKE", target = "Ljava/lang/IllegalArgumentException;<init>(Ljava/lang/String;)V"))
private String newSizeString(String value) {
return value.replaceAll("8388608", String.valueOf(Config.getDecoderSize())) + ". You can modify it in the Packet Fixer config.";
}
}
File renamed without changes
16 changes: 4 additions & 12 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
@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

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

architectury {
platformSetupLoomIde()
fabric()
}

val minecraftVersion: String by extra
val minecraftVersionRange: String by extra
val fabricLoaderVersion: String by extra
val modVersion: String by extra

val common by configurations.creating
val shadowCommon by configurations.creating
val common: Configuration by configurations.creating
val shadowCommon: Configuration by configurations.creating

configurations["compileClasspath"].extendsFrom(common)
configurations["runtimeClasspath"].extendsFrom(common)
Expand All @@ -33,7 +25,7 @@ dependencies {
}

tasks.withType<ProcessResources> {
val replaceProperties = mapOf("modVersion" to modVersion, "minimumMinecraftVersion" to minecraftVersionRange.split(",")[0], "minecraftVersion" to minecraftVersion)
val replaceProperties = mapOf("modVersion" to modVersion, "minecraftVersion" to minecraftVersion)

inputs.properties(replaceProperties)

Expand All @@ -49,5 +41,5 @@ tasks.withType<ShadowJar> {

tasks.withType<RemapJarTask> {
val shadowTask = tasks.shadowJar.get()
input.set(shadowTask.archiveFile)
inputFile.set(shadowTask.archiveFile)
}
4 changes: 2 additions & 2 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"repo": "https://github.com/TonimatasDEV/PacketFixer"
},
"license": "MIT",
"icon": "assets/packetfixer/icon.png",
"icon": "icon.png",
"environment": "*",
"entrypoints": {
"main": [
Expand All @@ -24,6 +24,6 @@
],
"depends": {
"fabricloader": "*",
"minecraft": ">=${minimumMinecraftVersion} <=${minecraftVersion}"
"minecraft": "${minecraftVersion}"
}
}
2 changes: 1 addition & 1 deletion fabric/src/main/resources/packetfixer-fabric.mixins.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"required": true,
"minVersion": "0.8",
"package": "dev.tonimatas.packetfixer.mixin",
"package": "dev.tonimatas.packetfixer.mixins",
"compatibilityLevel": "JAVA_21",
"mixins": [
],
Expand Down
61 changes: 0 additions & 61 deletions forge/build.gradle.kts

This file was deleted.

1 change: 0 additions & 1 deletion forge/gradle.properties

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

29 changes: 0 additions & 29 deletions forge/src/main/resources/META-INF/mods.toml

This file was deleted.

Binary file removed forge/src/main/resources/icon.png
Binary file not shown.
6 changes: 0 additions & 6 deletions forge/src/main/resources/pack.mcmeta

This file was deleted.

12 changes: 0 additions & 12 deletions forge/src/main/resources/packetfixer-forge.mixins.json

This file was deleted.

9 changes: 4 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
org.gradle.jvmargs=-Xmx5G

# Mod Properties
modVersion=1.4.2
modVersion=1.5.0

# Minecraft
minecraftVersion=1.21.3
minecraftVersionRange=1.21,1.21.3
minecraftVersion=1.21.4

# Forge Properties
#forgeVersion=51.0.18

# Fabric Properties
fabricLoaderVersion=0.16.7
fabricLoaderVersion=0.16.9
yarnMappings=1

# NeoForge Properties
neoforgeVersion=21.3.0-beta
neoforgeVersion=21.4.7-beta
Loading

0 comments on commit 94a7e99

Please sign in to comment.