-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPacketCallbacks.java
More file actions
25 lines (19 loc) · 879 Bytes
/
PacketCallbacks.java
File metadata and controls
25 lines (19 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.matt.packetlistener;
import com.matt.packetlistener.events.PacketEvent;
import net.minecraft.network.Packet;
import net.minecraftforge.common.MinecraftForge;
public class PacketCallbacks {
public static final PacketCallbacks INSTANCE = new PacketCallbacks();
public static boolean onSendingPacket(Packet<?> packet) {
return MinecraftForge.EVENT_BUS.post(new PacketEvent.SentEvent.Pre(packet));
}
public static void onSentPacket(Packet<?> packet) {
MinecraftForge.EVENT_BUS.post(new PacketEvent.SentEvent.Post(packet));
}
public static boolean onPreReceived(Packet<?> packet) {
return MinecraftForge.EVENT_BUS.post(new PacketEvent.ReceivedEvent.Pre(packet));
}
public static void onPostReceived(Packet<?> packet) {
MinecraftForge.EVENT_BUS.post(new PacketEvent.ReceivedEvent.Post(packet));
}
}