Add support for other mods using /locraw

This commit is contained in:
nea
2023-06-09 18:08:38 +02:00
parent e7a7b04d8c
commit 428056ff80
7 changed files with 105 additions and 20 deletions

View File

@@ -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();
}
}
}