@SuppressWarnings("rawtypes") @Override public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) { DataInputStream data = new DataInputStream(new ByteArrayInputStream(packet.data)); int packetType = PacketWrapper.readPacketID(data); if (packetType == PacketWrapper .PacketIdTileDescription) // server -> client; server propagating machine rotation; args // X Y Z rotation isActive { Class[] decodeAs = { Integer.class, Integer.class, Integer.class, Integer.class, Boolean.class }; Object[] packetReadout = PacketWrapper.readPacketData(data, decodeAs); TileEntity te = ((EntityPlayer) player) .worldObj.getBlockTileEntity( (Integer) packetReadout[0], (Integer) packetReadout[1], (Integer) packetReadout[2]); if (te instanceof TileEntityFactory) { TileEntityFactory tef = (TileEntityFactory) te; tef.rotateDirectlyTo((Integer) packetReadout[3]); tef.setIsActive((Boolean) packetReadout[4]); } } }
@Override public Packet getDescriptionPacket() { return PacketWrapper.createPacket( MineFactoryReloadedCore.modNetworkChannel, Packets.CableDescription, new Object[] { xCoord, yCoord, zCoord, _sideColors[0], _sideColors[1], _sideColors[2], _sideColors[3], _sideColors[4], _sideColors[5], cableMode[0] | (cableMode[1] << 8) | (cableMode[2] << 16) | (cableMode[3] << 24), cableMode[4] | (cableMode[5] << 8) | (cableMode[6] << 16) }); }
@Override public Packet getDescriptionPacket() { Object[] toSend = {xCoord, yCoord, zCoord, _forwardDirection.ordinal(), _isActive}; return PacketWrapper.createPacket( MineFactoryReloadedCore.modNetworkChannel, Packets.TileDescription, toSend); }