Search in sources :

Example 1 with CustomPayloadEvent

use of anticope.rejects.events.CustomPayloadEvent in project meteor-rejects by AntiCope.

the class CustomPayloadS2CPacketMixin method onApply.

@Inject(method = "apply(Lnet/minecraft/network/listener/ClientPlayPacketListener;)V", at = @At(value = "HEAD"), cancellable = true)
private void onApply(ClientPlayPacketListener clientPlayPacketListener, CallbackInfo info) {
    CustomPayloadS2CPacket packet = (CustomPayloadS2CPacket) (Object) this;
    CustomPayloadEvent event = MeteorClient.EVENT_BUS.post(CustomPayloadEvent.get(packet));
    if (event.isCancelled()) {
        info.cancel();
    }
}
Also used : CustomPayloadEvent(anticope.rejects.events.CustomPayloadEvent) CustomPayloadS2CPacket(net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

CustomPayloadEvent (anticope.rejects.events.CustomPayloadEvent)1 CustomPayloadS2CPacket (net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1