generated from MeteorDevelopment/meteor-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Showing
3 changed files
with
11 additions
and
13 deletions.
There are no files selected for viewing
17 changes: 8 additions & 9 deletions
17
...t/mixins/MixinDefaultChannelPipeline.java → ...lackout/mixins/MixinClientConnection.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 |
---|---|---|
@@ -1,24 +1,23 @@ | ||
package kassuk.addon.blackout.mixins; | ||
|
||
import io.netty.channel.ChannelFuture; | ||
import io.netty.channel.DefaultChannelPipeline; | ||
import kassuk.addon.blackout.modules.PacketLogger; | ||
import meteordevelopment.meteorclient.systems.modules.Modules; | ||
import net.minecraft.network.ClientConnection; | ||
import net.minecraft.network.PacketCallbacks; | ||
import net.minecraft.network.packet.Packet; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(DefaultChannelPipeline.class) | ||
public class MixinDefaultChannelPipeline { | ||
@Mixin(ClientConnection.class) | ||
public class MixinClientConnection { | ||
@Unique private PacketLogger packetLogger = null; | ||
|
||
@Inject(method = "write(Ljava/lang/Object;)Lio/netty/channel/ChannelFuture;", at = @At("HEAD")) | ||
private void writePacket(Object msg, CallbackInfoReturnable<ChannelFuture> cir) { | ||
@Inject(method = "sendInternal", at = @At("HEAD")) | ||
private void onSent(Packet<?> packet, PacketCallbacks callbacks, boolean flush, CallbackInfo ci) { | ||
if (packetLogger == null) packetLogger = Modules.get().get(PacketLogger.class); | ||
else if (msg instanceof Packet<?> packet && packetLogger.isActive()) | ||
packetLogger.onSent(packet); | ||
else if (packetLogger.isActive()) packetLogger.onSent(packet); | ||
} | ||
} |
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