Reduced packet handler confusion.

This commit is contained in:
SirSengir 2012-08-13 14:59:43 +02:00
parent 348c0e8e1f
commit f3569a92ff
7 changed files with 27 additions and 24 deletions

View file

@ -1,11 +0,0 @@
package buildcraft.factory.network;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.forge.IPacketHandler;
public class PacketHandler implements IPacketHandler {
@Override
public void onPacketData(NetworkManager network, String channel, byte[] data) {}
}

View file

@ -0,0 +1,13 @@
package buildcraft.factory.network;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.Packet250CustomPayload;
public class PacketHandlerFactory implements IPacketHandler {
@Override
public void onPacketData(NetworkManager manager, Packet250CustomPayload packet, Player player) {}
}

View file

@ -31,13 +31,14 @@ import buildcraft.factory.RenderTank;
import buildcraft.factory.TileHopper;
import buildcraft.factory.TileRefinery;
import buildcraft.factory.TileTank;
import buildcraft.factory.network.PacketHandlerFactory;
import buildcraft.mod_BuildCraftCore.EntityRenderIndex;
import net.minecraft.src.ModLoader;
@Mod(name="BuildCraft Factory", version=DefaultProps.VERSION, useMetadata = false, modid = "BC|FACTORY")
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandler.class, clientSideRequired = true, serverSideRequired = true)
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandlerFactory.class, clientSideRequired = true, serverSideRequired = true)
public class mod_BuildCraftFactory {
public static mod_BuildCraftFactory instance;

View file

@ -29,10 +29,10 @@ import buildcraft.BuildCraftTransport;
import buildcraft.api.core.Orientations;
import buildcraft.core.DefaultProps;
import buildcraft.core.Utils;
import buildcraft.core.network.PacketHandler;
import buildcraft.silicon.network.PacketHandlerSilicon;
@Mod(name="BuildCraft Silicon", version=DefaultProps.VERSION, useMetadata = false, modid = "BC|SILICON")
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandler.class, clientSideRequired = true, serverSideRequired = true)
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandlerSilicon.class, clientSideRequired = true, serverSideRequired = true)
public class mod_BuildCraftSilicon {
public static mod_BuildCraftSilicon instance;

View file

@ -23,7 +23,7 @@ import buildcraft.transport.IPipeRenderState;
import buildcraft.transport.PipeItemRenderer;
import buildcraft.transport.PipeWorldRenderer;
import buildcraft.transport.RenderPipe;
import buildcraft.transport.network.PacketHandler;
import buildcraft.transport.network.PacketHandlerTransport;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.ModLoader;
@ -33,7 +33,7 @@ import net.minecraftforge.client.MinecraftForgeClient;
@Mod(version = DefaultProps.VERSION, modid="BC|TRANSPORT", name = "Buildcraft Transport")
@NetworkMod(channels={DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandler.class)
@NetworkMod(channels={DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandlerTransport.class)
public class mod_BuildCraftTransport {
public static mod_BuildCraftTransport instance;

View file

@ -3,6 +3,9 @@ package buildcraft.silicon.network;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
import buildcraft.core.network.PacketIds;
import buildcraft.core.network.PacketUpdate;
import buildcraft.factory.TileAssemblyTable;
@ -11,19 +14,16 @@ import buildcraft.silicon.GuiAssemblyTable;
import net.minecraft.src.GuiScreen;
import net.minecraft.src.ModLoader;
import net.minecraft.src.NetClientHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.forge.IPacketHandler;
import net.minecraft.src.Packet250CustomPayload;
public class PacketHandler implements IPacketHandler {
public class PacketHandlerSilicon implements IPacketHandler {
@Override
public void onPacketData(NetworkManager network, String channel, byte[] bytes) {
public void onPacketData(NetworkManager manager, Packet250CustomPayload packet, Player player) {
DataInputStream data = new DataInputStream(new ByteArrayInputStream(bytes));
DataInputStream data = new DataInputStream(new ByteArrayInputStream(packet.data));
try {
NetClientHandler net = (NetClientHandler) network.getNetHandler();
int packetID = data.read();
switch (packetID) {
case PacketIds.SELECTION_ASSEMBLY:

View file

@ -27,7 +27,7 @@ import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
public class PacketHandler implements IPacketHandler {
public class PacketHandlerTransport implements IPacketHandler {
@Override
public void onPacketData(NetworkManager manager, Packet250CustomPayload packet2, Player player) {