-
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
139d529
commit e27f763
Showing
26 changed files
with
341 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,10 @@ jobs: | |
uses: actions/[email protected] | ||
with: | ||
name: PacketFixerFabric | ||
path: fabric/build/libs/**.jar | ||
path: fabric/build/libs/**.jar | ||
|
||
- name: Upload a NeoForge Artifacts | ||
uses: actions/[email protected] | ||
with: | ||
name: PacketFixerNeoForge | ||
path: neoforge/build/libs/**.jar |
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
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
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
14 changes: 0 additions & 14 deletions
14
...ava/net/tonimatasdev/packetfixerfabric/mixin/compat/connectivity/PacketInflaterMixin.java
This file was deleted.
Oops, something went wrong.
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
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
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
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
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 @@ | ||
@file:Suppress("UnstableApiUsage") | ||
|
||
plugins { | ||
id ("java-library") | ||
id ("eclipse") | ||
id ("idea") | ||
id ("maven-publish") | ||
id ("net.neoforged.gradle.userdev") version "7.0.57" | ||
} | ||
|
||
val modVersion: String by extra | ||
val minecraftVersion: String by extra | ||
val neoforgeVersion: String by extra | ||
val neoforgeVersionRange: String by extra | ||
|
||
group = "net.tonimatasdev" | ||
version = "$modVersion-$minecraftVersion" | ||
|
||
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17)) | ||
|
||
sourceSets.main.get().resources { srcDir("src/generated/resources") } | ||
|
||
repositories { | ||
|
||
} | ||
|
||
dependencies { | ||
implementation("net.neoforged:neoforge:${neoforgeVersion}") | ||
annotationProcessor("org.spongepowered:mixin:0.8.5:processor") | ||
} | ||
|
||
|
||
|
||
tasks.withType<ProcessResources> { | ||
val replaceProperties = mapOf("neoforgeVersionRange" to neoforgeVersionRange, "modVersion" to modVersion, "minecraftVersion" to minecraftVersion) | ||
|
||
inputs.properties(replaceProperties) | ||
|
||
filesMatching(listOf("META-INF/mods.toml", "pack.mcmeta")) { | ||
expand(replaceProperties) | ||
} | ||
} | ||
|
||
tasks.withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
} |
11 changes: 11 additions & 0 deletions
11
neoforge/src/main/java/net/tonimatasdev/packetfixerforge/PacketFixerNeoForge.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 net.tonimatasdev.packetfixerforge; | ||
|
||
import com.mojang.logging.LogUtils; | ||
import net.neoforged.fml.common.Mod; | ||
|
||
@Mod("packetfixer") | ||
public class PacketFixerNeoForge { | ||
public PacketFixerNeoForge() { | ||
LogUtils.getLogger().info("Packet Fixer (NeoForge) has been initialized successfully"); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...ain/java/net/tonimatasdev/packetfixerforge/mixin/ClientboundCustomPayloadPacketMixin.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,15 @@ | ||
package net.tonimatasdev.packetfixerforge.mixin; | ||
|
||
|
||
import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
@Mixin(value = ClientboundCustomPayloadPacket.class, priority = 9999) | ||
public class ClientboundCustomPayloadPacketMixin { | ||
@ModifyConstant(method = "readUnknownPayload", constant = @Constant(intValue = 1048576)) | ||
private static int newSize(int value) { | ||
return Integer.MAX_VALUE; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
.../main/java/net/tonimatasdev/packetfixerforge/mixin/ClientboundCustomQueryPacketMixin.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,14 @@ | ||
package net.tonimatasdev.packetfixerforge.mixin; | ||
|
||
import net.minecraft.network.protocol.login.ClientboundCustomQueryPacket; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
@Mixin(value = ClientboundCustomQueryPacket.class, priority = 9999) | ||
public class ClientboundCustomQueryPacketMixin { | ||
@ModifyConstant(method = "readUnknownPayload", constant = @Constant(intValue = 1048576)) | ||
private static int newSize(int value) { | ||
return Integer.MAX_VALUE; | ||
} | ||
} |
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
57 changes: 57 additions & 0 deletions
57
neoforge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/MixinConfigPlugin.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,57 @@ | ||
package net.tonimatasdev.packetfixerforge.mixin; | ||
|
||
import com.mojang.logging.LogUtils; | ||
import net.neoforged.fml.loading.FMLLoader; | ||
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 MixinConfigPlugin 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) { | ||
boolean krypton = FMLLoader.getLoadingModList().getModFileById("krypton") != null || FMLLoader.getLoadingModList().getModFileById("pluto") != null; | ||
|
||
if (mixinClassName.equalsIgnoreCase("net.tonimatasdev.packetfixerforge.mixin.Varint21FrameDecoderMixin") || mixinClassName.equalsIgnoreCase("net.tonimatasdev.packetfixerforge.mixin.Varint21LengthFieldPrependerMixin")) { | ||
if (krypton) { | ||
LogUtils.getLogger().warn("For can't fit X into 3 error fix. Delete Krypton or Pluto."); | ||
return false; | ||
} | ||
} | ||
|
||
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) { | ||
|
||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
neoforge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/NbtAccounterMixin.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,15 @@ | ||
package net.tonimatasdev.packetfixerforge.mixin; | ||
|
||
import net.minecraft.nbt.NbtAccounter; | ||
import org.objectweb.asm.Opcodes; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(value = NbtAccounter.class, priority = 9999) | ||
public abstract class NbtAccounterMixin { | ||
@Redirect(method = "accountBytes(J)V", at = @At(value = "FIELD", target = "Lnet/minecraft/nbt/NbtAccounter;quota:J", opcode = Opcodes.GETFIELD)) | ||
public long accountBits(NbtAccounter instance) { | ||
return Long.MAX_VALUE; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
neoforge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/PacketEncoderMixin.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,14 @@ | ||
package net.tonimatasdev.packetfixerforge.mixin; | ||
|
||
import net.minecraft.network.PacketEncoder; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
@Mixin(value = PacketEncoder.class, priority = 9999) | ||
public class PacketEncoderMixin { | ||
@ModifyConstant(method = "encode(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/protocol/Packet;Lio/netty/buffer/ByteBuf;)V", constant = @Constant(intValue = 8388608)) | ||
private int newSize(int value) { | ||
return Integer.MAX_VALUE; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ain/java/net/tonimatasdev/packetfixerforge/mixin/ServerboundCustomPayloadPacketMixin.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,14 @@ | ||
package net.tonimatasdev.packetfixerforge.mixin; | ||
|
||
import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
@Mixin(value = ServerboundCustomPayloadPacket.class, priority = 9999) | ||
public class ServerboundCustomPayloadPacketMixin { | ||
@ModifyConstant(method = "readUnknownPayload", constant = @Constant(intValue = 32767)) | ||
private static int newSize(int value) { | ||
return Integer.MAX_VALUE; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
.../main/java/net/tonimatasdev/packetfixerforge/mixin/ServerboundCustomQueryPacketMixin.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,14 @@ | ||
package net.tonimatasdev.packetfixerforge.mixin; | ||
|
||
import net.minecraft.network.protocol.login.ServerboundCustomQueryAnswerPacket; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
@Mixin(value = ServerboundCustomQueryAnswerPacket.class, priority = 9999) | ||
public class ServerboundCustomQueryPacketMixin { | ||
@ModifyConstant(method = "readUnknownPayload", constant = @Constant(intValue = 1048576)) | ||
private static int newSize(int value) { | ||
return Integer.MAX_VALUE; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...orge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/Varint21FrameDecoderMixin.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,29 @@ | ||
package net.tonimatasdev.packetfixerforge.mixin; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import io.netty.buffer.Unpooled; | ||
import io.netty.channel.ChannelHandlerContext; | ||
import net.minecraft.network.Varint21FrameDecoder; | ||
import org.objectweb.asm.Opcodes; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.*; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(Varint21FrameDecoder.class) | ||
public class Varint21FrameDecoderMixin { | ||
@ModifyConstant(method = "copyVarint", constant = @Constant(intValue = 3)) | ||
private static int newSize(int value) { | ||
return 8; | ||
} | ||
|
||
@Inject(method = "handlerRemoved0", at = @At(value = "HEAD"), cancellable = true) | ||
private void redirectReadNullable(ChannelHandlerContext p_299287_, CallbackInfo ci) { | ||
Unpooled.directBuffer(8).release(); | ||
ci.cancel(); | ||
} | ||
|
||
@Redirect(method = "decode", at = @At(value = "FIELD", target = "Lnet/minecraft/network/Varint21FrameDecoder;helperBuf:Lio/netty/buffer/ByteBuf;", opcode = Opcodes.GETFIELD)) | ||
public ByteBuf accountBits(Varint21FrameDecoder instance) { | ||
return Unpooled.directBuffer(8); | ||
} | ||
} |
Oops, something went wrong.