mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 01:05:12 +00:00
Rename Namespace to kamkeel.npcs
This commit is contained in:
1 parent
19c31b985d
commit
5d41f5b939
128 files changed
+406
-440
No files matched your search
@@ -0,0 +1,31 @@
|
||||
package kamkeel.npcs.network;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class AbstractPacket {
|
||||
|
||||
public FMLProxyPacket generatePacket() {
|
||||
PacketChannel packetChannel = getChannel();
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
try {
|
||||
buf.writeInt(packetChannel.getChannelType().ordinal());
|
||||
buf.writeInt(getType().ordinal());
|
||||
sendData(buf);
|
||||
return new FMLProxyPacket(buf, getChannel().getChannelName());
|
||||
} catch (Exception ignored) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract Enum getType();
|
||||
public abstract PacketChannel getChannel();
|
||||
public abstract void sendData(ByteBuf out) throws IOException;
|
||||
|
||||
//"player" on the server side is the client who sent this packet
|
||||
//"player" on the client side is the client player
|
||||
public abstract void receiveData(ByteBuf in, EntityPlayer player) throws IOException;
|
||||
}
|
||||
Reference in new issue
Block a user