Skip to content

Commit 0bcb0aa

Browse files
committed
Setup architectury
1 parent 1855ecb commit 0bcb0aa

File tree

56 files changed

+443
-666
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+443
-666
lines changed

.gitignore

+118-17
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,118 @@
1-
# Project exclude paths
2-
/.gradle/
3-
/build/
4-
/build/classes/java/main/
5-
/run/
6-
/.idea/
7-
/artifacts/
8-
9-
/fabric/build/
10-
/forge/build/
11-
/neoforge/build/
12-
/fabric/.gradle/
13-
/forge/.gradle/
14-
/neoforge/.gradle/
15-
/fabric/run/
16-
/forge/run/
17-
/neoforge/run/
1+
# User-specific stuff
2+
.idea/
3+
4+
*.iml
5+
*.ipr
6+
*.iws
7+
8+
# IntelliJ
9+
out/
10+
# mpeltonen/sbt-idea plugin
11+
.idea_modules/
12+
13+
# JIRA plugin
14+
atlassian-ide-plugin.xml
15+
16+
# Compiled class file
17+
*.class
18+
19+
# Log file
20+
*.log
21+
22+
# BlueJ files
23+
*.ctxt
24+
25+
# Package Files #
26+
*.jar
27+
*.war
28+
*.nar
29+
*.ear
30+
*.zip
31+
*.tar.gz
32+
*.rar
33+
34+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
35+
hs_err_pid*
36+
37+
*~
38+
39+
# temporary files which can be created if a process still has a handle open of a deleted file
40+
.fuse_hidden*
41+
42+
# KDE directory preferences
43+
.directory
44+
45+
# Linux trash folder which might appear on any partition or disk
46+
.Trash-*
47+
48+
# .nfs files are created when an open file is removed but is still being accessed
49+
.nfs*
50+
51+
# General
52+
.DS_Store
53+
.AppleDouble
54+
.LSOverride
55+
56+
# Icon must end with two \r
57+
Icon
58+
59+
# Thumbnails
60+
._*
61+
62+
# Files that might appear in the root of a volume
63+
.DocumentRevisions-V100
64+
.fseventsd
65+
.Spotlight-V100
66+
.TemporaryItems
67+
.Trashes
68+
.VolumeIcon.icns
69+
.com.apple.timemachine.donotpresent
70+
71+
# Directories potentially created on remote AFP share
72+
.AppleDB
73+
.AppleDesktop
74+
Network Trash Folder
75+
Temporary Items
76+
.apdisk
77+
78+
# Windows thumbnail cache files
79+
Thumbs.db
80+
Thumbs.db:encryptable
81+
ehthumbs.db
82+
ehthumbs_vista.db
83+
84+
# Dump file
85+
*.stackdump
86+
87+
# Folder config file
88+
[Dd]esktop.ini
89+
90+
# Recycle Bin used on file shares
91+
$RECYCLE.BIN/
92+
93+
# Windows Installer files
94+
*.cab
95+
*.msi
96+
*.msix
97+
*.msm
98+
*.msp
99+
100+
# Windows shortcuts
101+
*.lnk
102+
103+
.gradle
104+
build/
105+
106+
# Ignore Gradle GUI config
107+
gradle-app.setting
108+
109+
# Cache of project
110+
.gradletasknamecache
111+
112+
**/build/
113+
114+
# Common working directory
115+
run/
116+
117+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
118+
!gradle-wrapper.jar

build.gradle.kts

+37-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,49 @@
1+
import net.fabricmc.loom.api.LoomGradleExtensionAPI
2+
13
plugins {
24
java
5+
id("architectury-plugin") version "3.4-SNAPSHOT"
6+
id("dev.architectury.loom") version "1.4-SNAPSHOT" apply false
37
}
48

59
val modVersion: String by extra
610
val minecraftVersion: String by extra
711

12+
architectury {
13+
minecraft = minecraftVersion
14+
}
15+
816
subprojects {
17+
apply(plugin = "dev.architectury.loom")
18+
19+
base.archivesName.set("PacketFixer-" + project.name)
20+
21+
configure<LoomGradleExtensionAPI> {
22+
silentMojangMappingsLicense()
23+
}
24+
25+
dependencies {
26+
"minecraft"("com.mojang:minecraft:$minecraftVersion")
27+
"mappings"(project.the<LoomGradleExtensionAPI>().officialMojangMappings())
28+
}
29+
}
30+
31+
allprojects {
932
apply(plugin = "java")
33+
apply(plugin = "architectury-plugin")
1034

11-
version = "$modVersion-$minecraftVersion"
12-
group = "net.tonimatasdev"
35+
version = modVersion
36+
group = "dev.tonimatas"
1337

14-
base.archivesName.set("PacketFixer-" + project.name)
38+
repositories {
39+
40+
}
41+
42+
tasks.withType<JavaCompile> {
43+
options.encoding = "UTF-8"
44+
}
45+
46+
java {
47+
withSourcesJar()
48+
}
1549
}

