diff options
author | nea <nea@nea.moe> | 2023-06-09 18:08:38 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-06-09 18:08:38 +0200 |
commit | 428056ff805839e04443dcff3badd021eb4abe01 (patch) | |
tree | 1dfb5b4dc84bc0884dc319be7f8ad4e949decb81 /src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java | |
parent | e7a7b04d8cadbc08d12272e8c59bff711be4d463 (diff) | |
download | firmament-428056ff805839e04443dcff3badd021eb4abe01.tar.gz firmament-428056ff805839e04443dcff3badd021eb4abe01.tar.bz2 firmament-428056ff805839e04443dcff3badd021eb4abe01.zip |
Add support for other mods using /locraw
Diffstat (limited to 'src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java')
-rw-r--r-- | src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java b/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java index 46ab08a..9d8463e 100644 --- a/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java +++ b/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java @@ -18,8 +18,10 @@ package moe.nea.firmament.mixins; +import moe.nea.firmament.events.OutgoingPacketEvent; import moe.nea.firmament.events.ParticleSpawnEvent; import net.minecraft.client.network.ClientPlayNetworkHandler; +import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.s2c.play.ParticleS2CPacket; import net.minecraft.util.math.Vec3d; import org.spongepowered.asm.mixin.Mixin; @@ -38,4 +40,11 @@ public class MixinClientPacketHandler { packet.isLongDistance() )); } + + @Inject(method = "sendPacket(Lnet/minecraft/network/packet/Packet;)V", at = @At("HEAD"), cancellable = true) + public void onSendPacket(Packet<?> packet, CallbackInfo ci) { + if (OutgoingPacketEvent.Companion.publish(new OutgoingPacketEvent(packet)).getCancelled()) { + ci.cancel(); + } + } } |