-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43cdbd9
commit 18ead32
Showing
19 changed files
with
368 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
common/src/main/java/dev/tonimatas/packetfixer/PacketFixer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package dev.tonimatas.packetfixer; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
public class PacketFixer { | ||
public static final Logger LOGGER = LogManager.getLogger(); | ||
public static final String MOD_ID = "packetfixer"; | ||
|
||
public static void init() { | ||
LOGGER.info("Packet Fixer has been initialized successfully"); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
common/src/main/java/dev/tonimatas/packetfixer/util/Hooks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dev.tonimatas.packetfixer.util; | ||
|
||
import dev.architectury.injectables.annotations.ExpectPlatform; | ||
import org.apache.commons.lang3.NotImplementedException; | ||
|
||
public class Hooks { | ||
@ExpectPlatform | ||
public static boolean isModLoaded(String modId) { | ||
throw new NotImplementedException("Problems on implement isModLoaded method."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "dev.tonimatas.packetfixer.mixins", | ||
"priority": 499, | ||
"compatibilityLevel": "JAVA_8", | ||
"plugin": "dev.tonimatas.packetfixer.mixins.MixinConfigPlugin", | ||
"mixins": [ | ||
"ClientboundCustomPayloadPacketMixin", | ||
"ClientboundCustomQueryPacketMixin", | ||
"CompressionDecoderMixin", | ||
"NbtAccounterMixin", | ||
"PacketBufferMixin", | ||
"ServerboundCustomPayloadPacketMixin", | ||
"ServerboundCustomQueryPacketMixin", | ||
"Varint21FrameDecoderMixin", | ||
"Varint21LengthFieldPrependerMixin" | ||
], | ||
"client": [ | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@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") version "7.1.2" | ||
} | ||
|
||
architectury { | ||
platformSetupLoomIde() | ||
fabric() | ||
} | ||
|
||
val minecraftVersion: String by extra | ||
val fabricLoaderVersion: String by extra | ||
val fabricMinecraftVersionRange: String by extra | ||
val modVersion: 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) | ||
|
||
dependencies { | ||
modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion") | ||
|
||
common(project(path = ":common", configuration = "namedElements")) { isTransitive = false } | ||
shadowCommon(project(path = ":common", configuration = "transformProductionFabric")) { isTransitive = false } | ||
} | ||
|
||
tasks.withType<ProcessResources> { | ||
val replaceProperties = mapOf("modVersion" to modVersion, "minecraftVersion" to minecraftVersion) | ||
|
||
inputs.properties(replaceProperties) | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand(replaceProperties) | ||
} | ||
} | ||
|
||
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() | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
fabric/src/main/java/dev/tonimatas/packetfixer/PacketFixerFabric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package dev.tonimatas.packetfixer; | ||
|
||
import net.fabricmc.api.ModInitializer; | ||
|
||
public class PacketFixerFabric implements ModInitializer { | ||
@Override | ||
public void onInitialize() { | ||
PacketFixer.init(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
fabric/src/main/java/dev/tonimatas/packetfixer/util/fabric/HooksImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package dev.tonimatas.packetfixer.util.fabric; | ||
|
||
import net.fabricmc.loader.api.FabricLoader; | ||
|
||
@SuppressWarnings("unused") | ||
public class HooksImpl { | ||
public static boolean isModLoaded(String modId) { | ||
return FabricLoader.getInstance().isModLoaded(modId); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"schemaVersion": 1, | ||
"id": "packetfixer", | ||
"version": "${modVersion}", | ||
"name": "Packet Fixer", | ||
"description": "A simple mod to solve various problems with packets/NBT's.", | ||
"authors": [ | ||
"TonimatasDEV" | ||
], | ||
"contact": { | ||
"repo": "https://github.com/TonimatasDEV/PacketFixer" | ||
}, | ||
"license": "MIT", | ||
"icon": "assets/packetfixer/icon.png", | ||
"environment": "*", | ||
"entrypoints": { | ||
"main": [ | ||
"dev.tonimatas.packetfixerfabric.PacketFixerFabric" | ||
] | ||
}, | ||
"mixins": [ | ||
"packetfixer-common.mixins.json", | ||
"packetfixer-fabric.mixins.json" | ||
], | ||
"depends": { | ||
"fabricloader": ">=0.12.12", | ||
"minecraft": "${minecraftVersion}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "dev.tonimatas.packetfixer.mixin", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
@file:Suppress("DEPRECATION") | ||
|
||
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") version "7.1.2" | ||
} | ||
|
||
val modVersion: String by extra | ||
val minecraftVersion: String by extra | ||
val forgeVersion: String by extra | ||
val forgeVersionRange: String by extra | ||
|
||
architectury { | ||
platformSetupLoomIde() | ||
forge() | ||
} | ||
|
||
loom { | ||
forge { | ||
mixinConfig("packetfixer-common.mixins.json") | ||
mixinConfig("packetfixer-forge.mixins.json") | ||
} | ||
} | ||
|
||
val common by configurations.creating | ||
val shadowCommon by configurations.creating | ||
|
||
configurations["compileClasspath"].extendsFrom(common) | ||
configurations["runtimeClasspath"].extendsFrom(common) | ||
configurations["developmentForge"].extendsFrom(common) | ||
|
||
dependencies { | ||
forge("net.minecraftforge:forge:$minecraftVersion-$forgeVersion") | ||
|
||
common(project(path = ":common", configuration = "namedElements")) { isTransitive = false } | ||
shadowCommon(project(path = ":common", configuration = "transformProductionForge")) { isTransitive = false } | ||
} | ||
|
||
tasks.withType<ProcessResources> { | ||
val replaceProperties = mapOf("minecraftVersion" to minecraftVersion, "forgeVersionRange" to forgeVersionRange, "modVersion" to modVersion) | ||
inputs.properties(replaceProperties) | ||
|
||
filesMatching("META-INF/mods.toml") { | ||
expand(replaceProperties) | ||
} | ||
} | ||
|
||
tasks.withType<ShadowJar> { | ||
exclude("fabric.mod.json") | ||
|
||
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() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
loom.platform=forge |
10 changes: 10 additions & 0 deletions
10
forge/src/main/java/dev/tonimatas/packetfixer/PacketFixerForge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package dev.tonimatas.packetfixer; | ||
|
||
import net.minecraftforge.fml.common.Mod; | ||
|
||
@Mod(PacketFixer.MOD_ID) | ||
public class PacketFixerForge { | ||
public PacketFixerForge() { | ||
PacketFixer.init(); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
forge/src/main/java/dev/tonimatas/packetfixer/mixin/MixinConfigPluginForge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package dev.tonimatas.packetfixer.mixin; | ||
|
||
import org.objectweb.asm.tree.ClassNode; | ||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; | ||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
public class MixinConfigPluginForge implements IMixinConfigPlugin { | ||
|
||
@Override | ||
public void onLoad(String mixinPackage) { | ||
System.getProperties().setProperty("forge.disablePacketCompressionDebug", "true"); | ||
} | ||
|
||
@Override | ||
public String getRefMapperConfig() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) { | ||
|
||
} | ||
|
||
@Override | ||
public List<String> getMixins() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { | ||
|
||
} | ||
|
||
@Override | ||
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { | ||
|
||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
forge/src/main/java/dev/tonimatas/packetfixer/util/forge/HooksImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package dev.tonimatas.packetfixer.util.forge; | ||
|
||
import net.minecraftforge.fml.loading.FMLLoader; | ||
|
||
@SuppressWarnings("unused") | ||
public class HooksImpl { | ||
public static boolean isModLoaded(String modId) { | ||
return FMLLoader.getLoadingModList().getModFileById(modId) != null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
modLoader="javafml" | ||
loaderVersion="[${forgeVersionRange},)" | ||
license="MIT" | ||
issueTrackerURL="https://github.com/TonimatasDEV/PacketFixer/issues" | ||
|
||
[[mods]] | ||
modId="packetfixer" | ||
version="${modVersion}" | ||
displayName="Packet Fixer" | ||
logoFile="icon.png" | ||
updateJSONURL="https://api.modrinth.com/updates/packet-fixer/forge_updates.json" | ||
authors="TonimatasDEV" | ||
description=''' | ||
A simple mod to solve various problems with packets/NBT's. | ||
''' | ||
|
||
[[dependencies.packetfixer]] | ||
modId="forge" | ||
mandatory=true | ||
versionRange="[${forgeVersionRange},)" | ||
ordering="NONE" | ||
side="BOTH" | ||
|
||
[[dependencies.packetfixer]] | ||
modId="minecraft" | ||
mandatory=true | ||
versionRange="[${minecraftVersion}]" | ||
ordering="NONE" | ||
side="BOTH" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "dev.tonimatas.packetfixer.mixin", | ||
"compatibilityLevel": "JAVA_8", | ||
"plugin": "dev.tonimatas.packetfixer.mixin.MixinConfigPluginForge", | ||
"injectors": { | ||
"defaultRequire": 1 | ||
}, | ||
"mixins": [ | ||
] | ||
} |