common/build.gradle.kts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
val fabricLoaderVersion: String by extra
2+
3+
dependencies {
4+
modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion")
5+
}
6+
7+
architectury {
8+
common("fabric", "forge", "neoforge")
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package dev.tonimatas.packetfixer;
2+
3+
import com.mojang.logging.LogUtils;
4+
public class PacketFixer {
5+
public static final String MOD_ID = "packetfixer";
6+
7+
public static void init() {
8+
LogUtils.getLogger().info("Packet Fixer has been initialized successfully");
9+
}
10+
}

forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ClientboundCustomPayloadPacketMixin.java common/src/main/java/dev/tonimatas/packetfixer/mixins/ClientboundCustomPayloadPacketMixin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package net.tonimatasdev.packetfixerforge.mixin;
1+
package dev.tonimatas.packetfixer.mixins;
22

33

44
import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;

neoforge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ClientboundCustomQueryPacketMixin.java common/src/main/java/dev/tonimatas/packetfixer/mixins/ClientboundCustomQueryPacketMixin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package net.tonimatasdev.packetfixerforge.mixin;
1+
package dev.tonimatas.packetfixer.mixins;
22

33
import net.minecraft.network.protocol.login.ClientboundCustomQueryPacket;
44
import org.spongepowered.asm.mixin.Mixin;

neoforge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/CompressionDecoderMixin.java common/src/main/java/dev/tonimatas/packetfixer/mixins/CompressionDecoderMixin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package net.tonimatasdev.packetfixerforge.mixin;
1+
package dev.tonimatas.packetfixer.mixins;
22

33
import net.minecraft.network.CompressionDecoder;
44
import org.spongepowered.asm.mixin.Mixin;

neoforge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/MixinConfigPlugin.java common/src/main/java/dev/tonimatas/packetfixer/mixins/MixinConfigPlugin.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
package net.tonimatasdev.packetfixerforge.mixin;
1+
package dev.tonimatas.packetfixer.mixins;
22

33
import com.mojang.logging.LogUtils;
4-
import net.neoforged.fml.loading.FMLLoader;
54
import org.objectweb.asm.tree.ClassNode;
65
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
76
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
@@ -23,13 +22,14 @@ public String getRefMapperConfig() {
2322

2423
@Override
2524
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
26-
boolean krypton = FMLLoader.getLoadingModList().getModFileById("krypton") != null || FMLLoader.getLoadingModList().getModFileById("pluto") != null;
25+
// TODO: Fix this
26+
//boolean krypton = FMLLoader.getLoadingModList().getModFileById("krypton") != null || FMLLoader.getLoadingModList().getModFileById("pluto") != null;
2727

2828
if (mixinClassName.equalsIgnoreCase("net.tonimatasdev.packetfixerforge.mixin.Varint21FrameDecoderMixin") || mixinClassName.equalsIgnoreCase("net.tonimatasdev.packetfixerforge.mixin.Varint21LengthFieldPrependerMixin")) {
29-
if (krypton) {
30-
LogUtils.getLogger().warn("For can't fit X into 3 error fix. Delete Krypton or Pluto.");
31-
return false;
32-
}
29+
//if (krypton) {
30+
// LogUtils.getLogger().warn("For can't fit X into 3 error fix. Delete Krypton or Pluto.");
31+
// return false;
32+
//}
3333
}
3434

3535
return true;

forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/NbtAccounterMixin.java common/src/main/java/dev/tonimatas/packetfixer/mixins/NbtAccounterMixin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package net.tonimatasdev.packetfixerforge.mixin;
1+
package dev.tonimatas.packetfixer.mixins;
22

33
import net.minecraft.nbt.NbtAccounter;
44
import org.objectweb.asm.Opcodes;

forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/PacketEncoderMixin.java common/src/main/java/dev/tonimatas/packetfixer/mixins/PacketEncoderMixin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package net.tonimatasdev.packetfixerforge.mixin;
1+
package dev.tonimatas.packetfixer.mixins;
22

33
import net.minecraft.network.PacketEncoder;
44
import org.spongepowered.asm.mixin.Mixin;

neoforge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ServerboundCustomPayloadPacketMixin.java common/src/main/java/dev/tonimatas/packetfixer/mixins/ServerboundCustomPayloadPacketMixin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package net.tonimatasdev.packetfixerforge.mixin;
1+
package dev.tonimatas.packetfixer.mixins;
22

33
import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket;
44
import org.spongepowered.asm.mixin.Mixin;

forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/ServerboundCustomQueryPacketMixin.java common/src/main/java/dev/tonimatas/packetfixer/mixins/ServerboundCustomQueryPacketMixin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package net.tonimatasdev.packetfixerforge.mixin;
1+
package dev.tonimatas.packetfixer.mixins;
22

33
import net.minecraft.network.protocol.login.ServerboundCustomQueryAnswerPacket;
44
import org.spongepowered.asm.mixin.Mixin;

neoforge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/Varint21FrameDecoderMixin.java common/src/main/java/dev/tonimatas/packetfixer/mixins/Varint21FrameDecoderMixin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package net.tonimatasdev.packetfixerforge.mixin;
1+
package dev.tonimatas.packetfixer.mixins;
22

33
import io.netty.buffer.ByteBuf;
44
import io.netty.buffer.Unpooled;

neoforge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/Varint21LengthFieldPrependerMixin.java common/src/main/java/dev/tonimatas/packetfixer/mixins/Varint21LengthFieldPrependerMixin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package net.tonimatasdev.packetfixerforge.mixin;
1+
package dev.tonimatas.packetfixer.mixins;
22

33
import net.minecraft.network.Varint21LengthFieldPrepender;
44
import org.spongepowered.asm.mixin.Mixin;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"required": true,
3+
"minVersion": "0.8",
4+
"package": "dev.tonimatas.packetfixer.mixins",
5+
"compatibilityLevel": "JAVA_17",
6+
"mixins": [
7+
],
8+
"client": [
9+
],
10+
"injectors": {
11+
"defaultRequire": 1
12+
}
13+
}

fabric/build.gradle.kts

+45-18
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,39 @@
1-
@file:Suppress("UnstableApiUsage")
1+
@file:Suppress("DEPRECATION", "HasPlatformType")
2+
3+
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
4+
import net.fabricmc.loom.task.RemapJarTask
5+
import org.gradle.api.component.AdhocComponentWithVariants
26

37
plugins {
4-
id("fabric-loom") version "1.3-SNAPSHOT"
8+
id("com.github.johnrengelman.shadow") version "7.1.2"
9+
}
10+
11+
architectury {
12+
platformSetupLoomIde()
13+
fabric()
514
}
615

7-
val loaderVersion: String by extra
8-
val yarnMappings: String by extra
9-
val modVersion: String by extra
1016
val minecraftVersion: String by extra
17+
val fabricLoaderVersion: String by extra
18+
val fabricMinecraftVersionRange: String by extra
19+
val modVersion: String by extra
20+
21+
val common by configurations.creating
22+
val shadowCommon by configurations.creating
23+
24+
configurations["compileClasspath"].extendsFrom(common)
25+
configurations["runtimeClasspath"].extendsFrom(common)
26+
configurations["developmentFabric"].extendsFrom(common)
1127

1228
dependencies {
13-
minecraft("com.mojang:minecraft:$minecraftVersion")
14-
mappings("net.fabricmc:yarn:$minecraftVersion+build.$yarnMappings:v2")
15-
modImplementation("net.fabricmc:fabric-loader:$loaderVersion")
29+
modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion")
1630

31+
common(project(path = ":common", configuration = "namedElements")) { isTransitive = false }
32+
shadowCommon(project(path = ":common", configuration = "transformProductionFabric")) { isTransitive = false }
1733
}
1834

1935
tasks.withType<ProcessResources> {
20-
val replaceProperties = mapOf("version" to modVersion, "minecraftVersion" to minecraftVersion)
36+
val replaceProperties = mapOf("modVersion" to modVersion, "minecraftVersion" to minecraftVersion)
2137

2238
inputs.properties(replaceProperties)
2339

@@ -26,19 +42,30 @@ tasks.withType<ProcessResources> {
2642
}
2743
}
2844

29-
tasks.withType<JavaCompile> {
30-
options.release.set(17)
45+
tasks.withType<ShadowJar> {
46+
configurations = listOf(shadowCommon)
47+
archiveClassifier.set("dev-shadow")
3148
}
3249

33-
java {
34-
withSourcesJar()
35-
36-
sourceCompatibility = JavaVersion.VERSION_17
37-
targetCompatibility = JavaVersion.VERSION_17
50+
tasks.withType<RemapJarTask> {
51+
val shadowTask = tasks.shadowJar.get()
52+
input.set(shadowTask.archiveFile)
53+
dependsOn(shadowTask)
54+
archiveClassifier.set("")
3855
}
3956

4057
tasks.jar {
41-
from("LICENSE") {
42-
rename { "${it}_${project.base.archivesName.get()}"}
58+
archiveClassifier.set("dev")
59+
}
60+
61+
tasks.sourcesJar {
62+
val commonSources = project(":common").tasks.sourcesJar.get()
63+
dependsOn(commonSources)
64+
from(commonSources.archiveFile.map { zipTree(it) })
65+
}
66+
67+
components.getByName<AdhocComponentWithVariants>("java").apply {
68+
withVariantsFromConfiguration(project.configurations["shadowRuntimeElements"]) {
69+
skip()
4370
}
4471
}

0 commit comments

Comments
 (0)