|
|
@@ -1,4 +1,4 @@
|
|
|
-package com.hexdragon.util.network;
|
|
|
+package com.hexdragon.corere.network;
|
|
|
|
|
|
import net.minecraft.network.PacketBuffer;
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
@@ -7,7 +7,7 @@ import net.minecraftforge.fml.network.simple.SimpleChannel;
|
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
|
-public class PacketManager {
|
|
|
+public class PacketManagerRe {
|
|
|
|
|
|
// 获取数据包的种类 ID
|
|
|
private static int ID = 0;
|
|
|
@@ -16,11 +16,11 @@ public class PacketManager {
|
|
|
// 创建 channel
|
|
|
public static SimpleChannel channel;
|
|
|
public static void create(String modid) {
|
|
|
- PacketManager.channel = NetworkRegistry.newSimpleChannel(new ResourceLocation(modid + ":packets"), () -> "1.0", (s) -> true, (s) -> true);
|
|
|
+ PacketManagerRe.channel = NetworkRegistry.newSimpleChannel(new ResourceLocation(modid + ":packets"), () -> "1.0", (s) -> true, (s) -> true);
|
|
|
}
|
|
|
|
|
|
// 注册数据包
|
|
|
- public static <T extends Packet> void registerPacket(Class<T> messageType, Function<PacketBuffer, T> decoder) {
|
|
|
+ public static <T extends PacketRe> void registerPacket(Class<T> messageType, Function<PacketBuffer, T> decoder) {
|
|
|
channel.registerMessage(nextID(), messageType, T::encoder, decoder, T::onReceivePacket);
|
|
|
}
|
|
|
|